CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

trysac/openapi-style-lint

Lint an OpenAPI 3.0/3.1 JSON document against ten style rules (operationId, kebab-case paths, tags, summaries, response descriptions) and apply safe idempotent autofixes. Use when reviewing or cleaning an API spec or enforcing naming conventions.

Quality

95%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Passed

No findings from the security scan

Overview
Quality
Evals
Security
Files
name:
openapi-style-lint
description:
Lint an OpenAPI 3.0/3.1 JSON document against ten style rules (operationId, kebab-case paths, tags, summaries, response descriptions) and apply safe idempotent autofixes. Use when reviewing or cleaning an API spec or enforcing naming conventions.
license:
MIT
compatibility:
Needs Python 3 only (standard library). No network access. Reads only the spec file you name and never modifies it.

openapi-style-lint

Check an OpenAPI document against a small, fixed style guide and fix the mechanical problems safely. The bundled script runs ten rules (OAS001 to OAS010) and four autofixes. It works on its own: nothing to install or build.

When to use

  • Reviewing an API spec for naming and documentation consistency.
  • Cleaning a generated or hand-written OpenAPI file before sharing it.
  • A user asks for camelCase operationIds, kebab-case paths, complete tags or response descriptions.

Workflow

  1. Get the spec as a JSON file. If it is YAML, convert it to JSON first; the script reads JSON only and never edits the original file.

  2. Lint:

    python3 scripts/openapi_style_lint.py lint openapi.json

    Each line is RULE severity pointer message, sorted by JSON pointer. Add --format json for machine-readable output. Silence or re-grade a rule with --rule OAS005=off or --rule OAS003=error (repeatable; levels error, warn, off).

  3. Fix what is safe:

    python3 scripts/openapi_style_lint.py fix openapi.json > openapi.fixed.json

    The fixed document goes to stdout; the list of applied fixes goes to stderr. The input file is not touched. Show the user a diff between the two files and let them accept it.

  4. Re-run lint on the fixed file. Whatever remains needs a human decision: see below.

  5. Exit codes: 0 clean (or fix done), 1 at least one error-level finding, 2 usage or input error (unreadable file, invalid JSON, not OpenAPI 3.0/3.1, nesting over 128, file over 10 MiB).

Rule ids, default severities and fix behaviour are in references/rules.md.

What is fixed and what is not

Fixed automatically and safely: OAS004 trailing slash on a path, OAS002 operationId not camelCase, OAS006 operation tag missing from the top-level tags, OAS008 response without a description. A fix is skipped when it would collide with something that already exists (for example /users/ is not renamed when /users is already defined).

Never fixed automatically, so propose wording and ask the user: OAS001 missing operationId, OAS003 path segment not kebab-case (renaming a path breaks clients), OAS005 missing summary, OAS007 path template parameter without an in: path declaration, OAS009 duplicate operationId, OAS010 property name not camelCase.

Renaming an operationId or a path can change generated client code. Say so when you apply or suggest it.

Limits

  • OpenAPI 3.0.x and 3.1.x JSON only; no $ref resolution (rules look at the document as written).
  • Ten fixed rules, no custom rules and no style-guide files.
  • The script never writes files, never uses the network and never reads environment variables.

Source

This skill bundles a standard-library port of the rules implemented by the openapi-style-lint package: https://github.com/Trysac/u149-openapi-style-lint

Workspace
trysac
Visibility
Public
Created
Last updated
Source
CLI
Repository
No repository linked. Set repository in the plugin manifest, or publish from a GitHub Action to verify it.
Badge
trysac/openapi-style-lint badge