swagger ui without swagger auto apidoc json generation - spring-boot

I'd like to use the nice io.springfox:springfox-swagger-ui interface but I don't want to have my documentation auto generated via annotations in my springboot app (/v2/api-docs).
I have my proper swagger-api.json api description file under my project resources, how can I tell swagger-ui to use it as default ?
I tried to use: springfox.documentation.swagger.v2.path=/swagger-config.json as swagger properties but it does not use my file.

Related

How to generate an OpenAPI from a Spring app without running the app?

I can run a Spring Boot application and then use the springdoc-openapi-maven-plugin artifact to generate an OpenAPI spec.
However, is there also a way to generate the spec without running the application first?
I currently want to generate the spec in a GitHub Action and a direct way would simplify this a lot.
you can use swagger editor: https://editor.swagger.io/
It allows you to write a json/yaml with your specifications and at the same time you can view the result.
Also, in the upper part there are 2 features, which allow you to generate the code based on the json/yaml made.
For example you can create a spring application with all the endpoints you go to specify in your json/yaml ( server).
But you can also generate HTML. (Client)

Quarkus+Apache Camel+Swagger ui

I'm currently working on Quarkus with swagger ui and followed a link to test it below link successfully https://quarkus.io/guides/openapi-swaggerui.
but is there any way to implement apache camel route with swagger ui in quarkus? kindly help me.
If you add the camel-quarkus-openapi-java extension to your application, then you can add documentation to your REST DSL routes and have it rendered as an OpenAPI document. There's more information on how to do this here:
https://camel.apache.org/manual/latest/rest-dsl.html
Then you can configure the default URL that the Swagger UI points to.
For example, assuming you configured your Camel OpenAPI documentation to be served at /openapi.yaml, you can configure the Quarkus Swagger UI extension to consume it.
camel.rest.api-context-path = /openapi.yaml
quarkus.swagger-ui.urls.camel = /openapi.yaml

Automatic OpenAPI YAML generation

I am working on the backend of a Spring Boot application that uses OpenAPI and Swagger to provide the interface for frontend application via an schema.yml file.
When a change is done on the controllers, we use the swagger-ui to get the api-docs JSON, convert it to yaml using the online swagger editor and paste the result in th schema.yml file
Now, I want to automate this so that we can just call a maven task that will automatically generate the yaml file, but I could not find any maven plugin that does this.
Is there a way to automate the generation of the yaml file or do I need to write my own plugin?

Custom swagger documentation/ Where is my swagger setup?

I have a jhipster based Spring project, which uses yarn/angular on the front end, and Spring on the back. I am with trying to figure out how to customize the swagger page. Currently it auto-populates new API's using swagger-ui, which is great, but I needed to add more custom info to those API's, hence my problem.
But I'm confused on what's running swagger. It looks like there's a node package called swagger-ui-dist and I also see a src/main/webapp folder with a swagger-ui folder, containing an index.html page.
I think what I pretty much want is to replace the current swagger-ui auto setup, with swagger that reads a file that I can create online using Swagger editor.
Apologies, for what I hope are simple questions. I'm brand new at swagger and npm/yarn.
Thanks
So after a bit more research, I found you could create your own OpenAPI doc, but an easier method in Spring is to annotate the endpoint methods with the #APIOperation annotation. There are other swagger specific annotations as well.
In the parameters, you can give value="", notes="" and a number of other customized values that will clarify what your API does in Swagger. Then swagger auto fills it in when bringing up your swagger page.
I hope that helps anyone with the same issue I had.

Adding a parameter by default to all API calls in Swagger UI

I want to use Swagger UI with Jersey REST APIs. I want to add an extra parameter to all APIs in Swagger UI but don't want to change the APIs itself(don't want to add corresponding #QueryParam in APIs).
How can I achieve this?
Swagger version i'm using: v2.1.4

Resources