Class SpringPageableScanUtils
- java.lang.Object
-
- org.openapitools.codegen.languages.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
KotlinSpringServerCodegenand javaSpringCodegento share scan logic. Only the mustache templates and their registration remain language-specific.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSpringPageableScanUtils.PageableConstraintsDataCarries max constraints for page number and page size from a pageable operation.static classSpringPageableScanUtils.PageableDefaultsDataCarries parsed default values for page, size, and sort fields from a pageable operation.static classSpringPageableScanUtils.SortFieldDefaultCarries a parsed sort field and its direction (always "ASC" or "DESC") from the spec default.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,SpringPageableScanUtils.PageableConstraintsData>scanPageableConstraints(io.swagger.v3.oas.models.OpenAPI openAPI, boolean autoXSpringPaginated)Scans all pageable operations formaximum:constraints onpageandsizeparameters.static Map<String,SpringPageableScanUtils.PageableDefaultsData>scanPageableDefaults(io.swagger.v3.oas.models.OpenAPI openAPI, boolean autoXSpringPaginated)Scans all pageable operations for default values onpage,size, andsortparameters.static Map<String,List<String>>scanSortValidationEnums(io.swagger.v3.oas.models.OpenAPI openAPI, boolean autoXSpringPaginated)Scans all pageable operations for asortparameter with enum values.static booleanwillBePageable(io.swagger.v3.oas.models.Operation operation, boolean autoXSpringPaginated)Returnstrueif the given operation will have a Pageable parameter injected — either because it hasx-spring-paginated: trueexplicitly, or becauseautoXSpringPaginatedis enabled and the operation has all three default pagination query parameters (page, size, sort).
-
-
-
Method Detail
-
willBePageable
public static boolean willBePageable(io.swagger.v3.oas.models.Operation operation, boolean autoXSpringPaginated)Returnstrueif the given operation will have a Pageable parameter injected — either because it hasx-spring-paginated: trueexplicitly, or becauseautoXSpringPaginatedis 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 asortparameter with enum values.- Returns:
- map from operationId to list of allowed sort strings (e.g.
["id,asc", "id,desc"])
-
scanPageableDefaults
public static Map<String,SpringPageableScanUtils.PageableDefaultsData> scanPageableDefaults(io.swagger.v3.oas.models.OpenAPI openAPI, boolean autoXSpringPaginated)
Scans all pageable operations for default values onpage,size, andsortparameters.- Returns:
- map from operationId to
SpringPageableScanUtils.PageableDefaultsData(only operations with at least one default are included)
-
scanPageableConstraints
public static Map<String,SpringPageableScanUtils.PageableConstraintsData> scanPageableConstraints(io.swagger.v3.oas.models.OpenAPI openAPI, boolean autoXSpringPaginated)
Scans all pageable operations formaximum:constraints onpageandsizeparameters.- Returns:
- map from operationId to
SpringPageableScanUtils.PageableConstraintsData(only operations with at least onemaximum:constraint are included)
-
-