Crystal Reports · API Governance Rules

Crystal Reports API Rules

Spectral linting rules defining API design standards and conventions for Crystal Reports.

22 Rules error 14 warn 6 info 2
View Rules File View on GitHub

Rule Categories

error get info no operation operationid parameter paths response schema security servers tags

Rules

error
info-title-required
$.info
error
info-description-required
$.info
error
info-version-required
$.info
error
servers-defined
$
error
servers-https-only
$.servers[*].url
error
paths-no-trailing-slash
$.paths
error
operation-description-required
$.paths[*][get,post,put,patch,delete]
error
operation-operationid-required
$.paths[*][get,post,put,patch,delete]
error
operation-operationid-unique
$
info
tags-title-case
$.tags[*].name
error
parameter-description-required
$.paths[*][get,post,put,patch,delete].parameters[*]
error
response-success-required
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
$.paths[*][get,post,put,patch,delete].responses[*]
warn
security-schemes-defined
$.components
error
get-no-request-body
$.paths[*].get
error
no-empty-descriptions
$..description
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
info
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-401
Operations should document a 401 response (documented on 95% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-404
Operations should document a 404 response (documented on 80% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# crystal-reports — 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:
#   - path-params-casing: camel @ 79% (n=24)
#   - operationid-casing: camel @ 95% (n=20)
#   - schema-names-casing: pascal @ 100% (n=25)
#   - schema-properties-casing: snake @ 85% (n=74)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: Error
#   - operation-documents-401: 95% adherence
#   - operation-documents-404: 80% adherence
#   - merge: kept 16 existing, added 6 measured, upgraded 0
#   - added: operationid-casing, schema-names-casing, schema-properties-casing, error-schema-defined, operation-documents-401, operation-documents-404
extends:
  - spectral:oas
rules:
  info-title-required:
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-description-required:
    severity: error
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  servers-defined:
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-no-trailing-slash:
    severity: error
    given: $.paths
    then:
      field: '@key'
      function: pattern
      functionOptions:
        notMatch: \/$
  operation-description-required:
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  operation-operationid-required:
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-operationid-unique:
    severity: error
    given: $
    then:
      function: oasOpId
  tags-title-case:
    severity: info
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][a-zA-Z0-9]*(\s[A-Za-z0-9]+)*$
  parameter-description-required:
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy
  response-success-required:
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '204'
  response-description-required:
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy
  security-schemes-defined:
    severity: warn
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  get-no-request-body:
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    severity: error
    given: $..description
    then:
      function: truthy
  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: info
    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-401:
    description: Operations should document a 401 response (documented on 95% 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 80% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '404'
      function: truthy