Api docs
Customizes OpenAPI documentation for API Platform resources. Use whenever the user mentions OpenAPI/Swagger output, API docs, descriptions or examples on endpoints or properties, custom response documentation, hiding operations or resources from docs, or decorating the OpenAPI factory — even for small requests like 'document this field'.From its SKILL.md
npx -y skills add api-platform/skillset --skill api-docsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
4.4 KB, 961 tokens by cl100k_base, as published. Nobody here has run it
Customizing API Documentation
API Platform generates OpenAPI v3 documentation automatically. Customize it using attributes.
Global Info & Security Schemes (YAML)
Set the API-wide title, version, description and auth schemes in
config/packages/api_platform.yaml:
api_platform:
openapi:
info:
title: 'My API'
version: '1.0.0'
description: 'What this API does.'
components:
securitySchemes:
Bearer:
type: http
scheme: bearer
bearerFormat: JWT
Operation-Level Customization
use ApiPlatform\Metadata\Post;
use ApiPlatform\OpenApi\Model\Operation;
use ApiPlatform\OpenApi\Model\Response as OpenApiResponse;
#[Post(
openapi: new Operation(
summary: 'Create a new order',
description: 'Creates an order and sends confirmation email.',
responses: [
'201' => new OpenApiResponse(description: 'Order created successfully'),
'422' => new OpenApiResponse(description: 'Validation failed'),
]
)
)]
class Order {}
Property Documentation
use ApiPlatform\Metadata\ApiProperty;
class Order
{
#[ApiProperty(description: 'The unique identifier', example: 1)]
public int $id;
#[ApiProperty(
description: 'Current status',
example: 'pending',
openapiContext: ['enum' => ['pending', 'shipped', 'delivered']]
)]
public string $status;
#[ApiProperty(
genId: false,
types: ['https://schema.org/sender'],
openapiContext: [
'example' => ['address' => '[email protected]', 'name' => 'John'],
],
)]
public Recipient $from;
}
Use genId: false on embedded objects (non-IRI properties) to suppress @id generation.
Hiding from Documentation
// Hide entire resource
#[ApiResource(openapi: false)]
// Hide specific operation
#[Get(openapi: false)]
// Hide from Hydra entrypoint only (keep in OpenAPI)
#[Get(hydra: false)]
Custom Parameters
use ApiPlatform\Metadata\HeaderParameter;
#[Post(
parameters: [
'X-Idempotency-Key' => new HeaderParameter(
description: 'Unique key to prevent duplicate processing',
required: true,
),
],
)]
OpenApiFactory Decorator (Global Customization)
Decorate the built-in factory for global changes like custom server URLs:
<?php
namespace App\OpenApi;
use ApiPlatform\OpenApi\Factory\OpenApiFactoryInterface;
use ApiPlatform\OpenApi\Model;
use ApiPlatform\OpenApi\OpenApi;
final class OpenApiFactory implements OpenApiFactoryInterface
{
public function __construct(
private readonly OpenApiFactoryInterface $decorated,
private readonly string $openapiUrl,
) {}
public function __invoke(array $context = []): OpenApi
{
$openApi = $this->decorated->__invoke($context);
return $openApi->withServers([
new Model\Server($this->openapiUrl),
]);
}
}
Register as a decorator in services.yaml:
App\OpenApi\OpenApiFactory:
decorates: 'api_platform.openapi.factory'
arguments:
$openapiUrl: '%env(OPENAPI_URL)%'
Laravel
All the attribute-level customization — operation openapi: new Operation(...),
#[ApiProperty] description/example/openapiContext, openapi: false, hydra: false,
HeaderParameter — is framework-neutral and works unchanged. Only the global pieces
differ:
- Global title/version/description are top-level keys in
config/api-platform.php('title','version','description'); there is noopenapi.infoYAML. Security schemes are configured under theswagger_uiblock (apiKeys,oauth,http_auth) in the same file, andopenapi.tagsis available there too. - To decorate the OpenAPI factory, bind your decorator in a service provider with the
container's
extend()(resolving the innerOpenApiFactoryInterface) instead of the Symfonydecorates:YAML — theOpenApiFactoryInterfaceandwithServers(...)API are identical.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.
Gives 0 of the 12 instructions most api reference skills give in 961 tokens
Counted across 159 of the 198 authors here whose files we hold, read 2026-09-06
- Document all possible error responsesin 14 of 159, across 7 files
- Create OpenAPI 3.0 compliant specificationsin 13 of 159, across 7 files
- Use $ref for reusable componentsin 12 of 159, across 6 files
- Include example requests and responsesin 11 of 159, across 5 files
- Group endpoints logically with tagsin 11 of 159, across 5 files
- Document all endpoints with descriptions and examplesin 10 of 159, across 4 files
- Define request and response schemas accuratelyin 9 of 159, across 3 files
- Include authentication and security schemesin 8 of 159, across 2 files
- Provide clear examples for all operationsin 8 of 159, across 2 files
- Use descriptive summaries and descriptionsin 8 of 159, across 2 files
- Use clear operation IDsin 8 of 159, across 2 files
- Include parameter types and descriptionsin 7 of 159, across 5 files
Said here and by no other author read
- Set API-wide title, version, description in config
- Configure security schemes in global config
- Customize operations via Operation attributes
- Document properties with ApiProperty description and example
- Set genId false on embedded non-IRI properties
- Hide resources or operations with openapi false
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.