【问题标题】:Java Spring Boot openApi How does Swagger populate the top page entry fieldJava Spring Boot openApi Swagger 如何填充首页入口字段
【发布时间】:2021-11-12 09:27:31
【问题描述】:

Swagger UI 在其页面顶部有一个输入字段。我猜这个页面是文档的链接。它是否正确 ?我怎样才能改变这个值? 我已经知道 /V1 是从 application.yaml 中检索到的。

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

【问题讨论】:

    标签: java spring-boot springdoc-openapi-ui swagger-3.0


    【解决方案1】:

    所有这些都是通过属性配置的。

    使用以下键...

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

    您还可以在 Swagger 的 examples 存储库中查看他们是如何做到的。只需通过 VCS 导入和探索将其导入您的 IDE。通过这种方式,您可以获得很多有用的提示、技巧和最佳实践。

    这能解决您的问题吗?在 cmets 中告诉我。

    【讨论】:

    • 我猜这些是 Swagger SpringFox 版本的设置。它是否正确 ?我正在使用带有 swagger 3 的 openApi 3。
    • 查看下面的答案。我认为它有正确的数据。自从我上次碰它之后,Swagger 肯定发生了一些变化
    【解决方案2】:

    对于 Springdoc,必须应用不同的 application.properties:

    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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-01-02
      • 2021-02-12
      • 2020-12-18
      • 1970-01-01
      • 1970-01-01
      • 2021-12-21
      • 1970-01-01
      • 2023-02-09
      相关资源
      最近更新 更多