Bindbee · API Governance Rules

Bindbee API Rules

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

24 Rules error 8 warn 16
View Rules File View on GitHub

Rule Categories

bindbee

Rules

error
bindbee-info-title-prefix
API title must start with "Bindbee"
$.info.title
error
bindbee-info-version-present
API info must have a version field
$.info
warn
bindbee-info-contact-present
API info must include contact details
$.info
error
bindbee-operation-summary-prefix
Operation summaries must start with "Bindbee"
$.paths[*][*].summary
warn
bindbee-operation-id-camel-case
Operation IDs must be camelCase
$.paths[*][*].operationId
warn
bindbee-operation-tags-present
Every operation must have at least one tag
$.paths[*][*]
warn
bindbee-operation-description-present
Every operation must have a description
$.paths[*][*]
warn
bindbee-path-kebab-case
Path segments must use kebab-case
$.paths
error
bindbee-connector-token-header
Operations must require x-connector-token header
$.paths[*][*].parameters[?(@.name=='x-connector-token')]
error
bindbee-response-200-present
Every operation must define a 200 response
$.paths[*][*].responses
warn
bindbee-response-401-present
Operations should define a 401 unauthorized response
$.paths[*][*].responses
warn
bindbee-schema-title-present
All schemas must have a title
$.components.schemas[*]
warn
bindbee-schema-description-present
All schemas must have a description
$.components.schemas[*]
warn
bindbee-schema-properties-described
Schema properties must have descriptions
$.components.schemas[*].properties[*]
error
bindbee-security-scheme-present
API must define at least one security scheme
$.components
warn
bindbee-operation-security-present
Operations must declare security
$.paths[*][get,post,put,patch,delete]
warn
bindbee-tags-defined
All tags must be defined at top level
$.tags
error
bindbee-servers-present
API must define servers
$
error
bindbee-server-https
Server URL must use HTTPS
$.servers[*].url
warn
bindbee-pagination-cursor
List endpoints should support cursor-based pagination
$.paths[?(@property.startsWith('/hris/') || @property.startsWith('/ats/'))][get].parameters[?(@.name=='cursor')]
warn
bindbee-response-data-array
List responses should return data in a data array
$.components.schemas[?(@property.endsWith('Response'))].properties
warn
bindbee-operation-examples-present
Responses with content should include examples
$.paths[*][*].responses[*].content[*]
warn
bindbee-microcks-operation-present
Every operation must include x-microcks-operation extension
$.paths[*][*]
warn
bindbee-license-present
API info must include license
$.info

Spectral Ruleset

Raw ↑
rules:

  bindbee-info-title-prefix:
    description: API title must start with "Bindbee"
    message: 'Info title must start with "Bindbee": {{value}}'
    severity: error
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: "^Bindbee"

  bindbee-info-version-present:
    description: API info must have a version field
    message: Info object must include a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy

  bindbee-info-contact-present:
    description: API info must include contact details
    message: Info object must include contact
    severity: warn
    given: $.info
    then:
      field: contact
      function: truthy

  bindbee-operation-summary-prefix:
    description: Operation summaries must start with "Bindbee"
    message: 'Operation summary must start with "Bindbee": {{value}}'
    severity: error
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^Bindbee"

  bindbee-operation-id-camel-case:
    description: Operation IDs must be camelCase
    message: 'OperationId must be camelCase: {{value}}'
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  bindbee-operation-tags-present:
    description: Every operation must have at least one tag
    message: Operations must include tags
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  bindbee-operation-description-present:
    description: Every operation must have a description
    message: Operations must include description
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: description
      function: truthy

  bindbee-path-kebab-case:
    description: Path segments must use kebab-case
    message: 'Path segments must be kebab-case: {{value}}'
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(/[a-z0-9-{}]*)+$"

  bindbee-connector-token-header:
    description: Operations must require x-connector-token header
    message: Operations must include x-connector-token header parameter
    severity: error
    given: "$.paths[*][*].parameters[?(@.name=='x-connector-token')]"
    then:
      function: truthy

  bindbee-response-200-present:
    description: Every operation must define a 200 response
    message: Operations must include a 200 response
    severity: error
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          required: ['200']

  bindbee-response-401-present:
    description: Operations should define a 401 unauthorized response
    message: Operations should include 401 response
    severity: warn
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ['401']
            - required: ['403']

  bindbee-schema-title-present:
    description: All schemas must have a title
    message: Schemas must include title
    severity: warn
    given: "$.components.schemas[*]"
    then:
      field: title
      function: truthy

  bindbee-schema-description-present:
    description: All schemas must have a description
    message: Schemas must include description
    severity: warn
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy

  bindbee-schema-properties-described:
    description: Schema properties must have descriptions
    message: Schema properties must include description
    severity: warn
    given: "$.components.schemas[*].properties[*]"
    then:
      field: description
      function: truthy

  bindbee-security-scheme-present:
    description: API must define at least one security scheme
    message: Components must include securitySchemes
    severity: error
    given: "$.components"
    then:
      field: securitySchemes
      function: truthy

  bindbee-operation-security-present:
    description: Operations must declare security
    message: Operations must include security definition
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: security
      function: truthy

  bindbee-tags-defined:
    description: All tags must be defined at top level
    message: Tags must be defined in the global tags section
    severity: warn
    given: "$.tags"
    then:
      function: truthy

  bindbee-servers-present:
    description: API must define servers
    message: Servers array must be present and non-empty
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  bindbee-server-https:
    description: Server URL must use HTTPS
    message: 'Server URL must use HTTPS: {{value}}'
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  bindbee-pagination-cursor:
    description: List endpoints should support cursor-based pagination
    message: List endpoints should include cursor parameter
    severity: warn
    given: "$.paths[?(@property.startsWith('/hris/') || @property.startsWith('/ats/'))][get].parameters[?(@.name=='cursor')]"
    then:
      function: truthy

  bindbee-response-data-array:
    description: List responses should return data in a data array
    message: List response schemas should include a data array property
    severity: warn
    given: "$.components.schemas[?(@property.endsWith('Response'))].properties"
    then:
      field: data
      function: truthy

  bindbee-operation-examples-present:
    description: Responses with content should include examples
    message: Response content should include examples
    severity: warn
    given: "$.paths[*][*].responses[*].content[*]"
    then:
      field: examples
      function: truthy

  bindbee-microcks-operation-present:
    description: Every operation must include x-microcks-operation extension
    message: Operations must include x-microcks-operation
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: x-microcks-operation
      function: truthy

  bindbee-license-present:
    description: API info must include license
    message: Info must include license
    severity: warn
    given: "$.info"
    then:
      field: license
      function: truthy