Swaggerhub integration in spring boot - swagger

I am new to swaggerhub so please explain me from basics.
In our project we are using springfox swagger and need to generate swaggerhub api specification.
How can I achieve this? Please let me know in detail or share reference links.

Your question is a little confusing. What do you mean by "swaggerhub api specification"?
Swagger is the documentation specification/tools used to work with the document spec. SwaggerHub is a design and collaboration tools for creating and maintaining Swagger documents.
SwaggerHub hosts Swagger documents, they work together rather than independently.
If you're creating Swagger documents and want to upload them to SwaggerHub automatically, you can do that using the SwaggerHub CLI or Registry API tools:
CLI: https://github.com/SmartBear/swaggerhub-cli
Registry API: https://app.swaggerhub.com/apis-docs/swagger-hub/registry-api/1.0.62

Related

Apache Wicket REST with Swagger UI

One of my project is using Apache Wicket 6.x and I have some API (resources) using wicketstuff-rest and it is working perfectly.
But for my API documentations, I am maintaining a google document for these APIs. Problem is that whenever there are changes in any of the API, or even on new APIs... I need to update this API documentation. Chances are, this documentation may not be updated.
On my other springboot projects, I am using swagger and the API documentation can be viewed via swagger-ui.
I wonder if I can use swagger-ui with existing apache wicket 6.x project so that whenever there are new API(s) or any change on the existing API(s)... it will reflect in swagger-ui without the need to maintain any API documentation.
What I currently search is swagger2markup, but this seems to be old and I am having problems with the setup and there are very few resources on how to set this up.
Anyone who successfully setup swagger-ui with apache wicket rest?
Care to share resource/links on tutorials or how to setup swagger-ui on apache wicket rest?
Thanks!
I don't have an easy solution for you with Swagger but if you use Spring already then you could use Spring REST Docs to generate the documentation from the unit tests.

Adding an API definition manually in swagger using springfox

I am using springfox for generating Swagger API documentation for REST APIs exposed by a spring boot application.
I need to add documentation for an API manually for which there is no REST controller, technically. How can I manually add to the Swagger API documentation? I want to do it once from the code.
You can create it using plugins mechanism. Create ApiListingScannerPlugin to dynamic added ApiDescription and OperationModelsProviderPlugin to dynamic added Definitions

Integrate the swagger ui into hammock

I am building up a CDI/REST Environment as basis for several projects by using hammock. What I would like to have besides CDI and REST is also json schema for generating payload classes and an automatically generated REST API documentation via swagger ui.
I am now at the point where everything works (Weld3, Resteasy, Undertow, Swagger Core, Json Schema). The only thing missing is the integration of swagger UI into my hammock stack.
In another project I already worked with swagger UI. As far as I know it is based on HTML + JS with an entry point index.hml. How do I integrate this into my hammock stack. How to tell the undertow that there is a index.html and where to find it ?
I think my question is not only related to swagger, but to the idea to have the hammock stack with additional static html content.
John Ament has added a swagger module for Swagger 2.0-rc3 to Hammock 2.1-SNAPHOT (will be released as part of Hammock 2.1):
https://github.com/hammock-project/hammock/tree/master/swagger
As for hosting Swagger UI inside a Hammock app, you can add a few files from swagger-ui/dist/* to Hammock's static resources path:
https://github.com/hammock-project/hammock/wiki/Native-Filters#static-resources

Swagger annotations and Swagger spec 2.0

I've developed a REST API anotated with Swagger annotations.
I've been able to show the api documentation on a swagger-ui application, very nice.
The problem:
I'm trying to generate clients acording this specification using the url provided by swagger acording my anotations.
The porblem is it seems to be imcompatible, or at least, I don't see how to do the swagger editor reads my url and from then on, generate clients. But swagger editor reports me about some errors...
It's possible to integrate my anotated swagger api with a swagger editor?
Thanks.
The question seems a bit confusing.
If you are trying to generate clients from your REST API Swagger spec, then you should take a look to Swagger-Codegen project.
Description of project:
swagger-codegen contains a template-driven engine to generate client code in different languages by parsing your Swagger Resource Declaration.
Link to repository: https://github.com/swagger-api/swagger-codegen/
Link to official page: http://swagger.io/swagger-codegen/
Not sure if I understand the question correctly. If you want to generate API clients online, you an use http://generator.swagger.io (besides http://editor.swagger.io). Here is an example to generate API client for Java:
curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"http://petstore.swagger.io/v2/swagger.json"}' http://generator.swagger.io/api/gen/clients/java
Swagger editor is used only for editing a swagger spec in either json or yml format. It does not deal with swagger annotations in any way. However, some of the server skeletons that are generated on the swagger-editor website contain annotations. The annotations are a way of reverse engineering your API to generate a json file so that swagger UI can render a webpage based on the public url path to your swagger.json file.
If you are maintaining a swagger spec json file anyways, the annotations aren't really needed, you might as well just serve up the raw swagger.json itself, rather than the json that is generated by the annotations.
As to your question, "Is it possible to integrate your API with swagger editor?"... Anything is possible, but I'm not sure as to how or why you want to integrate them.

Swagger spec in Swagger Core Jersey 1.X

I am using Swagger with Jersey 1. It generates spec in Swagger spec v1.2. Most of the tools out there (e.g. Editor ) require spec v2.0. Is there a way to generate spec v2.0 ?
I actually wanted printable/static docs like bootprint-swagger which also required spec v2.0.
I have not tried it myself, but https://github.com/lucybot/api-spec-converter seems to be able to convert Swagger 1.2 to Swagger 2.0
I'm not sure if it is an "official" Swagger-Tool, but it is just two clicks away from the Swagger-1.2-to-2.0-Migration-Guide, so I guess its like "half-official" at least.
I might try to incoorporate it into bootprint-swagger so that it supports Swagger 1.2 as well. I've just created an issue at github so that it is not forgotten.

Resources