fix(spring): preserve original operation ID for pageable

Merged
WA
2mo ago
+99-1

Summary

Fix Spring pageable annotation generation when an OpenAPI operationId is normalized during code
generation.

For example, list-items is normalized to listItems, but the pageable registries are populated
using the original OpenAPI operation ID. The generated operation now uses operationIdOriginal for
registry lookups, with a fallback to the normalized operationId.

Changes

  • Use CodegenOperation.operationIdOriginal when applying pageable annotations.
  • Preserve the normalized operationId as a fallback when no original ID exists.
  • Add an end-to-end regression test for operationId: list-items.
  • Add a minimal OpenAPI fixture covering pageable constraints, sort validation, pageable defaults,
    and sort defaults.

Validation

  • SpringPageableScanUtilsTest: 27 tests passed.
  • SpringCodegenTest#pageableAnnotationsUseOriginalOperationId_issue24721: passed.
  • Full SpringCodegenTest: 328 tests passed.

Summary by cubic

Preserves the original OpenAPI operationId when generating Spring pageable annotations to avoid mismatches after normalization. Previously, registries were keyed by the original ID while generation used the normalized ID; lookup now prefers operationIdOriginal with a fallback to operationId.

  • In SpringPageableScanUtils.applyPageableAnnotations, use CodegenOperation.operationIdOriginal when present; otherwise use operationId.
  • Adds a unit test covering original-ID registry lookup and an end-to-end test validating operationId: list-items generates listItems with the expected pageable and sort annotations.
  • Adds 3_0/spring/issue_24721.yaml fixture covering pageable constraints and sort defaults.
  • No migration required; only pageable annotation resolution for sanitized operation IDs changes.