2

私はドキュメントを読みました:https://springdoc.github.io/springdoc-openapi-demos/faq.html#how-can-i-ignore-some-field-of-model-すでに、ドキュメントはあまり明確ではありません、Spring Boot REST HATEOAS実装プロジェクトがあり、Swagger の代わりに Open API 3 仕様を使用しています。

各エンドポイントにページネーションを実装しましたが、私の業界標準ではコンテンツが複数のコンテンツとして期待されています。しかし、これは Pageable API の一部であるため、無効にする代わりにオーバーライドすることはできません。どうすればそれを行うことができますか?

PageEmployeeOut:
      type: object
      properties:
        totalElements:
          type: integer
          format: int64
        totalPages:
          type: integer
          format: int32
        size:
          type: integer
          format: int32
        content:
          type: array
          items:
            $ref: '#/components/schemas/EmployeeOut'
        number:
          type: integer
          format: int32
        sort:
          $ref: '#/components/schemas/Sort'
        numberOfElements:
          type: integer
          format: int32
        first:
          type: boolean
        pageable:
          $ref: '#/components/schemas/Pageable'
        last:
          type: boolean
        empty:
          type: boolean

Springfox Swagger のように、以下のようにできますが、Open API 3 (springdoc-openui)でこれに相当するものは何 ですか?

@Bean
public Docket api() {
    return new Docket(DocumentationType.SWAGGER_2)
            .select()
            .apis(Predicates.not(RequestHandlerSelectors.basePackage("org.springframework.boot")))
            .apis(RequestHandlerSelectors.basePackage("com.example"))
            .paths(PathSelectors.any())
            .build()
            .apiInfo(apiInfo())
            .useDefaultResponseMessages(false)
            .ignoredParameterTypes(Pageable.class);
}

これが私のエンドポイントです

public ResponseEntity<Page<EmployeeDto>> findEmployees(@Parameter(hidden=true) Pageable pageable) {
    Page<EmployeeDto> page = employeeService.findAllEmployees(page_params, pageable);
    return new ResponseEntity<>(page, HttpStatus.OK);
}
4

1 に答える 1