Class SpringPageableScanUtils


  • public final class SpringPageableScanUtils
    extends Object
    Language-agnostic utility methods for scanning OpenAPI specs for Spring Pageable-related features: sort enum validation, pageable defaults, and pageable constraints (max page/size).

    Used by both kotlin KotlinSpringServerCodegen and java SpringCodegen to share scan logic. Only the mustache templates and their registration remain language-specific.

    • Method Detail

      • willBePageable

        public static boolean willBePageable​(io.swagger.v3.oas.models.Operation operation,
                                             boolean autoXSpringPaginated)
        Returns true if the given operation will have a Pageable parameter injected — either because it has x-spring-paginated: true explicitly, or because autoXSpringPaginated is enabled and the operation has all three default pagination query parameters (page, size, sort).
      • scanSortValidationEnums

        public static Map<String,​List<String>> scanSortValidationEnums​(io.swagger.v3.oas.models.OpenAPI openAPI,
                                                                             boolean autoXSpringPaginated)
        Scans all pageable operations for a sort parameter with enum values.
        Returns:
        map from operationId to list of allowed sort strings (e.g. ["id,asc", "id,desc"])