Bancontact · API Governance Rules

Bancontact API Rules

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

12 Rules error 5 warn 6 info 1
View Rules File View on GitHub

Rule Categories

bancontact

Rules

error
bancontact-info-title-required
API title must be present.
$.info
warn
bancontact-info-description-required
API description must be present.
$.info
error
bancontact-info-version-required
API version must be present.
$.info
error
bancontact-operation-id-required
All operations must have an operationId.
$.paths[*][get,post,put,patch,delete]
warn
bancontact-operation-summary-required
All operations must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
bancontact-payment-status-field
Payment response schemas must include a status field.
$.components.schemas.Payment.properties
error
bancontact-payment-amount-required
Payment request schemas must include amount.
$.components.schemas.PaymentRequest.properties
error
bancontact-security-required
All Bancontact APIs must define security schemes.
$
info
bancontact-webhook-callback
Payment operations should document webhook callbacks.
$.paths[*].post
warn
bancontact-response-201-for-post
POST operations should return 201 on resource creation.
$.paths[*].post.responses
warn
bancontact-error-response-schema
Error responses must include a schema.
$.paths[*][*].responses[4XX].content[*]
warn
bancontact-schema-description-required
All named schemas must have a description.
$.components.schemas[*]

Spectral Ruleset

bancontact-spectral-rules.yml Raw ↑
rules:
  bancontact-info-title-required:
    description: API title must be present.
    message: "API info must include a title."
    severity: error
    given: "$.info"
    then:
      field: title
      function: truthy

  bancontact-info-description-required:
    description: API description must be present.
    message: "API info must include a description."
    severity: warn
    given: "$.info"
    then:
      field: description
      function: truthy

  bancontact-info-version-required:
    description: API version must be present.
    message: "API info must include a version."
    severity: error
    given: "$.info"
    then:
      field: version
      function: truthy

  bancontact-operation-id-required:
    description: All operations must have an operationId.
    message: "Operation must have an operationId."
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  bancontact-operation-summary-required:
    description: All operations must have a summary.
    message: "Operation must have a summary."
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  bancontact-payment-status-field:
    description: Payment response schemas must include a status field.
    message: "Payment schemas should include a status field."
    severity: warn
    given: "$.components.schemas.Payment.properties"
    then:
      field: status
      function: truthy

  bancontact-payment-amount-required:
    description: Payment request schemas must include amount.
    message: "Payment request schemas should include an amount field."
    severity: error
    given: "$.components.schemas.PaymentRequest.properties"
    then:
      field: amount
      function: truthy

  bancontact-security-required:
    description: All Bancontact APIs must define security schemes.
    message: "API must define security requirements."
    severity: error
    given: "$"
    then:
      field: security
      function: truthy

  bancontact-webhook-callback:
    description: Payment operations should document webhook callbacks.
    message: "POST payment operations should document callback webhooks."
    severity: info
    given: "$.paths[*].post"
    then:
      field: callbacks
      function: truthy

  bancontact-response-201-for-post:
    description: POST operations should return 201 on resource creation.
    message: "POST operations creating resources should return 201."
    severity: warn
    given: "$.paths[*].post.responses"
    then:
      field: "201"
      function: truthy

  bancontact-error-response-schema:
    description: Error responses must include a schema.
    message: "4xx responses should include an error schema."
    severity: warn
    given: "$.paths[*][*].responses[4XX].content[*]"
    then:
      field: schema
      function: truthy

  bancontact-schema-description-required:
    description: All named schemas must have a description.
    message: "Schema components must have a description."
    severity: warn
    given: "$.components.schemas[*]"
    then:
      field: description
      function: truthy