albertsons · API Governance Rules

albertsons API Rules

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

42 Rules error 16 warn 20 info 6
View Rules File View on GitHub

Rule Categories

delete error examples get info no openapi operation parameter paths query request response schema security servers tags

Rules

error
info-title-required
Info title must be defined and start with "Albertsons".
$.info.title
error
info-description-required
Info description must be defined with meaningful content.
$.info.description
error
info-version-required
API version must be specified.
$.info.version
warn
info-contact-required
Contact information should be provided.
$.info.contact
error
openapi-version-3
All specs must use OpenAPI 3.x.
$.openapi
error
servers-required
At least one server must be defined.
$.servers
error
servers-https-only
Server URLs must use HTTPS.
$.servers[*].url
warn
paths-kebab-case
Path segments must use kebab-case (lowercase with hyphens).
$.paths[*]~
warn
paths-no-trailing-slash
Paths must not end with a trailing slash.
$.paths[*]~
info
paths-plural-resource-nouns
Resource path segments should use plural nouns.
$.paths[*]~
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete].summary
warn
operation-summary-albertsons-prefix
Operation summaries must start with "Albertsons".
$.paths[*][get,post,put,patch,delete].summary
error
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete].description
error
operation-operationid-required
Every operation must have an operationId.
$.paths[*][get,post,put,patch,delete].operationId
warn
operation-operationid-camel-case
operationId must use camelCase.
$.paths[*][get,post,put,patch,delete].operationId
error
operation-tags-required
Every operation must have at least one tag.
$.paths[*][get,post,put,patch,delete].tags
warn
tags-global-defined
Global tags array should be defined.
$.tags
warn
tags-description-required
All global tags must have descriptions.
$.tags[*].description
error
parameter-description-required
All parameters must have descriptions.
$.paths[*][get,post,put,patch,delete].parameters[*].description
info
parameter-snake-case
Query and path parameter names should use camelCase or snake_case.
$.paths[*][get,post,put,patch,delete].parameters[*].name
warn
request-body-content-json
Request bodies should use application/json content type.
$.paths[*][post,put,patch].requestBody.content
info
request-body-description
Request body content should have a schema with description.
$.paths[*][post,put,patch].requestBody
error
response-success-required
Every operation must define at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-required
Secured endpoints should define a 401 response.
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
All responses must have descriptions.
$.paths[*][get,post,put,patch,delete].responses[*].description
warn
schema-description-required
Top-level schemas must have descriptions.
$.components.schemas[*].description
warn
schema-type-required
All schemas must define a type.
$.components.schemas[*].type
info
schema-property-camel-case
Schema property names should use camelCase.
$.components.schemas[*].properties[*]~
error
security-schemes-defined
Security schemes must be defined in components.
$.components.securitySchemes
warn
security-bearer-auth
Bearer authentication scheme should be defined.
$.components.securitySchemes.bearerAuth
warn
security-operation-defined
Each operation should define security requirements.
$.paths[*][get,post,put,patch,delete].security
error
get-no-request-body
GET operations must not have request bodies.
$.paths[*].get.requestBody
warn
delete-no-request-body
DELETE operations should not have request bodies.
$.paths[*].delete.requestBody
error
no-empty-descriptions
Descriptions must not be empty strings.
$..description
info
examples-encouraged
Schema properties should include example values.
$.components.schemas[*].properties[*]
warn
servers-expected-domain
Server URLs should be on the albertsons.com domain.
$.servers[*].url
warn
query-params-casing
Query parameters should be snake_case (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be snake_case (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-security-required
Every operation should declare its security requirements.
$.paths[*][get,post,put,patch,delete]
warn
error-schema-defined
A shared error schema (ErrorResponse) should be defined for error payloads.
$.components.schemas
warn
operation-documents-401
Operations should document a 401 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# albertsons — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 1/1 servers on albertsons.com
#   - query-params-casing: snake @ 67% (n=9)
#   - operationid-casing: camel @ 100% (n=6)
#   - schema-names-casing: pascal @ 100% (n=10)
#   - schema-properties-casing: snake @ 67% (n=49)
#   - operation-security-required: 6/6 ops declare per-op security
#   - error-schema-defined: ErrorResponse
#   - operation-documents-401: 100% adherence
#   - pagination params observed: ['limit', 'offset']
#   - merge: kept 35 existing, added 7 measured, upgraded 0
#   - added: servers-expected-domain, query-params-casing, schema-names-casing, schema-properties-casing, operation-security-required, error-schema-defined, operation-documents-401
extends:
  - spectral:oas
rules:
  info-title-required:
    description: Info title must be defined and start with "Albertsons".
    severity: error
    given: $.info.title
    then:
      function: truthy
  info-description-required:
    description: Info description must be defined with meaningful content.
    severity: error
    given: $.info.description
    then:
      function: truthy
  info-version-required:
    description: API version must be specified.
    severity: error
    given: $.info.version
    then:
      function: truthy
  info-contact-required:
    description: Contact information should be provided.
    severity: warn
    given: $.info.contact
    then:
      function: truthy
  openapi-version-3:
    description: All specs must use OpenAPI 3.x.
    severity: error
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.
  servers-required:
    description: At least one server must be defined.
    severity: error
    given: $.servers
    then:
      function: truthy
  servers-https-only:
    description: Server URLs must use HTTPS.
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  paths-kebab-case:
    description: Path segments must use kebab-case (lowercase with hyphens).
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9-{}]+)+$
  paths-no-trailing-slash:
    description: Paths must not end with a trailing slash.
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-plural-resource-nouns:
    description: Resource path segments should use plural nouns.
    severity: info
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9-{}]*s[a-z0-9-{}]*|/[a-z0-9-{}]*)+$
  operation-summary-required:
    description: Every operation must have a summary.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: truthy
  operation-summary-albertsons-prefix:
    description: Operation summaries must start with "Albertsons".
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: ^Albertsons
  operation-description-required:
    description: Every operation must have a description.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].description
    then:
      function: truthy
  operation-operationid-required:
    description: Every operation must have an operationId.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: truthy
  operation-operationid-camel-case:
    description: operationId must use camelCase.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]+$
  operation-tags-required:
    description: Every operation must have at least one tag.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].tags
    then:
      function: truthy
  tags-global-defined:
    description: Global tags array should be defined.
    severity: warn
    given: $.tags
    then:
      function: truthy
  tags-description-required:
    description: All global tags must have descriptions.
    severity: warn
    given: $.tags[*].description
    then:
      function: truthy
  parameter-description-required:
    description: All parameters must have descriptions.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[*].description
    then:
      function: truthy
  parameter-snake-case:
    description: Query and path parameter names should use camelCase or snake_case.
    severity: info
    given: $.paths[*][get,post,put,patch,delete].parameters[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9_]*$
  request-body-content-json:
    description: Request bodies should use application/json content type.
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      function: truthy
  request-body-description:
    description: Request body content should have a schema with description.
    severity: info
    given: $.paths[*][post,put,patch].requestBody
    then:
      function: truthy
  response-success-required:
    description: Every operation must define at least one 2xx response.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  response-401-required:
    description: Secured endpoints should define a 401 response.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: truthy
  response-description-required:
    description: All responses must have descriptions.
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*].description
    then:
      function: truthy
  schema-description-required:
    description: Top-level schemas must have descriptions.
    severity: warn
    given: $.components.schemas[*].description
    then:
      function: truthy
  schema-type-required:
    description: All schemas must define a type.
    severity: warn
    given: $.components.schemas[*].type
    then:
      function: truthy
  schema-property-camel-case:
    description: Schema property names should use camelCase.
    severity: info
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  security-schemes-defined:
    description: Security schemes must be defined in components.
    severity: error
    given: $.components.securitySchemes
    then:
      function: truthy
  security-bearer-auth:
    description: Bearer authentication scheme should be defined.
    severity: warn
    given: $.components.securitySchemes.bearerAuth
    then:
      function: truthy
  security-operation-defined:
    description: Each operation should define security requirements.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].security
    then:
      function: truthy
  get-no-request-body:
    description: GET operations must not have request bodies.
    severity: error
    given: $.paths[*].get.requestBody
    then:
      function: falsy
  delete-no-request-body:
    description: DELETE operations should not have request bodies.
    severity: warn
    given: $.paths[*].delete.requestBody
    then:
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: error
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  examples-encouraged:
    description: Schema properties should include example values.
    severity: info
    given: $.components.schemas[*].properties[*]
    then:
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the albertsons.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: albertsons\.com
  query-params-casing:
    description: Query parameters should be snake_case (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: snake
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: pascal
  schema-properties-casing:
    description: Schema properties should be snake_case (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: casing
      functionOptions:
        type: snake
  operation-security-required:
    description: Every operation should declare its security requirements.
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: security
      function: truthy
  error-schema-defined:
    description: A shared error schema (ErrorResponse) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: ErrorResponse
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy