Skip to content

OpenAPI

The OpenAPI 3.1 description is generated from the endpoints, so it always matches the code:

  • GET /api/v1/openapi.json (any valid token) describes the endpoints the calling client may use.
  • php spark anvil:api:openapi --output openapi.json describes all of them.

Resource endpoints are described from the form (bodies), the collection (list parameters) and apiRepresentationSchema() (answers). Custom endpoints derive their parameters and bodies from their rules; describe the answer with responseSchema([...], 200), and if needed the body with requestSchema([...]) and the query with queryParameters([...]). Each operation lists its permission as x-anvil-permission.