Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Phrase Studio OpenAPI

The OpenAPI 3.0 description of the Phrase Studio public API (/v1/..., the endpoints of studio-api under src/controllers/external/v1/).

Merging a change to schemas/projects.json on main publishes it: a workflow opens, approves and merges a pull request in developer-hub, which renders the API reference. There is no manual review of that copy, so the checks below are what keeps the published spec correct.

Layout

spec/
├── openapi.json        root: info, servers, tags, and a reference to every path and schema
├── paths/              one file per URL path, with all its methods
└── schemas/            one file per reusable schema (Project, Recording, Pagination, ErrorResponse, ...)
schemas/projects.json   GENERATED by `npm run bundle` from spec/. Never edit it by hand.
scripts/                bundler and rule checks, with tests
redocly.yaml            lint configuration

schemas/projects.json stays committed because the developer hub copies that exact file.

Commands

npm ci                # once
npm run bundle        # spec/ -> schemas/projects.json
npm run lint          # Redocly lint plus the Studio rules (below) on the bundled file
npm test              # tests of the rule scripts, and the published spec against the rules
npm run validate      # bundle, lint and test, what CI runs

Changing the API description

  1. Edit or add files under spec/. A new URL path is a new file in spec/paths/ plus one line in spec/openapi.json. Reuse the shared schemas through $ref (relative to the file: ../schemas/Project.json from a path file, ./Recording.json from a schema file). A new schema is a file in spec/schemas/ plus one line under components.schemas in spec/openapi.json.
  2. Run npm run validate and commit schemas/projects.json together with the source.

Change the spec in the same pull request as the endpoint it describes.

Rules

CI fails the pull request when one of these is broken (scripts/check-spec-rules.mjs, plus Redocly's own rules):

  • Every operation has summary, description, a camelCase operationId, tags and security, a success or redirect response, a 4xx response and a 401.
  • Every parameter, response and schema property has a description.
  • Every success response has an example.
  • Security schemes have a description.
  • Account, organization, identity and owner fields (accountId, organizationId, owner, username, ...) appear in no schema and no example: callers must never receive them, so the spec must not promise them.
  • schemas/projects.json equals the bundle of spec/.

Write descriptions for people and for AI agents alike: say what a call does, what it costs or changes, which values are allowed, and who may call it. Do not rely on a reader knowing Studio.

Preview

npx redocly build-docs schemas/projects.json --output /tmp/studio-api.html
open /tmp/studio-api.html

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages