Guide for contributing to the OpenAPI layer at src/Shared/Application/OpenApi/...
src/Shared/Application/OpenApi/Factory/Endpoint/src/Shared/Application/OpenApi/Factory/make validate-openapi-spec (Spectral)make openapi-diffmake schemathesis-validateDevelop and maintain OpenAPI specification generation in a way that:
with*() methods)Success Criteria:
make generate-openapi-spec produces .github/openapi-spec/spec.yamlmake validate-openapi-spec passesThis service uses a layered OpenAPI customization approach:
src/Shared/Application/OpenApi/
βββ Builder/ # Build common OpenAPI pieces
βββ Extractor/ # Extract example values / payload fragments
βββ Factory/ # Endpoint/Request/Response/Schema/UriParameter factories
βββ Transformer/ # Transform/modify OpenAPI operations, parameters, responses
βββ ValueObject/ + Enum/ # Strongly typed OpenAPI-related value objects
βββ Factory/OpenApiFactory.php # Main coordinator (decorator)
config/services.yaml decorates API Platformβs OpenAPI factory with:
App\Shared\Application\OpenApi\Factory\OpenApiFactory!tagged_iterator βapp.openapi_endpoint_factoryβwith*() methods; avoid mutating nested arrays unless API Platform forces it.withGet/withPost/... repeatedly.array_map, array_filter, array_keys over procedural mutation.See: reference/processor-patterns.md
src/Shared/Application/OpenApi/Transformer/.transform(OpenApi $openApi): OpenApi.array_keys($openApi->getPaths()->getPaths()).PathItem using an OPERATIONS constant + dynamic with/get calls.Augmenter/, Enricher/, Helper/). New OpenAPI transformation classes belong in Transformer/. Existing directories (Sanitizer/) are in use β do not duplicate their purpose.EndpointFactoryInterface under src/Shared/Application/OpenApi/Factory/Endpoint/._instanceof in config/services.yaml.src/Shared/Application/OpenApi/Factory/OpenApiFactory.php.Run locally (preferred order):
make generate-openapi-spec
make validate-openapi-spec
make openapi-diff
make schemathesis-validate
Notes:
make validate-openapi-spec runs ./scripts/validate-openapi-spec.sh (Spectral).make schemathesis-validate runs Examples and Coverage phases.complexity-management for refactoring when PHPInsights/PHPMD failsdocumentation-sync when spec changes require docs updates