Architecture Pattern · API Governance Rules

Architecture Pattern API Rules

Spectral linting rules defining API design standards and conventions for Architecture Pattern.

12 Rules error 7 warn 5
View Rules File View on GitHub

Rule Categories

ap

Rules

error
ap-pattern-id-required
Pattern must have an id field
$.components.schemas.Pattern.properties
error
ap-pattern-name-required
Pattern must have a name field
$.components.schemas.Pattern.properties
warn
ap-pattern-problem-required
Pattern must have a problem statement
$.components.schemas.Pattern.properties
warn
ap-pattern-solution-required
Pattern must have a solution description
$.components.schemas.Pattern.properties
error
ap-pattern-confidence-enum
Pattern confidence must be a valid enum value
$.components.schemas.Pattern.properties.confidence
error
ap-tradeoff-severity-enum
Tradeoff severity must be a valid enum value
$.components.schemas.Tradeoff.properties.severity
warn
ap-list-responses-have-total
List responses must include a total count
$.components.schemas[*List].properties
warn
ap-operations-have-tags
All API operations must have tags
$.paths[*][get,post,put,patch,delete]
error
ap-operations-have-summary
All API operations must have a summary
$.paths[*][get,post,put,patch,delete]
error
ap-operations-have-operation-id
All API operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
ap-info-contact-required
API info must include contact information
$.info
error
ap-servers-defined
API must define at least one server
$

Spectral Ruleset

Raw ↑
rules:
  ap-pattern-id-required:
    description: Pattern must have an id field
    message: Pattern object must have an id property
    severity: error
    given: "$.components.schemas.Pattern.properties"
    then:
      field: id
      function: truthy

  ap-pattern-name-required:
    description: Pattern must have a name field
    message: Pattern object must have a name property
    severity: error
    given: "$.components.schemas.Pattern.properties"
    then:
      field: name
      function: truthy

  ap-pattern-problem-required:
    description: Pattern must have a problem statement
    message: Pattern object must have a problem property
    severity: warn
    given: "$.components.schemas.Pattern.properties"
    then:
      field: problem
      function: truthy

  ap-pattern-solution-required:
    description: Pattern must have a solution description
    message: Pattern object must have a solution property
    severity: warn
    given: "$.components.schemas.Pattern.properties"
    then:
      field: solution
      function: truthy

  ap-pattern-confidence-enum:
    description: Pattern confidence must be a valid enum value
    message: Pattern confidence must be proven, candidate, or experimental
    severity: error
    given: "$.components.schemas.Pattern.properties.confidence"
    then:
      field: enum
      function: truthy

  ap-tradeoff-severity-enum:
    description: Tradeoff severity must be a valid enum value
    message: Tradeoff severity must be low, medium, or high
    severity: error
    given: "$.components.schemas.Tradeoff.properties.severity"
    then:
      field: enum
      function: truthy

  ap-list-responses-have-total:
    description: List responses must include a total count
    message: List schema must include a total property
    severity: warn
    given: "$.components.schemas[*List].properties"
    then:
      field: total
      function: truthy

  ap-operations-have-tags:
    description: All API operations must have tags
    message: Operation must include at least one tag
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  ap-operations-have-summary:
    description: All API operations must have a summary
    message: Operation must include a summary
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

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

  ap-info-contact-required:
    description: API info must include contact information
    message: Info object must have a contact field
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy

  ap-servers-defined:
    description: API must define at least one server
    message: Servers array must be defined
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy