GreyNoise Intelligence · API Governance Rules

GreyNoise Intelligence API Rules

Spectral linting rules defining API design standards and conventions for GreyNoise Intelligence.

42 Rules error 15 warn 24 info 3
View Rules File View on GitHub

Rule Categories

error greynoise no operation operationid path query schema servers

Rules

error
greynoise-info-title-prefix
API title must begin with "GreyNoise".
$.info.title
error
greynoise-info-version-semver
API version must be a semver string (e.g. 3.0.0).
$.info.version
error
greynoise-info-description-required
Info description is required and must be at least 40 characters.
$.info
warn
greynoise-info-contact-required
A contact email is required (typically hello@greynoise.io).
$.info.contact
warn
greynoise-info-license-required
A license entry is required.
$.info
error
greynoise-openapi-version
OpenAPI version must be 3.0.x to match GreyNoise published specs.
$.openapi
error
greynoise-servers-defined
At least one server entry must be defined.
$.servers
error
greynoise-servers-https
All server URLs must use HTTPS.
$.servers[*].url
warn
greynoise-servers-canonical-host
Primary server URL should be https://api.greynoise.io.
$.servers[0].url
error
greynoise-paths-lowercase
Paths must be all lowercase.
$.paths.*~
error
greynoise-paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths.*~
warn
greynoise-paths-versioned
Paths should begin with /v1, /v2, /v3, or /ping (utility).
$.paths.*~
error
greynoise-operation-summary-required
Every operation must have a summary in Title Case.
$.paths.*[get,post,put,patch,delete]
warn
greynoise-operation-description-required
Every operation must have a description.
$.paths.*[get,post,put,patch,delete]
error
greynoise-operation-operationid-required
Every operation must declare an operationId.
$.paths.*[get,post,put,patch,delete]
warn
greynoise-operation-tags-required
Every operation must declare at least one tag.
$.paths.*[get,post,put,patch,delete]
warn
greynoise-tags-defined-globally
A global tags array should be defined.
$
warn
greynoise-tag-title-case
Tag names should be in Title Case (e.g. "IP Lookup", "GNQL").
$.tags[*].name
warn
greynoise-parameter-description
Every parameter must have a description.
$.paths.*[get,post,put,patch,delete].parameters[*]
warn
greynoise-parameter-name-snake-case
Parameter names should be snake_case (GreyNoise convention).
$.paths.*[get,post,put,patch,delete].parameters[*].name
error
greynoise-api-key-in-header
API key must be passed via header, never query string.
$.paths.*[get,post,put,patch,delete].parameters[?(@.name=='key' || @.name=='api_key' || @.name=='apikey')]
warn
greynoise-request-body-json
Request bodies must include application/json.
$.paths.*[post,put,patch].requestBody.content
error
greynoise-response-2xx-required
Every operation must declare at least one 2xx response.
$.paths.*[get,post,put,patch,delete].responses
info
greynoise-response-401-recommended
Authenticated operations should declare a 401 response.
$.paths.*[get,post,put,patch,delete].responses
info
greynoise-response-429-recommended
Operations should declare a 429 (rate-limit) response.
$.paths.*[get,post,put,patch,delete].responses
warn
greynoise-response-description-required
Every response must have a description.
$.paths.*[get,post,put,patch,delete].responses.*
warn
greynoise-schema-property-snake-case
Schema property names should be snake_case (GreyNoise convention).
$.components.schemas[*].properties.*~
warn
greynoise-schema-type-required
Schemas should declare a type (unless using oneOf/allOf/anyOf/$ref).
$.components.schemas[?(!@.oneOf && !@.allOf && !@.anyOf && !@.$ref)]
error
greynoise-security-defined-globally
A global security entry must be defined.
$
error
greynoise-security-scheme-apikey-header
The APIKeyHeaderAuth scheme must be apiKey/header named "key".
$.components.securitySchemes.APIKeyHeaderAuth
error
greynoise-get-no-request-body
GET operations must not declare a requestBody.
$.paths.*.get
warn
greynoise-delete-no-request-body
DELETE operations must not declare a requestBody.
$.paths.*.delete
info
greynoise-operation-examples-encouraged
Operations are encouraged to provide response examples for Microcks mocking.
$.paths.*[get,post,put,patch,delete].responses['200'].content.application/json
warn
servers-expected-domain
Server URLs should be on the greynoise.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
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
error-schema-defined
A shared error schema (Error) should be defined for error payloads.
$.components.schemas
warn
operation-documents-400
Operations should document a 400 response (documented on 89% 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 ↑
# greynoise — 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 greynoise.io
#   - path-params-casing: snake @ 100% (n=8)
#   - query-params-casing: snake @ 100% (n=78)
#   - operationid-casing: camel @ 74% (n=27)
#   - schema-names-casing: pascal @ 100% (n=66)
#   - schema-properties-casing: snake @ 96% (n=318)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: Error
#   - operation-documents-400: 89% adherence
#   - operation-documents-401: 85% adherence
#   - pagination params observed: ['count', 'limit', 'offset', 'page', 'page_size', 'size']
#   - merge: kept 33 existing, added 9 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, query-params-casing, operationid-casing, schema-names-casing, schema-properties-casing, error-schema-defined, operation-documents-400, no-empty-descriptions
extends:
  - spectral:oas
rules:
  greynoise-info-title-prefix:
    description: API title must begin with "GreyNoise".
    message: '{{description}} — title "{{value}}" should start with "GreyNoise".'
    severity: error
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^GreyNoise
  greynoise-info-version-semver:
    description: API version must be a semver string (e.g. 3.0.0).
    severity: error
    given: $.info.version
    then:
      function: pattern
      functionOptions:
        match: ^\d+\.\d+\.\d+$
  greynoise-info-description-required:
    description: Info description is required and must be at least 40 characters.
    severity: error
    given: $.info
    then:
      field: description
      function: length
      functionOptions:
        min: 40
  greynoise-info-contact-required:
    description: A contact email is required (typically hello@greynoise.io).
    severity: warn
    given: $.info.contact
    then:
      field: email
      function: truthy
  greynoise-info-license-required:
    description: A license entry is required.
    severity: warn
    given: $.info
    then:
      field: license
      function: truthy
  greynoise-openapi-version:
    description: OpenAPI version must be 3.0.x to match GreyNoise published specs.
    severity: error
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.0\.
  greynoise-servers-defined:
    description: At least one server entry must be defined.
    severity: error
    given: $.servers
    then:
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
  greynoise-servers-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  greynoise-servers-canonical-host:
    description: Primary server URL should be https://api.greynoise.io.
    severity: warn
    given: $.servers[0].url
    then:
      function: pattern
      functionOptions:
        match: ^https://api\.greynoise\.io
  greynoise-paths-lowercase:
    description: Paths must be all lowercase.
    severity: error
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: ^[^A-Z]*$
  greynoise-paths-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    severity: error
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        notMatch: .+/$
  greynoise-paths-versioned:
    description: Paths should begin with /v1, /v2, /v3, or /ping (utility).
    severity: warn
    given: $.paths.*~
    then:
      function: pattern
      functionOptions:
        match: ^/(v[0-9]+/|ping$)
  greynoise-operation-summary-required:
    description: Every operation must have a summary in Title Case.
    severity: error
    given: $.paths.*[get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  greynoise-operation-description-required:
    description: Every operation must have a description.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  greynoise-operation-operationid-required:
    description: Every operation must declare an operationId.
    severity: error
    given: $.paths.*[get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  greynoise-operation-tags-required:
    description: Every operation must declare at least one tag.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete]
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1
  greynoise-tags-defined-globally:
    description: A global tags array should be defined.
    severity: warn
    given: $
    then:
      field: tags
      function: truthy
  greynoise-tag-title-case:
    description: Tag names should be in Title Case (e.g. "IP Lookup", "GNQL").
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9 ]+$
  greynoise-parameter-description:
    description: Every parameter must have a description.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy
  greynoise-parameter-name-snake-case:
    description: Parameter names should be snake_case (GreyNoise convention).
    severity: warn
    given: $.paths.*[get,post,put,patch,delete].parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  greynoise-api-key-in-header:
    description: API key must be passed via header, never query string.
    severity: error
    given: $.paths.*[get,post,put,patch,delete].parameters[?(@.name=='key' || @.name=='api_key' || @.name=='apikey')]
    then:
      field: in
      function: pattern
      functionOptions:
        match: ^header$
  greynoise-request-body-json:
    description: Request bodies must include application/json.
    severity: warn
    given: $.paths.*[post,put,patch].requestBody.content
    then:
      field: application/json
      function: truthy
  greynoise-response-2xx-required:
    description: Every operation must declare at least one 2xx response.
    severity: error
    given: $.paths.*[get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            ^2\d\d$:
              type: object
          minProperties: 1
  greynoise-response-401-recommended:
    description: Authenticated operations should declare a 401 response.
    severity: info
    given: $.paths.*[get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  greynoise-response-429-recommended:
    description: Operations should declare a 429 (rate-limit) response.
    severity: info
    given: $.paths.*[get,post,put,patch,delete].responses
    then:
      field: '429'
      function: truthy
  greynoise-response-description-required:
    description: Every response must have a description.
    severity: warn
    given: $.paths.*[get,post,put,patch,delete].responses.*
    then:
      field: description
      function: truthy
  greynoise-schema-property-snake-case:
    description: Schema property names should be snake_case (GreyNoise convention).
    severity: warn
    given: $.components.schemas[*].properties.*~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  greynoise-schema-type-required:
    description: Schemas should declare a type (unless using oneOf/allOf/anyOf/$ref).
    severity: warn
    given: $.components.schemas[?(!@.oneOf && !@.allOf && !@.anyOf && !@.$ref)]
    then:
      field: type
      function: truthy
  greynoise-security-defined-globally:
    description: A global security entry must be defined.
    severity: error
    given: $
    then:
      field: security
      function: truthy
  greynoise-security-scheme-apikey-header:
    description: The APIKeyHeaderAuth scheme must be apiKey/header named "key".
    severity: error
    given: $.components.securitySchemes.APIKeyHeaderAuth
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required:
          - type
          - in
          - name
          properties:
            type:
              const: apiKey
            in:
              const: header
            name:
              const: key
  greynoise-get-no-request-body:
    description: GET operations must not declare a requestBody.
    severity: error
    given: $.paths.*.get
    then:
      field: requestBody
      function: falsy
  greynoise-delete-no-request-body:
    description: DELETE operations must not declare a requestBody.
    severity: warn
    given: $.paths.*.delete
    then:
      field: requestBody
      function: falsy
  greynoise-operation-examples-encouraged:
    description: Operations are encouraged to provide response examples for Microcks mocking.
    severity: info
    given: $.paths.*[get,post,put,patch,delete].responses['200'].content.application/json
    then:
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the greynoise.io domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: greynoise\.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
  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: 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
  error-schema-defined:
    description: A shared error schema (Error) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: Error
      function: truthy
  operation-documents-400:
    description: Operations should document a 400 response (documented on 89% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '400'
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy