Guide

OpenAPI linting: security and design rules that teams act on

Last checked 2026-11-288 min read

OpenAPI linting checks a spec against rules before anyone calls the API. Security rules look for the design mistakes behind the OWASP API Security Top 10: write operations without authentication, keys and credentials in URLs, outdated auth flows, plain HTTP, guessable IDs and no size limits. Design rules look for a spec that clients and code generators can’t rely on: undeclared path parameters, duplicate operationIds, paths that match the same request, missing responses and examples that don’t match their schema. The rules are the easy part. Lint works when a pull request shows only the findings it adds, the rest becomes a score you can watch, and the summary goes to the team that owns the service. Graphwake gives every spec a 0–100 quality score from security and design rules, with each finding and how to fix it.

Exampleorders · Spec quality
Spec quality score 87 / 100
Starts at 100. Each error takes off 10 points and each warning 3.
  • Server URL is not HTTPS
    $.servers[0].url
    Error · −10
  • ID parameter is a plain integer
    GET /orders/{id}
    Warning · −3
Every spec gets a 0–100 quality score from security and design rules, with each finding and how to fix it.
On this page
  1. What an OpenAPI linter checks
  2. A before and after
  3. Why lint output gets ignored
  4. How Graphwake scores and routes spec findings
  5. Next steps
  6. Questions

What an OpenAPI linter checks

A linter reads the spec, not the running service, so it finds problems before the first request. Its rules fall into two groups. Security rules catch API design mistakes that lead to the risks in the OWASP API Security Top 10. Design rules catch a spec that is broken or ambiguous, which breaks generated clients, mocks and docs.

Security rules

RuleWhy it matters
Write operation has no security requirementA POST, PUT, PATCH or DELETE anyone can call is the most common way an API leaks or loses data.
Read operation has no security requirementSometimes on purpose (a public catalog), so a warning, not an error.
Security requirement names an undefined schemeThe operation looks protected in the spec, but the scheme it names does not exist.
API key or credentials sent in the URLURLs end up in proxy logs, browser history and monitoring tools. Keys belong in a header.
Uses HTTP Basic or an outdated authentication schemeA password on every request. OAuth 2.0, OpenID Connect or a bearer token is the safer default.
Uses the OAuth password or implicit flowBoth are discouraged today. The authorization code flow with PKCE replaces them.
Server, OAuth or OpenID URL is not HTTPSTokens and data travel in clear text, even if only on an internal network.
Description contains a script tag or eval()Docs portals render descriptions as Markdown. A script in a description runs in the reader’s browser.
ID parameter is a plain integerSequential IDs make it easy to walk through other people’s records when an authorization check is missing.
429 response has no Retry-After headerClients retry at once and make an overload worse.
Array or string has no size limitWithout maxItems or maxLength, the spec accepts any payload size.

Design rules

RuleWhy it matters
Spec is not valid OpenAPIEvery tool that reads the spec may read it differently, or not at all.
Path parameter is missing or not declared/orders/{id} with no id parameter, or the reverse. Generated clients break on it.
operationId is missing or used twiceCode generators name methods after it. A duplicate silently overwrites one of them.
Two paths match the same request/orders/{id} and /orders/{orderId} can’t both route. One of them never runs.
Path contains a query string or ends with a slashThe query belongs in parameters; a trailing slash is a different path to many routers.
Operation has no success or validation error responseClients have to guess what a good answer and a rejected request look like.
Example or enum value does not match its schemaDocs and mocks show a payload the API would reject.

Rules carry a severity (error, warning or info) instead of a single pass or fail. A public GET without security can be a choice; a public DELETE almost never is.

A before and after

yaml
# Before
servers:
  - url: http://orders.internal
paths:
  /orders/{id}:
    delete:
      parameters:
        - name: api_key
          in: query
Nine lines, and a linter flags most of them: no HTTPS, a delete with no security requirement, an API key in the query string, an undeclared {id} path parameter and no operationId.
yaml
# After
servers:
  - url: https://orders.internal
components:
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
paths:
  /orders/{id}:
    delete:
      operationId: deleteOrder
      security:
        - bearer: []
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
The same operation fixed: an HTTPS server, a bearer token instead of a key in the URL, a security requirement on the delete, and the path parameter declared as a UUID.

Why lint output gets ignored

