Skip to content

Generate an OpenAPI description from the route map #34

Open

Description

@jk

Idea

The server already knows all routes (HTTP method, URL pattern, URL parameters, docblock/annotations). From that, an OpenAPI document could be generated and served, e.g. at GET /openapi.json, so clients can use Swagger UI, code generators etc.

Proposal

  • Target OpenAPI 3.1 (Swagger 2.0 is superseded).
  • Expose the route map via a public read-only accessor (e.g. getRoutes()), so the generator does not need internal access.
  • Ship the generator as an optional controller that can be registered via addClass(); API metadata (title, version, contact) configured on the controller, not via static properties.
  • Derive path parameters from $name placeholders, summaries/descriptions from docblocks or – after the planned move from docblock annotations to PHP attributes – from attributes.
  • Request/response schemas are out of scope for a first version.

An experimental Swagger 2.0 controller existed on the former feature/swagger branch (2015), which was never merged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions