Skip to content

feat(EM-45): Migrate from Springfox to SpringDoc OpenAPI 3 and Define REST API Standards#173

Open
devin-ai-integration[bot] wants to merge 2 commits intofeat/microservices-migration-v5from
devin/1773765332-openapi-migration
Open

feat(EM-45): Migrate from Springfox to SpringDoc OpenAPI 3 and Define REST API Standards#173
devin-ai-integration[bot] wants to merge 2 commits intofeat/microservices-migration-v5from
devin/1773765332-openapi-migration

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Mar 17, 2026

Summary

Extends the shared-libraries/ftgo-openapi-lib module with standardized API infrastructure and defines comprehensive REST API standards for the FTGO platform. Builds on top of the base SpringDoc OpenAPI 3 migration already present in feat/microservices-migration-v5.

Additions to shared-libraries/ftgo-openapi-lib:

  • FtgoOpenApiConfiguration — Configurable OpenAPI 3.0 metadata bean (complements upstream's FtgoOpenApiAutoConfiguration)
  • ApiVersioningConfiguration — Adds /api/v1 prefix to all @RestController endpoints via PathMatchConfigurer
  • GlobalExceptionHandler@RestControllerAdvice returning standardized ApiErrorResponse
  • ApiErrorResponse — Structured error response model with field-level validation errors
  • PagedResponse<T> / PaginationConstants — Standardized pagination envelope and defaults
  • ApiContractTestBase — MockMvc-based contract test base class (test scope only)
  • ftgo-openapi-defaults.properties — Default SpringDoc and Jackson configuration
  • build.gradle enhanced with ftgo.testing-conventions plugin and javadoc lint suppression

Documentation:

  • docs/rest-api-standards.md — Comprehensive REST conventions (URL naming, HTTP methods, status codes, pagination, filtering, error handling, versioning)
  • docs/adr/ADR-006-api-versioning-strategy.md — ADR for URL path versioning decision

Unit tests for FtgoOpenApiConfiguration, PagedResponse, and ApiErrorResponse.

Updates since last revision

  • Resolved merge conflicts with feat/microservices-migration-v5 which had parallel OpenAPI migration work (security, observability, API gateway, controller annotations using @PostMapping/@GetMapping, FtgoOpenApiAutoConfiguration, ApiError model)
  • Adopted upstream's controller annotations and FtgoOpenApiAutoConfiguration naming; this PR's net contribution is now the standards/documentation layer and additional shared utilities (ApiVersioningConfiguration, GlobalExceptionHandler, ApiErrorResponse, PagedResponse, PaginationConstants, contract testing base)

Review & Testing Checklist for Human

  • Two OpenAPI configuration classes now coexist: FtgoOpenApiConfiguration (this PR) and FtgoOpenApiAutoConfiguration (upstream). Both define an OpenAPI bean — the upstream's uses @ConditionalOnMissingBean, so our version would take precedence if both are on the classpath. Verify this doesn't cause duplicate bean conflicts and decide whether both are needed or if one should be removed.
  • Two error response models coexist: ApiErrorResponse (this PR) and ApiError (upstream). Controllers currently reference ApiError from upstream. Confirm whether ApiErrorResponse should replace ApiError or be consolidated.
  • ApiVersioningConfiguration adds /api/v1 prefix globally — This changes all endpoint paths (e.g. /orders/api/v1/orders). This class is defined but may not be active unless component-scanned or imported. Verify whether it's picked up automatically and whether existing tests/clients/integration configs would break.
  • GlobalExceptionHandler catches broad exceptions including Exception — This @RestControllerAdvice will be picked up by component scanning in any consuming service. Confirm it doesn't conflict with or override existing exception handling.
  • ftgo-openapi-defaults.properties is not auto-loaded — Spring Boot only auto-loads application.properties/application.yml. These defaults won't take effect unless services add an explicit @PropertySource import. The Jackson date format also hardcodes literal 'Z' instead of using offset format XXX.

Recommended test plan:

  1. Start the monolith (ftgo-application) and confirm Swagger UI loads at /swagger-ui.html
  2. Check whether endpoints are served at /api/v1/orders (if ApiVersioningConfiguration is active) or at /orders (if not)
  3. Confirm OpenAPI spec at /v3/api-docs includes all annotated endpoints
  4. Run existing integration/e2e tests to verify no path routing regressions

Notes

  • The shared-libraries:ftgo-common module has a pre-existing compilation failure (missing commons-lang3 symbols) unrelated to this PR.
  • The ftgo-application:compileTestJava fails due to a pre-existing missing eventuate-util-test dependency, also unrelated.
  • PagedResponse and ApiErrorResponse models are defined but not yet returned by any controller — they are foundational types for future adoption.
  • ApiContractTestBase is in src/test/ of the library, meaning it is NOT available on the classpath of consuming services' tests. Services would need to copy the pattern or this should be published as a test-fixtures artifact.

Link to Devin session: https://app.devin.ai/sessions/25fefc874acc42b99ac8635d000f059b
Requested by: @mbatchelor81

… REST API standards

- Create ftgo-openapi-lib shared library replacing common-swagger module
  - FtgoOpenApiConfiguration: Shared OpenAPI 3.0 metadata with customizable properties
  - ApiVersioningConfiguration: URL path versioning (/api/v1/ prefix)
  - GlobalExceptionHandler: Standardized ApiErrorResponse error format
  - PagedResponse: Standard pagination envelope format
  - PaginationConstants: Shared pagination defaults
  - ApiContractTestBase: Base class for API contract testing

- Migrate all services from common-swagger to ftgo-openapi-lib
  - Update build.gradle dependencies for all legacy and new service modules
  - Replace CommonSwaggerConfiguration imports with FtgoOpenApiConfiguration

- Add OpenAPI 3.0 annotations to all controllers
  - OrderController: @tag, @operation, @apiresponse, @parameter for all 10 endpoints
  - ConsumerController: Full annotations for create and get endpoints
  - RestaurantController: Full annotations for create and get endpoints
  - CourierController: Full annotations for create, get, and availability endpoints

- Define comprehensive REST API standards (docs/rest-api-standards.md)
  - URL naming conventions (plural nouns, lowercase, hyphens)
  - HTTP method usage and status code standards
  - Request/response envelope format
  - Pagination format (page, size, sort, totalElements, totalPages)
  - Filtering and sorting conventions
  - Date/time format (ISO 8601 UTC)
  - Error handling standards

- Define API versioning strategy (ADR-006)
  - URL path versioning chosen over header/query parameter approaches
  - Version deprecation policy (6-month notice, max 2 concurrent versions)

- Create API documentation portal (docs/api-documentation-portal.md)
  - Service endpoint reference with Swagger UI and OpenAPI spec paths
  - SDK generation guide
  - Migration guide from Springfox to SpringDoc

- Unit tests for OpenAPI configuration, PagedResponse, and ApiErrorResponse

Co-Authored-By: mason.batchelor <masonbatchelor81@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…enapi-migration

Resolve merge conflicts with upstream changes from security, observability,
API gateway, and parallel OpenAPI migration work. Take upstream's modern
annotations (@PostMapping/@GetMapping) and FtgoOpenApiAutoConfiguration
naming convention while keeping our unique contributions (docs, pagination,
error handling, contract testing, API versioning configuration).

Co-Authored-By: mason.batchelor <masonbatchelor81@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants