Redfin · API Governance Rules

Redfin API Rules

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

10 Rules error 2 warn 6 info 2
View Rules File View on GitHub

Rule Categories

redfin

Rules

warn
redfin-operation-ids-camel-case
All operationIds must use camelCase naming convention consistent with Redfin API style.
$.paths[*][*].operationId
warn
redfin-tags-title-case
All tags must use Title Case.
$.tags[*].name
warn
redfin-path-tags-title-case
Operation tags must use Title Case.
$.paths[*][*].tags[*]
warn
redfin-operations-have-summaries
All operations must have a summary.
$.paths[*][*]
info
redfin-operations-have-descriptions
All operations must have a description.
$.paths[*][*]
error
redfin-operations-have-operation-ids
All operations must have an operationId for SDK generation.
$.paths[*][*]
warn
redfin-responses-have-descriptions
All response objects must have a description.
$.paths[*][*].responses[*]
info
redfin-parameters-have-descriptions
All parameters should have descriptions.
$.paths[*][*].parameters[*]
warn
redfin-info-contact
API info must include contact information.
$.info
error
redfin-servers-defined
API must have at least one server defined.
$

Spectral Ruleset

Raw ↑
rules:
  redfin-operation-ids-camel-case:
    description: All operationIds must use camelCase naming convention consistent with Redfin API style.
    message: "OperationId '{{value}}' should use camelCase."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  redfin-tags-title-case:
    description: All 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 /-]*$"

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

  redfin-operations-have-summaries:
    description: All operations must have a summary.
    message: "Operation at {{path}} is missing a summary."
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: summary
      function: truthy

  redfin-operations-have-descriptions:
    description: All operations must have a description.
    message: "Operation at {{path}} is missing a description."
    severity: info
    given: "$.paths[*][*]"
    then:
      field: description
      function: truthy

  redfin-operations-have-operation-ids:
    description: All operations must have an operationId for SDK generation.
    message: "Operation at {{path}} is missing an operationId."
    severity: error
    given: "$.paths[*][*]"
    then:
      field: operationId
      function: truthy

  redfin-responses-have-descriptions:
    description: All response objects must have a description.
    message: "Response at {{path}} is missing a description."
    severity: warn
    given: "$.paths[*][*].responses[*]"
    then:
      field: description
      function: truthy

  redfin-parameters-have-descriptions:
    description: All parameters should have descriptions.
    message: "Parameter at {{path}} is missing a description."
    severity: info
    given: "$.paths[*][*].parameters[*]"
    then:
      field: description
      function: truthy

  redfin-info-contact:
    description: API info must include contact information.
    message: "API info is missing a contact block."
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy

  redfin-servers-defined:
    description: API must have at least one server defined.
    message: "API is missing a servers block."
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy