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
Conversation
… 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>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the
shared-libraries/ftgo-openapi-libmodule 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 infeat/microservices-migration-v5.Additions to
shared-libraries/ftgo-openapi-lib:FtgoOpenApiConfiguration— Configurable OpenAPI 3.0 metadata bean (complements upstream'sFtgoOpenApiAutoConfiguration)ApiVersioningConfiguration— Adds/api/v1prefix to all@RestControllerendpoints viaPathMatchConfigurerGlobalExceptionHandler—@RestControllerAdvicereturning standardizedApiErrorResponseApiErrorResponse— Structured error response model with field-level validation errorsPagedResponse<T>/PaginationConstants— Standardized pagination envelope and defaultsApiContractTestBase— MockMvc-based contract test base class (test scope only)ftgo-openapi-defaults.properties— Default SpringDoc and Jackson configurationbuild.gradleenhanced withftgo.testing-conventionsplugin and javadoc lint suppressionDocumentation:
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 decisionUnit tests for
FtgoOpenApiConfiguration,PagedResponse, andApiErrorResponse.Updates since last revision
feat/microservices-migration-v5which had parallel OpenAPI migration work (security, observability, API gateway, controller annotations using@PostMapping/@GetMapping,FtgoOpenApiAutoConfiguration,ApiErrormodel)FtgoOpenApiAutoConfigurationnaming; 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
FtgoOpenApiConfiguration(this PR) andFtgoOpenApiAutoConfiguration(upstream). Both define anOpenAPIbean — 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.ApiErrorResponse(this PR) andApiError(upstream). Controllers currently referenceApiErrorfrom upstream. Confirm whetherApiErrorResponseshould replaceApiErroror be consolidated.ApiVersioningConfigurationadds/api/v1prefix 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.GlobalExceptionHandlercatches broad exceptions includingException— This@RestControllerAdvicewill be picked up by component scanning in any consuming service. Confirm it doesn't conflict with or override existing exception handling.ftgo-openapi-defaults.propertiesis not auto-loaded — Spring Boot only auto-loadsapplication.properties/application.yml. These defaults won't take effect unless services add an explicit@PropertySourceimport. The Jackson date format also hardcodes literal'Z'instead of using offset formatXXX.Recommended test plan:
ftgo-application) and confirm Swagger UI loads at/swagger-ui.html/api/v1/orders(ifApiVersioningConfigurationis active) or at/orders(if not)/v3/api-docsincludes all annotated endpointsNotes
shared-libraries:ftgo-commonmodule has a pre-existing compilation failure (missing commons-lang3 symbols) unrelated to this PR.ftgo-application:compileTestJavafails due to a pre-existing missingeventuate-util-testdependency, also unrelated.PagedResponseandApiErrorResponsemodels are defined but not yet returned by any controller — they are foundational types for future adoption.ApiContractTestBaseis insrc/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