Home > other >  Java Spring Boot openApi How does Swagger populate the top page entry field
Java Spring Boot openApi How does Swagger populate the top page entry field

Time:11-12

Swagger UI has an entry field on top of it's page. I guess that this page is a link to the documentation. Is this correct ? And how can I change this value ? I could already figure out that /V1 is retrieved from application.yaml.

spring:
  application:
    ...
    api-version: "v1"

enter image description here

CodePudding user response:

All of these things are configured via properties.

Use the following keys ...

springfox:
  documentation:
    swaggerUi:
      baseUrl: /documentation
    openApi:
      v3:
        path: /documentation/v3/api-docs
    swagger:
      v2:
        path: /documentation/v2/api-docs

You can also take a look at how they do it in the examples repo from Swagger. Just import it into your IDE via VCS import and explore. You can pick up a lot of useful tips, hacks and best practices this way.

Does this solve your problem ? Let me know in the comments.

CodePudding user response:

For Springdoc, it is different application.properties that have to be applied:

springdoc.api-docs.groups.enabled=true
springdoc.api-docs.path= /v3/api-docs
springdoc.api-docs.enabled=true
springdoc.swagger-ui.disable-swagger-default-url=true
springdoc.swagger-ui.url=/v3/api-docs
springdoc.swagger-ui.configUrl=/v3/api-docs/swagger-config
  • Related