APIs.guru · API Governance Rules

APIs.guru API Rules

Spectral linting rules defining API design standards and conventions for APIs.guru.

34 Rules error 13 warn 16 info 5
View Rules File View on GitHub

Rule Categories

delete examples external get info no openapi operation parameter path paths response schema servers tag tags

Rules

warn
info-title-format
Info title should start with "APIs.guru"
$.info.title
error
info-description-required
Info must have a description
$.info
error
info-version-required
Info must have a version
$.info
warn
info-contact-required
Info should have contact information
$.info
warn
info-license-required
Info should have license information
$.info
warn
openapi-version-3
Specs should use OpenAPI 3.0.x
$.openapi
error
servers-defined
Servers array must be defined
$
error
servers-https-only
Server URLs must use HTTPS
$.servers[*].url
warn
paths-kebab-case
Path segments should use kebab-case
$.paths[*]~
warn
paths-no-trailing-slash
Paths must not have a trailing slash
$.paths[*]~
error
operation-summary-required
All operations must have a summary
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-prefix
Operation summaries should start with "APIs.guru"
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
All operations should have a description
$.paths[*][get,post,put,patch,delete,head,options]
error
operation-id-required
All operations must have an operationId
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-id-camel-case
OperationId should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
error
operation-tags-required
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete,head,options]
warn
tags-defined
Global tags array should be defined
$
warn
tag-description-required
All tags should have descriptions
$.tags[*]
error
parameter-description-required
All parameters must have descriptions
$.paths[*][*].parameters[*]
error
parameter-schema-type-required
All parameters must have a schema type
$.paths[*][*].parameters[*].schema
error
response-success-required
Operations must have at least one 2xx response
$.paths[*][get,post,put,patch,delete]
error
response-description-required
All responses must have descriptions
$.paths[*][*].responses[*]
info
schema-description-recommended
Component schemas should have descriptions
$.components.schemas[*]
warn
schema-type-defined
Schema objects should have a type defined
$.components.schemas[*]
info
no-global-security-required
Security defined at operation or global level
$
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
warn
delete-no-request-body
DELETE operations should not have a request body
$.paths[*].delete
error
no-empty-descriptions
Descriptions must not be empty strings
$..description
info
external-docs-encouraged
External documentation is encouraged
$
info
examples-encouraged
Schema properties should have examples
$.components.schemas[*].properties[*]
warn
servers-expected-domain
Server URLs should be on the apis.guru domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be snake_case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties

Spectral Ruleset

Raw ↑
# apis-guru — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on apis.guru
#   - path-params-casing: snake @ 100% (n=7)
#   - operationid-casing: camel @ 100% (n=7)
#   - schema-names-casing: pascal @ 75% (n=4)
#   - schema-properties-casing: snake @ 56% (n=25)
#   - merge: kept 30 existing, added 4 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, schema-names-casing, schema-properties-casing
extends:
  - spectral:oas
rules:
  info-title-format:
    description: Info title should start with "APIs.guru"
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^APIs\.guru
  info-description-required:
    description: Info must have a description
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info must have a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  info-contact-required:
    description: Info should have contact information
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  info-license-required:
    description: Info should have license information
    severity: warn
    given: $.info
    then:
      field: license
      function: truthy
  openapi-version-3:
    description: Specs should use OpenAPI 3.0.x
    severity: warn
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.0\.
  servers-defined:
    description: Servers array must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    description: Server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-kebab-case:
    description: Path segments should use kebab-case
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(\/([a-z0-9-{}._]+))*$
  paths-no-trailing-slash:
    description: Paths must not have a trailing slash
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \/$
  operation-summary-required:
    description: All operations must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: summary
      function: truthy
  operation-summary-prefix:
    description: Operation summaries should start with "APIs.guru"
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: ^APIs\.guru
  operation-description-required:
    description: All operations should have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: description
      function: truthy
  operation-id-required:
    description: All operations must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: operationId
      function: truthy
  operation-id-camel-case:
    description: OperationId should use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]+$
  operation-tags-required:
    description: All operations must have at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: tags
      function: truthy
  tags-defined:
    description: Global tags array should be defined
    severity: warn
    given: $
    then:
      field: tags
      function: truthy
  tag-description-required:
    description: All tags should have descriptions
    severity: warn
    given: $.tags[*]
    then:
      field: description
      function: truthy
  parameter-description-required:
    description: All parameters must have descriptions
    severity: error
    given: $.paths[*][*].parameters[*]
    then:
      field: description
      function: truthy
  parameter-schema-type-required:
    description: All parameters must have a schema type
    severity: error
    given: $.paths[*][*].parameters[*].schema
    then:
      field: type
      function: truthy
  response-success-required:
    description: Operations must have at least one 2xx response
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: responses
      function: truthy
  response-description-required:
    description: All responses must have descriptions
    severity: error
    given: $.paths[*][*].responses[*]
    then:
      field: description
      function: truthy
  schema-description-recommended:
    description: Component schemas should have descriptions
    severity: info
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  schema-type-defined:
    description: Schema objects should have a type defined
    severity: warn
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy
  no-global-security-required:
    description: Security defined at operation or global level
    severity: info
    given: $
    then:
      field: security
      function: defined
  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-no-request-body:
    description: DELETE operations should not have a request body
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty strings
    severity: error
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  external-docs-encouraged:
    description: External documentation is encouraged
    severity: info
    given: $
    then:
      field: externalDocs
      function: truthy
  examples-encouraged:
    description: Schema properties should have examples
    severity: info
    given: $.components.schemas[*].properties[*]
    then:
      field: example
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the apis.guru domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: apis\.guru
  path-params-casing:
    description: Path parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake