Stone.js API
    Preparing search index...

    Function openapiCliPlugin

    • The OpenAPI Stone CLI plugin: typed frontend from the API contract.

      At build time (and in dev) it reads an OpenAPI or Swagger document from a path or URL, generates TypeScript type definitions with openapi-typescript, and writes them into .stone/tmp/. The types describe every request body, response, and parameter the API exposes, so the frontend never hand-writes a shape its own backend already defined.

      The plugin covers two sources:

      1. The app's own contract (the common case). Generate the OpenAPI JSON before this plugin runs (an earlier build step), write it to .stone/tmp/openapi.json, and omit the source option. The plugin reads the file at build time, nothing leaves the repository.
      2. An external contract. Pass a path or URL as source. The plugin reads the document and generates types for it.

      The package entry (@stone-js/openapi) stays free of Node-only code. Every filesystem and network call lives inside this plugin or the ./cli export, so a frontend bundle never pulls build-time dependencies in.

      Parameters

      Returns StoneCliPlugin

      The Stone CLI plugin.