airbnb · API Governance Rules

airbnb API Rules

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

26 Rules error 6 warn 20
View Rules File View on GitHub

Rule Categories

airbnb no operation operationid path query schema security servers

Rules

warn
airbnb-operation-summary-title-case
All operation summaries must use Title Case
$.paths[*][get,post,put,patch,delete]
warn
airbnb-operation-id-camel-case
Operation IDs must use camelCase
$.paths[*][get,post,put,patch,delete]
error
airbnb-require-operation-tags
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
error
airbnb-require-response-200
GET operations must define a 200 response
$.paths[*].get
warn
airbnb-schema-title-required
All component schemas must have a title
$.components.schemas[*]
error
airbnb-require-oauth2-security
All operations must require OAuth2 security
$.paths[*][get,post,put,patch,delete]
warn
airbnb-listing-status-enum
Listing status must use defined enum values
$.components.schemas.Listing.properties.status
warn
airbnb-require-pagination-params
List operations should support pagination parameters
$.paths[*].get
error
airbnb-reservation-required-dates
Reservation schema must include check_in and check_out
$.components.schemas.Reservation.properties
error
airbnb-require-server-url
API must define at least one server URL
$
warn
airbnb-require-contact-info
API info must include contact information
$.info
warn
airbnb-no-inline-schemas-in-paths
Path responses should reference component schemas, not inline
$.paths[*][*].responses[*].content[*].schema
warn
airbnb-currency-field-present
Schemas with price fields should include currency
$.components.schemas[*].properties
warn
airbnb-require-description-on-paths
All operations must have a description
$.paths[*][get,post,put,patch,delete]
warn
airbnb-require-external-docs
API should include externalDocs pointing to developer portal
$
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
servers-expected-domain
Server URLs should be on the airbnb.com 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
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
operationid-casing
Operation IDs should be camelCase (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
warn
security-schemes-defined
Security schemes should be defined in components.
$.components
warn
operation-documents-401
Operations should document a 401 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-404
Operations should document a 404 response (documented on 82% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# airbnb — 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: 2/2 servers on airbnb.com
#   - path-params-casing: snake @ 100% (n=31)
#   - query-params-casing: snake @ 100% (n=29)
#   - operationid-casing: camel @ 100% (n=34)
#   - schema-names-casing: pascal @ 100% (n=27)
#   - schema-properties-casing: snake @ 100% (n=210)
#   - security: global (root) — NOT emitting operation-security-required
#   - operation-documents-401: 100% adherence
#   - operation-documents-404: 82% adherence
#   - pagination params observed: ['limit', 'offset']
#   - merge: kept 15 existing, added 11 measured, upgraded 0
#   - added: servers-https-only, servers-expected-domain, path-params-casing, query-params-casing, operationid-casing, schema-names-casing, schema-properties-casing, security-schemes-defined, operation-documents-401, operation-documents-404, no-empty-descriptions
extends:
  - spectral:oas
rules:
  airbnb-operation-summary-title-case:
    description: All operation summaries must use Title Case
    message: Summary "{{value}}" is not in Title Case
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: pattern
      functionOptions:
        match: ^[A-Z]
  airbnb-operation-id-camel-case:
    description: Operation IDs must use camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  airbnb-require-operation-tags:
    description: All operations must have at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  airbnb-require-response-200:
    description: GET operations must define a 200 response
    severity: error
    given: $.paths[*].get
    then:
      field: responses.200
      function: truthy
  airbnb-schema-title-required:
    description: All component schemas must have a title
    severity: warn
    given: $.components.schemas[*]
    then:
      field: title
      function: truthy
  airbnb-require-oauth2-security:
    description: All operations must require OAuth2 security
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            security:
              type: array
              minItems: 1
  airbnb-listing-status-enum:
    description: Listing status must use defined enum values
    severity: warn
    given: $.components.schemas.Listing.properties.status
    then:
      field: enum
      function: truthy
  airbnb-require-pagination-params:
    description: List operations should support pagination parameters
    severity: warn
    given: $.paths[*].get
    then:
      function: schema
      functionOptions:
        schema:
          properties:
            parameters:
              type: array
  airbnb-reservation-required-dates:
    description: Reservation schema must include check_in and check_out
    severity: error
    given: $.components.schemas.Reservation.properties
    then:
      function: schema
      functionOptions:
        schema:
          required:
          - check_in
          - check_out
  airbnb-require-server-url:
    description: API must define at least one server URL
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  airbnb-require-contact-info:
    description: API info must include contact information
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy
  airbnb-no-inline-schemas-in-paths:
    description: Path responses should reference component schemas, not inline
    severity: warn
    given: $.paths[*][*].responses[*].content[*].schema
    then:
      function: schema
      functionOptions:
        schema:
          oneOf:
          - required:
            - $ref
          - required:
            - properties
  airbnb-currency-field-present:
    description: Schemas with price fields should include currency
    severity: warn
    given: $.components.schemas[*].properties
    then:
      function: schema
      functionOptions:
        schema: {}
  airbnb-require-description-on-paths:
    description: All operations must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  airbnb-require-external-docs:
    description: API should include externalDocs pointing to developer portal
    severity: warn
    given: $
    then:
      field: externalDocs
      function: truthy
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-expected-domain:
    description: Server URLs should be on the airbnb.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: airbnb\.com
  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
  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 camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: casing
      functionOptions:
        type: camel
  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: casing
      functionOptions:
        type: pascal
  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
  security-schemes-defined:
    description: Security schemes should be defined in components.
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  operation-documents-404:
    description: Operations should document a 404 response (documented on 82% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '404'
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy