'No API definition provided Swagger Not able to display the documentation

I'm not able to display my spring doc in swagger-ui. This is my configuration :

springdoc:
  # api-docs:
    # enabled: true
    # path: /v3/api-docs/swagger-config
  swagger-ui:
    # path: /swagger-ui.html
    disable-swagger-default-url: true
    # config-url: /v3/api-docs/swagger-config
    # url: /v3/api-docs

I enter this URL to access to the interface : http://localhost:8080/swagger-ui.html

swagger ui empty

The problem is that it is not displaying the api-docs which is loaded from :

"http://localhost:8080/v3/api-docs/swagger-config"

Status : 200.

But if i enter this in the url field, it works.. my goal is not to enter this each time..

swagger ui working

I tested everything possible.. i don't understand why it does not work

EDIT : swagger-config

{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8080/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}{"configUrl":"/v3/api-docs/swagger-config","oauth2RedirectUrl":"http://localhost:8080/swagger-ui/oauth2-redirect.html","url":"/v3/api-docs","validatorUrl":""}

network tab



Solution 1:[1]

I had a similar issue and was able to reproduce it by updating the configuration in the springdoc demo project 'springdoc-openapi-spring-boot-2-webmvc'. I had the following properties defined:

springdoc.api-docs.path=/test/v3/api-docs
sprindoc.swagger-ui.config-url=/test/v3/api-docs/swagger-config
springdoc.swagger-ui.path=/test/swagger-ui.html

With that configuration I able to reproduce the problem the OP reported. What fixed it for me was to add an additional property:

springdoc.swagger-ui.url=/test/v3/api-docs

Hope this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jacob Ven