TheGamesDB · API Governance Rules

TheGamesDB API Rules

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

27 Rules error 8 warn 14 info 5
View Rules File View on GitHub

Rule Categories

get info no openapi operation operationid parameter paths query response schema servers

Rules

error
info-title-required
Info object must have a title
$.info
warn
info-description-required
Info object must have a description
$.info
error
info-version-required
API version must be defined
$.info
warn
openapi-version-3
OpenAPI version should be 3.x
$
error
servers-defined
Servers array must be defined
$
error
servers-https
Server URLs must use HTTPS
$.servers[*].url
warn
paths-no-trailing-slash
Paths must not have trailing slashes
$.paths[*]~
info
paths-versioned
Paths should include a version prefix
$.paths[*]~
error
operation-summary-required
Operations must have a summary
$.paths[*][get,post,put,delete,patch]
warn
operation-description-required
Operations must have a description
$.paths[*][get,post,put,delete,patch]
error
operation-operationId-required
Operations must have an operationId
$.paths[*][get,post,put,delete,patch]
warn
operation-tags-required
Operations must have at least one tag
$.paths[*][get,post,put,delete,patch]
info
operation-summary-provider-prefix
Operation summaries should start with 'TheGamesDB'
$.paths[*][get,post,put,delete,patch].summary
warn
parameter-apikey-required-in-query
TheGamesDB requires apikey query parameter on all operations
$.paths[*][get,post,put,delete,patch].parameters[?(@.name=='apikey')]
warn
parameter-description-required
Parameters must have descriptions
$.paths[*][get,post,put,delete,patch].parameters[*]
info
parameter-pagination-page
Paginated endpoints should use 'page' parameter name
$.paths[*][get].parameters[?(@.name=='offset')]
error
response-success-required
Operations must have at least one success response
$.paths[*][get,post,put,delete,patch].responses
info
response-400-for-query-endpoints
Query endpoints should document 400 bad input response
$.paths[*][get].responses
warn
response-403-for-api-key
TheGamesDB endpoints should document 403 invalid key response
$.paths[*][get].responses
warn
schema-type-defined
Schema objects should have a type
$.components.schemas[*]
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
warn
no-empty-descriptions
Descriptions must not be empty
$..description
warn
servers-expected-domain
Server URLs should be on the thegamesdb.net domain.
$.servers[*].url
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
info
operationid-casing
Operation IDs should be PascalCase (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].operationId
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties

Spectral Ruleset

Raw ↑
# thegamesdb — 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 thegamesdb.net
#   - query-params-casing: snake @ 91% (n=90)
#   - operationid-casing: pascal @ 46% (n=26)
#   - schema-names-casing: pascal @ 100% (n=8)
#   - schema-properties-casing: snake @ 100% (n=44)
#   - operation-documents-400: 88% adherence
#   - operation-documents-403: 100% adherence
#   - pagination params observed: ['page']
#   - merge: kept 22 existing, added 5 measured, upgraded 0
#   - added: servers-expected-domain, query-params-casing, operationid-casing, schema-names-casing, schema-properties-casing
extends:
  - spectral:oas
rules:
  info-title-required:
    description: Info object must have a title
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-description-required:
    description: Info object must have a description
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    description: API version must be defined
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3:
    description: OpenAPI version should be 3.x
    severity: warn
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    description: Servers array must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https:
    description: Server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-no-trailing-slash:
    description: Paths must not have trailing slashes
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-versioned:
    description: Paths should include a version prefix
    severity: info
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^/v[0-9]
  operation-summary-required:
    description: Operations must have a summary
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: summary
      function: truthy
  operation-description-required:
    description: Operations must have a description
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: description
      function: truthy
  operation-operationId-required:
    description: Operations must have an operationId
    severity: error
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: operationId
      function: truthy
  operation-tags-required:
    description: Operations must have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,delete,patch]
    then:
      field: tags
      function: truthy
  operation-summary-provider-prefix:
    description: Operation summaries should start with 'TheGamesDB'
    severity: info
    given: $.paths[*][get,post,put,delete,patch].summary
    then:
      function: pattern
      functionOptions:
        match: '^TheGamesDB '
  parameter-apikey-required-in-query:
    description: TheGamesDB requires apikey query parameter on all operations
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].parameters[?(@.name=='apikey')]
    then:
      field: required
      function: truthy
  parameter-description-required:
    description: Parameters must have descriptions
    severity: warn
    given: $.paths[*][get,post,put,delete,patch].parameters[*]
    then:
      field: description
      function: truthy
  parameter-pagination-page:
    description: Paginated endpoints should use 'page' parameter name
    severity: info
    given: $.paths[*][get].parameters[?(@.name=='offset')]
    then:
      field: name
      function: enumeration
      functionOptions:
        values:
        - page
  response-success-required:
    description: Operations must have at least one success response
    severity: error
    given: $.paths[*][get,post,put,delete,patch].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  response-400-for-query-endpoints:
    description: Query endpoints should document 400 bad input response
    severity: info
    given: $.paths[*][get].responses
    then:
      field: '400'
      function: defined
  response-403-for-api-key:
    description: TheGamesDB endpoints should document 403 invalid key response
    severity: warn
    given: $.paths[*][get].responses
    then:
      field: '403'
      function: defined
  schema-type-defined:
    description: Schema objects should have a type
    severity: warn
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy
  get-no-request-body:
    description: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty
    severity: warn
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  servers-expected-domain:
    description: Server URLs should be on the thegamesdb.net domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: thegamesdb\.net
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  operationid-casing:
    description: Operation IDs should be PascalCase (the dominant convention in this API).
    severity: info
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  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: warn
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake