socure · API Governance Rules

socure API Rules

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

7 Rules error 3 warn 3 info 1
View Rules File View on GitHub

Rule Categories

socure

Rules

error
socure-info-contact-required
Every Socure OpenAPI spec must declare info.contact pointing to developer.socure.com.
$.info
warn
socure-server-host
Production server must use api.socure.com or api.socure.us (GovCloud).
$.servers[*].url
error
socure-security-apikey
All Socure operations must require the SocureToken apiKey security scheme.
$.security[*]
warn
socure-title-case-summaries
All operation summaries must use Title Case.
$.paths[*][*].summary
error
socure-operation-id-required
Every operation must declare an operationId.
$.paths[*][*]
warn
socure-tags-required
Every operation must be tagged.
$.paths[*][*]
info
socure-reference-id-property
Successful response bodies should include a referenceId property where applicable.
$.paths[*].post.responses['200'].content['application/json'].schema.properties

Spectral Ruleset

Raw ↑
extends:
- spectral:oas
rules:
  socure-info-contact-required:
    description: Every Socure OpenAPI spec must declare info.contact pointing to developer.socure.com.
    severity: error
    given: $.info
    then:
      field: contact
      function: truthy
  socure-server-host:
    description: Production server must use api.socure.com or api.socure.us (GovCloud).
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: "^https://(api|sandbox)\\.socure\\.(com|us)$"
  socure-security-apikey:
    description: All Socure operations must require the SocureToken apiKey security scheme.
    severity: error
    given: $.security[*]
    then:
      function: truthy
  socure-title-case-summaries:
    description: All operation summaries must use Title Case.
    severity: warn
    given: $.paths[*][*].summary
    then:
      function: pattern
      functionOptions:
        match: "^([A-Z][a-zA-Z0-9]*)( ([A-Z][a-zA-Z0-9]*|A|An|And|The|Of|For|To|In|On|With|By|Or))*$"
  socure-operation-id-required:
    description: Every operation must declare an operationId.
    severity: error
    given: $.paths[*][*]
    then:
      field: operationId
      function: truthy
  socure-tags-required:
    description: Every operation must be tagged.
    severity: warn
    given: $.paths[*][*]
    then:
      field: tags
      function: truthy
  socure-reference-id-property:
    description: Successful response bodies should include a referenceId property where applicable.
    severity: info
    given: $.paths[*].post.responses['200'].content['application/json'].schema.properties
    then:
      field: referenceId
      function: truthy