taylor-morrison-home · API Governance Rules

taylor-morrison-home API Rules

Spectral linting rules defining API design standards and conventions for taylor-morrison-home.

8 Rules error 2 warn 6
View Rules File View on GitHub

Rule Categories

taylor

Rules

warn
taylor-morrison-operation-ids-camel-case
Operation IDs must use camelCase
$.paths[*][*].operationId
warn
taylor-morrison-path-kebab-case
Path segments must use kebab-case
$.paths[*]~
error
taylor-morrison-operation-summary-exists
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
warn
taylor-morrison-operation-description-exists
All operations must have a description
$.paths[*][get,post,put,patch,delete]
error
taylor-morrison-responses-success
All operations must define a success response
$.paths[*][get,post,put,patch,delete].responses
warn
taylor-morrison-tags-title-case
Tags must use Title Case
$.tags[*].name
warn
taylor-morrison-parameters-description
All parameters must have descriptions
$.paths[*][*].parameters[*]
warn
taylor-morrison-info-contact
API must include contact info
$.info

Spectral Ruleset

Raw ↑
rules:
  taylor-morrison-operation-ids-camel-case:
    description: Operation IDs must use camelCase
    message: "operationId '{{value}}' must use camelCase"
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

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

  taylor-morrison-operation-summary-exists:
    description: All operations must have a summary
    message: "Operation '{{path}}' is missing a summary"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  taylor-morrison-operation-description-exists:
    description: All operations must have a description
    message: "Operation '{{path}}' is missing a description"
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: description
      function: truthy

  taylor-morrison-responses-success:
    description: All operations must define a success response
    message: "Operation '{{path}}' must define a 200 or 201 response"
    severity: error
    given: "$.paths[*][get,post,put,patch,delete].responses"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ["200"]
            - required: ["201"]

  taylor-morrison-tags-title-case:
    description: Tags must use Title Case
    message: "Tag '{{value}}' must use Title Case"
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9 ]*$"

  taylor-morrison-parameters-description:
    description: All parameters must have descriptions
    message: "Parameter '{{value}}' is missing a description"
    severity: warn
    given: "$.paths[*][*].parameters[*]"
    then:
      field: description
      function: truthy

  taylor-morrison-info-contact:
    description: API must include contact info
    message: "API info must include contact details"
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy