Unified.to · API Governance Rules

Unified.to API Rules

Spectral linting rules defining API design standards and conventions for Unified.to.

39 Rules error 13 warn 19 info 7
View Rules File View on GitHub

Rule Categories

components delete get info no openapi operation operationid parameter path paths query request response schema security servers

Rules

error
info-title-required
$.info
warn
info-title-contains-unified
$.info.title
warn
info-description-required
$.info
error
info-version-required
$.info
error
openapi-version-3
$
error
servers-defined
$
error
servers-https-only
$.servers[*].url
info
servers-unified-to-domain
$.servers[*].url
warn
paths-connection-id-required
$.paths[*]~
warn
paths-kebab-case
$.paths[*]~
warn
paths-no-trailing-slash
$.paths[*]~
error
operation-id-required
$.paths[*][get,post,put,patch,delete,head,options]
error
operation-summary-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-title-case
$.paths[*][get,post,put,patch,delete,head,options].summary
warn
operation-tags-required
$.paths[*][get,post,put,patch,delete,head,options]
info
operation-description-required
$.paths[*][get,post,put,patch,delete,head,options]
error
parameter-connection-id-path
$.paths[*][get,post,put,patch,delete].parameters[?(@.name=='connection_id')]
warn
parameter-description-required
$.paths[*][get,post,put,patch,delete].parameters[*]
info
parameter-pagination-limit
$.paths[*].get.parameters[?(@.name=='limit')]
warn
parameter-snake-case
$.paths[*][get,post,put,patch,delete].parameters[*].name
warn
request-body-json
$.paths[*][post,put,patch].requestBody.content
error
response-success-defined
$.paths[*][get,post,put,patch,delete]
error
response-description-required
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-401-unauthorized
$.paths[*][get,post,put,patch,delete]
info
response-422-validation
$.paths[*][post,put,patch]
warn
schema-property-snake-case
$.components.schemas[*].properties[*]~
info
schema-raw-property-present
$.components.schemas[?(@.type=='object')]
error
security-schemes-defined
$.components
warn
security-jwt-bearer
$.components.securitySchemes[*][?(@.type=='http')]
error
get-no-request-body
$.paths[*].get
info
delete-returns-200-or-204
$.paths[*].delete.responses
warn
no-empty-descriptions
$..description
error
components-schemas-defined
$.components
info
schema-raw-passthrough
$.components.schemas[?(!@.title)]
warn
servers-expected-domain
Server URLs should be on the unified.to 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-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties

Spectral Ruleset

Raw ↑
# unified-to — 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: 33/33 servers on unified.to
#   - path-params-casing: snake @ 100% (n=2176)
#   - query-params-casing: snake @ 100% (n=4314)
#   - operationid-casing: camel @ 100% (n=1346)
#   - schema-properties-casing: snake @ 99% (n=43197)
#   - security: global (root) — NOT emitting operation-security-required
#   - pagination params observed: ['count', 'limit', 'offset', 'size']
#   - merge: kept 34 existing, added 5 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, query-params-casing, operationid-casing, schema-properties-casing
extends:
  - spectral:oas
rules:
  info-title-required:
    message: API info title is required
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-title-contains-unified:
    message: API title should reference Unified.to
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: (?i)unified
  info-description-required:
    message: API info description is required
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    message: API info version is required
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3:
    message: OpenAPI version must be 3.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    message: At least one server must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    message: Server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-unified-to-domain:
    message: Server should be on api.unified.to or regional subdomain
    severity: info
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: unified\.to
  paths-connection-id-required:
    message: API resource paths should include {connection_id} parameter
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^/(unified|[a-z]+/\{connection_id\})
  paths-kebab-case:
    message: Path segments should use snake_case or kebab-case (Unified.to convention)
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9_{}/-]+)+$
  paths-no-trailing-slash:
    message: Paths must not end with a trailing slash
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  operation-id-required:
    message: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: operationId
      function: truthy
  operation-summary-required:
    message: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: summary
      function: truthy
  operation-summary-title-case:
    message: Operation summaries should use Title Case
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].summary
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z]
  operation-tags-required:
    message: Every operation should have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: tags
      function: truthy
  operation-description-required:
    message: Every operation should have a description
    severity: info
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: description
      function: truthy
  parameter-connection-id-path:
    message: connection_id path parameter should be defined when present
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.name=='connection_id')]
    then:
      field: in
      function: enumeration
      functionOptions:
        values:
        - path
  parameter-description-required:
    message: All parameters should have descriptions
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy
  parameter-pagination-limit:
    message: List operations should support a limit parameter
    severity: info
    given: $.paths[*].get.parameters[?(@.name=='limit')]
    then:
      field: schema.type
      function: enumeration
      functionOptions:
        values:
        - integer
        - number
  parameter-snake-case:
    message: Parameter names should use snake_case (Unified.to convention)
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  request-body-json:
    message: Request bodies should use application/json content type
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  response-success-defined:
    message: Every operation must define at least one 2xx success response
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: responses
      function: truthy
  response-description-required:
    message: All responses must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy
  response-401-unauthorized:
    message: Protected operations should define 401 Unauthorized response
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: responses.401
      function: truthy
  response-422-validation:
    message: Write operations should define a 422 validation error response
    severity: info
    given: $.paths[*][post,put,patch]
    then:
      field: responses.422
      function: truthy
  schema-property-snake-case:
    message: Schema properties should use snake_case (Unified.to convention)
    severity: warn
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  schema-raw-property-present:
    message: Domain model schemas should include a 'raw' property for provider-specific data
    severity: info
    given: $.components.schemas[?(@.type=='object')]
    then:
      field: properties.raw
      function: truthy
  security-schemes-defined:
    message: Security schemes must be defined
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  security-jwt-bearer:
    message: Unified.to uses JWT bearer token authentication
    severity: warn
    given: $.components.securitySchemes[*][?(@.type=='http')]
    then:
      field: scheme
      function: enumeration
      functionOptions:
        values:
        - bearer
  get-no-request-body:
    message: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-returns-200-or-204:
    message: DELETE operations should return 200 (with body) or 204 (no content)
    severity: info
    given: $.paths[*].delete.responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  no-empty-descriptions:
    message: Descriptions must not be empty strings
    severity: warn
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  components-schemas-defined:
    message: Components schemas section should be defined for reusable types
    severity: error
    given: $.components
    then:
      field: schemas
      function: truthy
  schema-raw-passthrough:
    message: Each domain model should have a 'raw' passthrough object for provider-specific fields not
      covered by the unified schema.
    severity: info
    given: $.components.schemas[?(!@.title)]
    then:
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the unified.to domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: unified\.to
  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-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