WanAPIs · API Governance Rules

WanAPIs API Rules

Spectral linting rules defining API design standards and conventions for WanAPIs.

7 Rules error 3 warn 4
View Rules File View on GitHub

Rule Categories

wanapis

Rules

error
wanapis-server-base-url
Servers must use the documented WanAPIs OpenAI-compatible base URL.
$.servers[*]
error
wanapis-bearer-auth-required
Every operation must inherit bearer auth (global security or operation-level).
$
warn
wanapis-operation-id-camelcase
operationId should be camelCase (e.g. createChatCompletion).
$.paths[*][*].operationId
error
wanapis-tag-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
warn
wanapis-response-schema-required
2xx responses must declare an application/json or audio schema.
$.paths[*][*].responses['200'].content
warn
wanapis-error-schema
4xx/5xx responses should reference the Error schema.
$.paths[*][*].responses[?(@property.match(/^(4|5)\\d{2}$/))]
warn
wanapis-model-parameter
Request bodies for inference endpoints must include a `model` field.
$.components.schemas[?(@property.match(/Request$/))]

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas
formats:
  - oas3_1
rules:
  # WanAPIs is OpenAI-compatible; enforce the conventions that matter for the
  # gateway: bearer auth on every operation, /v1 prefix on the server, and
  # consistent OpenAI-style JSON shapes.

  wanapis-server-base-url:
    description: Servers must use the documented WanAPIs OpenAI-compatible base URL.
    severity: error
    given: $.servers[*]
    then:
      field: url
      function: pattern
      functionOptions:
        match: '^https://api\.wanapis\.com/v1$'

  wanapis-bearer-auth-required:
    description: Every operation must inherit bearer auth (global security or operation-level).
    severity: error
    given: $
    then:
      field: components.securitySchemes.bearerAuth
      function: truthy

  wanapis-operation-id-camelcase:
    description: operationId should be camelCase (e.g. createChatCompletion).
    severity: warn
    given: $.paths[*][*].operationId
    then:
      function: pattern
      functionOptions:
        match: '^[a-z][a-zA-Z0-9]+$'

  wanapis-tag-required:
    description: Every operation must declare at least one tag.
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: length
      functionOptions: { min: 1 }

  wanapis-response-schema-required:
    description: 2xx responses must declare an application/json or audio schema.
    severity: warn
    given: $.paths[*][*].responses['200'].content
    then:
      function: truthy

  wanapis-error-schema:
    description: 4xx/5xx responses should reference the Error schema.
    severity: warn
    given: $.paths[*][*].responses[?(@property.match(/^(4|5)\\d{2}$/))]
    then:
      field: $ref
      function: pattern
      functionOptions:
        match: 'Error'

  wanapis-model-parameter:
    description: Request bodies for inference endpoints must include a `model` field.
    severity: warn
    given: $.components.schemas[?(@property.match(/Request$/))]
    then:
      field: required
      function: schema
      functionOptions:
        schema:
          type: array
          contains: { const: model }

Work with this as data

Every ruleset here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This ruleset
curl "https://apis.io/api/v1/rules/wanapis-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.