Greenhouse · API Governance Rules

Greenhouse API Rules

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

17 Rules error 5 warn 11 info 1
View Rules File View on GitHub

Rule Categories

info no openapi operation parameter path paths query response security 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
Info object must have a version.
$.info
error
openapi-version-3
OpenAPI version must be 3.x.
$.openapi
error
servers-defined
Servers must be defined.
$
warn
servers-https
Server URLs must use HTTPS.
$.servers[*].url
warn
paths-kebab-case
Path segments should be kebab-case or templated.
$.paths.*~
warn
paths-no-trailing-slash
Paths should not end with a trailing slash.
$.paths.*~
warn
operation-summary-required
Operations must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-tags-required
Operations should have at least one tag.
$.paths[*][get,post,put,patch,delete]
info
parameter-snake-case
Parameter names should be snake_case.
$.paths[*][*].parameters[?(@.in == 'query')].name
error
response-success-required
Operations must define at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses
warn
security-defined
Security schemes must be defined.
$.components.securitySchemes
warn
servers-expected-domain
Server URLs should be on the greenhouse.io 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
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# greenhouse — 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: 4/4 servers on greenhouse.io
#   - path-params-casing: snake @ 100% (n=18)
#   - query-params-casing: snake @ 100% (n=9)
#   - security: global (root) — NOT emitting operation-security-required
#   - pagination params observed: ['page', 'per_page']
#   - merge: kept 13 existing, added 4 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, query-params-casing, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-required:
    description: Info object must have a title.
    given: $.info
    severity: error
    then:
      field: title
      function: truthy
  info-description-required:
    description: Info object must have a description.
    given: $.info
    severity: warn
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info object must have a version.
    given: $.info
    severity: error
    then:
      field: version
      function: truthy
  openapi-version-3:
    description: OpenAPI version must be 3.x.
    given: $.openapi
    severity: error
    then:
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    description: Servers must be defined.
    given: $
    severity: error
    then:
      field: servers
      function: truthy
  servers-https:
    description: Server URLs must use HTTPS.
    given: $.servers[*].url
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-kebab-case:
    description: Path segments should be kebab-case or templated.
    given: $.paths.*~
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: ^(/([a-z0-9_\-]+|\{[a-zA-Z0-9_]+\}))*/?$
  paths-no-trailing-slash:
    description: Paths should not end with a trailing slash.
    given: $.paths.*~
    severity: warn
    then:
      function: pattern
      functionOptions:
        notMatch: .+/$
  operation-summary-required:
    description: Operations must have a summary.
    given: $.paths[*][get,post,put,patch,delete]
    severity: warn
    then:
      field: summary
      function: truthy
  operation-tags-required:
    description: Operations should have at least one tag.
    given: $.paths[*][get,post,put,patch,delete]
    severity: warn
    then:
      field: tags
      function: truthy
  parameter-snake-case:
    description: Parameter names should be snake_case.
    given: $.paths[*][*].parameters[?(@.in == 'query')].name
    severity: info
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  response-success-required:
    description: Operations must define at least one 2xx response.
    given: $.paths[*][get,post,put,patch,delete].responses
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            ^2[0-9][0-9]$: {}
          minProperties: 1
  security-defined:
    description: Security schemes must be defined.
    given: $.components.securitySchemes
    severity: warn
    then:
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the greenhouse.io domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: greenhouse\.io
  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
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy