0

Springfox 3.0 から OpenAPI 3.0 + Springdoc-openapi に切り替えています。
Springfox ではタグの順序はアルファベット順ですが、Springdoc の Swagger UI では順序がランダムに見えます。

UI でタグの順序を制御するにはどうすればよいですか? 私は自分で選んだ順序を好みますが、タグ名のアルファベット順に並べても問題ありません。

@Tag(name = MY_CONTROLLER_TAG_NAME, description = MY_CONTROLLER_TAG_DESC)
public class MyController {

ご希望の順番:

  • ページ分割されたエンドポイント
  • ユーザー アクセス
  • タグ付け
  • タグ付け - 管理者
  • ユーザー管理
  • ユーザー管理 - 管理者

実際の注文:

  • ユーザー アクセス
  • タグ付け
  • ページ分割されたエンドポイント
  • タグ付け - 管理者
  • ユーザー管理 - 管理者
  • ユーザー管理

POM の依存関係:

        <springdoc-openapi.version>1.6.4</springdoc-openapi.version>
...
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-ui</artifactId>
            <version>${springdoc-openapi.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-security</artifactId>
            <version>${springdoc-openapi.version}</version>
        </dependency>

アプリケーション.yml:

springdoc:
  show-actuator: ${SWAGGER_ENABLED:true}
  swagger-ui:
    doc-expansion: none
  api-docs:
    enabled: ${SWAGGER_ENABLED:true}
  model-converters:
    pageable-converter:
      enabled: true
4

1 に答える 1