Running a linter takes minutes. Keeping a team interested in its output is the hard part, and it usually fails the same three ways:

  1. The first run is a wall

    An old spec has dozens of findings. Shown on every pull request, they drown the one finding this pull request added, and people stop reading.

  2. There is no sense of progress

    A list of 140 findings that becomes 131 doesn’t feel like anything. A number that moves does.

  3. Findings go to whoever is looking

    A CI log belongs to whoever opened it. The team that owns the spec, the only one that can fix it, often never sees it.

So a lint setup that lasts does the opposite: a pull request shows only the findings it adds, the rest becomes a score, and the summary goes to the team that owns the service. Adding lint to specs that already exist? Start by keeping new errors out of pull requests, then fix old findings one service at a time, beginning with write operations that have no security requirement.

See who your next breaking change reaches.Paste a spec URL or add one CI step. 14-day free trial, then a free plan. No credit card needed.
Start free trial

How Graphwake scores and routes spec findings

Every spec gets a 0–100 quality score from security and design rules, based on the OWASP API Security Top 10. The score starts at 100. Each error takes off 10 points and each warning 3, counting at most two findings per rule, so one repeated mistake doesn’t sink the whole score. Info findings are shown but cost nothing. The service page shows the score, where the points went, and each finding with its place in the spec and how to fix it.

  • New findings on the pull request

    On GitHub and Azure DevOps, the pull request comment adds “New spec findings in this pull request” below the breaking changes and the teams they affect. Old findings stay on the service page.

  • SARIF for code scanning

    With --sarif, the CI step writes the spec’s findings to a SARIF file that GitHub code scanning shows next to the code. Agent 0.4.0 or later.

  • A weekly summary to the owner

    On Pro and Enterprise, the team that owns the service gets “Spec quality this week” in its own Slack, Microsoft Teams or email channel. Consumer teams get no lint messages.

  • Rules you don’t use, off

    On Pro and Enterprise, admins can turn off individual rules, and the score updates right away.

Findings never fail a build. Breaking changes are the only thing the optional --fail-on check looks at. The score, the findings, the pull request section and SARIF are in every plan, the Free plan included; see pricing.

yaml
permissions:
  contents: read
  pull-requests: write
  security-events: write
  actions: read # private repositories only, for upload-sarif

jobs:
  api-spec:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      # ... build and produce openapi.json
      - uses: graphwake/agent/github-action@v0.4.0
        env:
          GRAPHWAKE_SARIF: graphwake.sarif
        with:
          spec: openapi.json
          key: ${{ secrets.GRAPHWAKE_KEY }}
      - uses: github/codeql-action/upload-sarif@v4
        if: ${{ !cancelled() && hashFiles('graphwake.sarif') != '' }}
        with:
          sarif_file: graphwake.sarif
          category: graphwake
Spec findings in GitHub code scanning. The if skips the upload when no file was written, for example on a merge to the default branch.

Two limits. The score is for OpenAPI specs only: AsyncAPI documents get breaking change alerts but no score. And a Swagger 2.0 spec is scored on its converted OpenAPI 3.0 form, so the paths in its findings point at the converted document.

Next steps

Questions

What is OpenAPI linting?

Checking an OpenAPI spec against a set of rules before the API is called: security rules (authentication, credentials in URLs, HTTPS, limits) and design rules (valid structure, declared parameters, unique operationIds, documented responses). Each finding has a severity and a place in the spec.

Which OpenAPI security issues should a linter catch first?

Write operations with no security requirement, API keys or credentials in the URL, server and OAuth URLs without HTTPS, HTTP Basic or outdated auth schemes, and the OAuth password and implicit flows. These are errors; plain integer IDs, a missing Retry-After on 429 and unlimited arrays or strings come after.

Should lint findings fail the build?

Not when you start. On an existing spec, a failing step gets muted within a week. Show each pull request only the findings it adds, track the rest as a score, and fix them service by service. In Graphwake, findings never fail a build.

Does Graphwake lint OpenAPI specs?

Yes. Every OpenAPI spec gets a 0–100 quality score from security and design rules, with each finding and how to fix it. A pull request shows only the findings it adds, and the CI step can write them to a SARIF file. Findings never fail a build. On Pro and Enterprise the owning team gets a weekly summary, and admins can turn off rules they don't use.

Pick an endpoint. See who it reaches. 14-day free trial, then a free plan. No credit card needed.

Start free trial

Sources and last verified

Sources checked on 2026-11-01.