Octri
API StudioSDK StudioMonitoringMCP ServerFeatures
ComparePricingBlogDocs
Log inStart for free
Octri
API StudioSDK StudioMonitoringMCP ServerFeatures
ComparePricingBlogDocs
Log inStart for free
Blog/Engineering
Engineering·June 24, 2026·2 min read

Ten Habits for Writing Great OpenAPI Specs

Small, consistent choices in your OpenAPI document produce dramatically better generated docs and SDKs. Here are ten that pay off.

#openapi#best-practices#dx

The quality of your generated docs and SDKs is bounded by the quality of your spec. Good news: a handful of habits move the needle more than anything else.

1. Give every operation an operationId

SDK method names are derived from operationId. A clear, verb-first id like listInvoices becomes client.invoices.list() — an unnamed operation becomes a guess. Miss one and the generator falls back to the method and path, which reads like postV1UsersUserIdContact. You can override the name per endpoint in SDK Studio (client shape), but the spec is the better place to fix it.

2. Write real descriptions

Every description field is an opportunity. Compare:

  • Get user — technically correct, useless in practice
  • Returns the authenticated user's profile, including verified email status — genuinely helpful

3. Use examples liberally

Examples flow straight into docs and playground requests. Provide at least one per request body and response. They land on the generated endpoint pages and in the try-it drawer readers use to call your API from the page.

4. Model errors explicitly

Document the error responses your API actually returns:

yaml
1234567
responses:
  "404":
    description: The invoice does not exist.
    content:
      application/json:
        schema:
          $ref: "#/components/schemas/Error"

The short list

  1. Name your operations
  2. Describe everything
  3. Add examples
  4. Model errors
  5. Reuse components with $ref
  6. Tag operations into logical groups
  7. Mark required fields honestly
  8. Prefer enums over free-form strings
  9. Version your servers
  10. Validate in CI

Treat your spec like source code: review it, lint it, and keep it in version control. Everything downstream inherits its quality.

Run your spec through a linter such as spectral before every merge and the generated output will stay clean automatically.

A few of these have a knob on the Octri side when you can't change the spec at its source. Your tags decide how the SDK groups its methods, so users.list() beats api.users.list(), and both the grouping and the method names are overridable per endpoint in client shape. The docs sidebar can be reordered by hand when the automatic order isn't the story you want to tell. And when the spec itself is the problem and you don't own it, transforms rewrite it before generation. Reach for those second. Fixing the spec fixes every output at once, as generating an SDK spells out.

Starting from scratch? How to generate API documentation from an OpenAPI spec walks the whole pipeline, from writing the spec to hosting docs that update themselves.

← PreviousIntroducing Octri — API Docs & SDKs, Automatically
Next →How Octri Keeps Static Pages Fresh with ISR

Related articles

Engineering·4 min read

Why generated SDKs break silently — and how to make them observable

Generated SDKs go dark the moment they ship. Here's why they fail silently in production, and the three pieces you need to de-minify their stack traces and actually see the failures.

July 6, 2026
Product·3 min read

Inside Octri API Studio: Docs You Edit Like an App, Not a Repo

API Studio is a three-pane visual workspace for your docs. Edit an endpoint, watch the page render beside it, drag pages into groups, tune the playground and SEO, and publish a version. No markdown-in-a-repo ceremony.

July 6, 2026
Product·3 min read

Inside Octri SDK Studio: Tune Every SDK, See the Code Change Live

SDK Studio turns every knob on your generated SDKs in a real UI, per endpoint, with a live preview of the code as you change it. Package names, retries, pagination, streaming, deprecations, auth, custom transforms, and which endpoints ship.

July 6, 2026
Comparisons·4 min read

Octri vs. Fern: Docs & SDK Generation Compared (2026)

Fern and Octri both turn one API definition into docs and SDKs. Octri adds production monitoring Fern has no answer for, more languages including Rust, a nicer docs editor, and a free tier.

July 6, 2026

Ship notes, straight to your inbox

New SDK languages, changelog highlights, and the occasional deep-dive on docs that don't rot. About once a month. No spam, unsubscribe anytime.

Join developers keeping tabs on Octri.

Octri

Upload an OpenAPI spec. Get AI-generated docs and production-ready SDKs in 10 languages, live in minutes.

Product

  • API Studio
  • SDK Studio
  • Monitoring
  • MCP Server
  • Pricing
  • Compare
  • Blog
  • Changelog

Developers

  • Documentation
  • API Reference
  • SDK Libraries
  • MCP Server
  • Monitoring
  • CLI
  • Support

Legal

  • Terms of Service
  • Privacy Policy
  • Fair Use Policy
  • Data Processing (DPA)
  • Cookie Policy
  • Security
  • Subprocessors

© 2026 Octri, LLC. All rights reserved.

Made by devs who got tired of hand-writing SDKs.