Stone.js API
    Preparing search index...

    Builds an OpenAPI 3.0 document from your Zod schemas and routes.

    You describe operations declaratively (request/response as Zod schemas or raw JSON Schema); the generator converts them, assembles parameters, request bodies and responses, and emits a valid document you can serve as JSON and render with Swagger UI. It is decoupled from the router: feed it routes via OpenApiGenerator.addRoutes or add paths explicitly.

    Index
    • Parameters

      • info: OpenApiInfo

        The document info.

      • OptionalonSkipped: (skipped: { reason: string; what: string }) => void

        Told when a schema could not be described, so a gap is visible rather than silent.

      Returns OpenApiGenerator

    • Add one operation.

      Parameters

      • method: string & {} | HttpMethod

        The HTTP method.

      • path: string

        The path (OpenAPI style, e.g. /users/{id}).

      • operation: OpenApiOperation

        The operation definition.

      Returns this

      This generator.

    • Derive every documented path from a router.

      The routing table already says what each endpoint is: its path, its method, what it accepts and whether it is protected. Reading it makes the document a view of the application rather than a second description of it, so there is nothing to restate and nothing that can drift.

      Parameters

      • router: RouterLike

        The router, duck-typed so this module does not depend on @stone-js/router.

      • registries: DerivationRegistries = {}

        How to resolve a name a route used instead of an inline value.

      Returns this

      This generator.

    • Register a reusable component schema.

      Parameters

      • name: string

        The schema name.

      • schema: SchemaInput

        The schema (Zod or JSON Schema).

      Returns this

      This generator.

    • Add a server entry.

      Parameters

      • url: string

        The server URL.

      • Optionaldescription: string

        Optional description.

      Returns this

      This generator.

    • Add a tag.

      Parameters

      • name: string

        The tag name.

      • Optionaldescription: string

        Optional description.

      Returns this

      This generator.

    • Parameters

      • info: OpenApiInfo

        The document info.

      • OptionalonSkipped: (skipped: { reason: string; what: string }) => void

      Returns OpenApiGenerator

      A new generator.