api-platform-openapi
Skill2 starsChanged 6 months agoMITView on GitHub
Customize API Platform 4.3 OpenAPI / Hydra / Scalar documentation — the `openapi: new \\ApiPlatform\\OpenApi\\Model\\Operation(...)` attribute (with `Info`, `Parameter`, `RequestBody`, `Response`, `Server`, `Contact`, `License`), decorating `api_platform.openapi.factory` to inject `x-logo` and global metadata, the `openapi: false` flag to hide an operation, custom OpenAPI parameters with `OpenApiParameter`, vendor extensions `x-*`, Scalar UI (`/api/docs?ui=scalar`, `enable_scalar`), Swagger UI / ReDoc, exporting the spec (`php bin/console api:openapi:export --yaml --spec-version=3.0.0 --filter-tags=public --api-gateway`), security schemes (`bearerAuth`), and ADR documentation in `docs/adr/`. **No `openapiContext`** — that belongs to `api-platform-upgrade`.
In this repository52 other files it gives its agents.
- api-platform-dto-resourcesSkill
- api-platform-errorsSkill
- api-platform-file-uploadSkill
- api-platform-filtersSkill
- api-platform-identifiersSkill
- api-platform-mcpSkill
- api-platform-mutatorsSkill
- api-platform-paginationSkill
- api-platform-performanceSkill
- api-platform-resilienceSkill
- api-platform-resourcesSkill
- api-platform-securitySkill
- api-platform-serializationSkill
- api-platform-state-processorsSkill
- api-platform-state-providersSkill
- api-platform-testsSkill
- api-platform-upgradeSkill
- api-platform-userSkill
- api-platform-versioningSkill
- bootstrap-checkSkill
- brainstormingSkill
- config-env-parametersSkill
- controller-cleanupSkill
- cqrs-and-handlersSkill
- daily-workflowSkill
- doctrine-batch-processingSkill
- doctrine-fetch-modesSkill
- doctrine-fixtures-foundrySkill
- doctrine-migrationsSkill
- doctrine-relationsSkill
- doctrine-transactionsSkill
- effective-contextSkill
- executing-plansSkill
- functional-testsSkill
- interfaces-and-autowiringSkill
- makefile-disciplineSkill
- messenger-retry-failuresSkill
- ports-and-adaptersSkill
- quality-checksSkill
- rate-limitingSkill
- runner-selectionSkill
- strategy-patternSkill
- symfony-cacheSkill
- symfony-messengerSkill
- symfony-schedulerSkill
- symfony-votersSkill
- tdd-with-pestSkill
- tdd-with-phpunitSkill
- test-doubles-mockingSkill
- using-symfony-superpowersSkill
- value-objects-and-dtosSkill
- writing-plansSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Document architectural decisions in docs/adr/ (ADR-XXXX.md).
- Very specific: line 34
Schemas vs groups: every group affects the OpenAPI schema — use openapi_definition_name to disambiguate when needed.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Platform 4.3 — OpenAPI / Hydra / Scalar
Use when
- Adding
openapi: new Model\Operation(...)to an operation (summary, description, tags, requestBody, responses). - Decorating the OpenAPI factory to inject corporate
Info/x-logo/Server. - Enabling Scalar UI on top of the default Swagger UI.
- Hiding internal operations from the doc (
openapi: false). - Marking operations as deprecated (
Model\Operation(deprecated: true)). - Exporting the spec for an API Gateway or partner.
Default workflow
- Set global OpenAPI metadata via a factory decorator (
#[AsDecorator(decorates: 'api_platform.openapi.factory')]). - Per operation, attach
openapi: new Model\Operation(summary, description, tags, requestBody, responses). - For partner-facing endpoints, choose the UI: Swagger (default), ReDoc, Scalar (
?ui=scalar). - Export and review the spec (
php bin/console api:openapi:export --yaml). - Document architectural decisions in
docs/adr/(ADR-XXXX.md).
Guardrails
- No
openapiContext— it is deprecated. Useopenapi: new Model\Operation(...). - Security in OpenAPI: align
Model\Operation(security: [['bearerAuth' => []]])with the globalswagger.api_keysconfig. - Tags consistency: pick a short list (
['Books', 'Public']) and apply it everywhere. - Schemas vs groups: every group affects the OpenAPI schema — use
openapi_definition_nameto disambiguate when needed.
Progressive disclosure
SKILL.mdlists posture and rules.reference.mdcarries the full attribute usage, the factory decorator,Info/Server/Contact/License, customOpenApiParameter, vendor extensions, Scalar configuration, export commands, security schemes, ADR template.
Output contract
- Operations carry
openapi: new Model\Operation(...)(neveropenapiContext). - A factory decorator publishes corporate metadata.
- Spec exports validated (
api:openapi:export). - ADRs in
docs/adr/document non-trivial decisions.
References
reference.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

