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

rules.mdreferences/

Rules and fixes

Ten fixed style rules. Severities can be changed per run with --rule OASnnn=error|warn|off.

RuleDefaultChecksAutofix
OAS001errorOperation has an operationId.No
OAS002erroroperationId matches ^[a-z][a-zA-Z0-9]*$ (camelCase).Yes, unless the new name already exists
OAS003warnLiteral path segments are kebab-case (^[a-z0-9]+(-[a-z0-9]+)*$); {param} segments are ignored.No
OAS004errorA path other than / has no trailing slash.Yes, unless the trimmed path already exists
OAS005warnOperation has a non-empty summary.No
OAS006warnEvery operation tag appears in the top-level tags list.Yes, adds {name} and sorts tags by name
OAS007errorEvery {param} in a path has a matching in: path parameter, at path or operation level.No
OAS008errorEvery response object has a non-empty description.Yes, standard reason phrase
OAS009erroroperationId is unique; one finding per later duplicate.No
OAS010warnProperty names in components.schemas are camelCase, including nested properties, items, allOf, anyOf and oneOf.No

Fix order and behaviour

fix works on a deep copy and applies, in this order: OAS004, OAS002, OAS006, OAS008. It then lints the result once more. Fixes are idempotent: running fix on fixed output changes nothing.

  • OAS004: /users/ becomes /users; the entry moves to the end of paths.
  • OAS002: words are split on non-alphanumeric runs and before an uppercase letter that follows a lowercase letter or digit, lowercased, then joined in camelCase (list_books becomes listBooks, create-book becomes createBook). Skipped when the result is empty or already used by another operation.
  • OAS006: missing tag names are appended as {"name": "<tag>"} and the tag list is sorted by name.
  • OAS008: description from the reason table: 200 OK, 201 Created, 202 Accepted, 204 No Content, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 409 Conflict, 422 Unprocessable Content, 429 Too Many Requests, 500 Internal Server Error, 503 Service Unavailable, default Unexpected error, any other code Response.

Findings

Each finding has rule, severity (error or warn), pointer (RFC 6901 JSON pointer into the document), message and fixable (true when fix would change it). Findings are sorted by pointer, then rule. Operations are found under the methods get, put, post, delete, options, head, patch and trace.

Limits

Document nesting up to 128 levels, file size up to 10 MiB, OpenAPI 3.0.x or 3.1.x only.

references

SKILL.md

tile.json