Urban Outfitters · API Governance Rules

Urban Outfitters API Rules

Spectral linting rules defining API design standards and conventions for Urban Outfitters.

37 Rules error 10 warn 17 info 1
View Rules File View on GitHub

Rule Categories

error no operationid query schema uo

Rules

error
uo-info-title-present
API info must have a title
$.info
warn
uo-info-description-present
API info must have a description
$.info
error
uo-info-version-present
API info must have a version
$.info
error
uo-openapi-version
Must use OpenAPI 3.x
$
warn
uo-servers-present
API must define servers
$
warn
uo-server-url-https
Server URLs should use HTTPS
$.servers[*].url
error
uo-paths-present
API must define paths
$
warn
uo-path-lowercase
Path segments should be lowercase
$.paths[*]~
error
uo-operation-id-present
All operations must have an operationId
$.paths[*][get,post,put,patch,delete]
warn
uo-operation-summary-present
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
hint
uo-operation-description-present
All operations should have a description
$.paths[*][get,post,put,patch,delete]
warn
uo-operation-tags-present
All operations must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
uo-tags-defined
All tags used in operations should be defined at the top level
$
warn
uo-parameter-description-present
All parameters should have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
error
uo-parameter-schema-present
All parameters must have a schema
$.paths[*][get,post,put,patch,delete].parameters[*]
hint
uo-request-body-description
Request bodies should have a description
$.paths[*][post,put,patch].requestBody
error
uo-response-description-present
All responses must have a description
$.paths[*][get,post,put,patch,delete].responses[*]
error
uo-response-success-present
Operations must have at least one success (2xx) response
$.paths[*][get,post,put,patch,delete].responses
warn
uo-response-error-present
Operations should define error responses
$.paths[*][get,post,put,patch,delete].responses
hint
uo-schema-description-present
All schemas should have a description
$.components.schemas[*]
hint
uo-schema-properties-examples
Schema properties should include examples
$.components.schemas[*].properties[*]
error
uo-security-schemes-defined
API must define security schemes
$.components
warn
uo-global-security-present
API should define global security requirements
$
warn
uo-get-no-request-body
GET operations should not have a request body
$.paths[*].get
hint
uo-delete-no-body
DELETE operations should not have a request body
$.paths[*].delete
hint
uo-affiliate-tracking-url
Affiliate product responses should include affiliate URLs
$.components.schemas.Product.properties
hint
uo-commission-rate-defined
Commission reports should include commission rate
$.components.schemas.CommissionReport.properties
error
uo-seller-product-sku
Seller products must include a SKU
$.components.schemas.SellerProduct.properties
warn
uo-order-status-enum
Order status should use predefined values
$.components.schemas.Order.properties.status
hint
uo-microcks-operation-present
Operations should include Microcks extension for mocking
$.paths[*][get,post,put,patch,delete]
hint
uo-examples-in-responses
Responses should include examples for documentation
$.paths[*][get,post,put,patch,delete].responses[*].content[*]
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
operationid-casing
Operation IDs should be camelCase (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].operationId
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
error-schema-defined
A shared error schema (APIError) should be defined for error payloads.
$.components.schemas
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description

Spectral Ruleset

Raw ↑
# urban-outfitters — 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)
#   - query-params-casing: snake @ 100% (n=14)
#   - operationid-casing: camel @ 100% (n=10)
#   - schema-names-casing: pascal @ 100% (n=20)
#   - schema-properties-casing: snake @ 69% (n=96)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: APIError
#   - pagination params observed: ['limit', 'offset', 'size']
#   - merge: kept 31 existing, added 6 measured, upgraded 0
#   - added: query-params-casing, operationid-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  uo-info-title-present:
    description: API info must have a title
    message: Info object must have a title
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  uo-info-description-present:
    description: API info must have a description
    message: Info object must have a description
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  uo-info-version-present:
    description: API info must have a version
    message: Info object must have a version
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  uo-openapi-version:
    description: Must use OpenAPI 3.x
    message: OpenAPI version must be 3.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  uo-servers-present:
    description: API must define servers
    message: Servers array must be defined and non-empty
    severity: warn
    given: $
    then:
      field: servers
      function: truthy
  uo-server-url-https:
    description: Server URLs should use HTTPS
    message: 'Server URL should use HTTPS: {{value}}'
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  uo-paths-present:
    description: API must define paths
    message: Paths object must be defined and non-empty
    severity: error
    given: $
    then:
      field: paths
      function: truthy
  uo-path-lowercase:
    description: Path segments should be lowercase
    message: 'Path should use lowercase letters: {{value}}'
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^/[a-z0-9/_{}.-]*$
  uo-operation-id-present:
    description: All operations must have an operationId
    message: Operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  uo-operation-summary-present:
    description: All operations must have a summary
    message: Operation must have a summary
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  uo-operation-description-present:
    description: All operations should have a description
    message: Operation should have a description
    severity: hint
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  uo-operation-tags-present:
    description: All operations must have at least one tag
    message: Operation must have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  uo-tags-defined:
    description: All tags used in operations should be defined at the top level
    message: Tags should be defined in the global tags array
    severity: warn
    given: $
    then:
      field: tags
      function: truthy
  uo-parameter-description-present:
    description: All parameters should have a description
    message: Parameter must have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: description
      function: truthy
  uo-parameter-schema-present:
    description: All parameters must have a schema
    message: Parameter must have a schema
    severity: error
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    then:
      field: schema
      function: truthy
  uo-request-body-description:
    description: Request bodies should have a description
    message: Request body should have a description
    severity: hint
    given: $.paths[*][post,put,patch].requestBody
    then:
      field: description
      function: truthy
  uo-response-description-present:
    description: All responses must have a description
    message: Response must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy
  uo-response-success-present:
    description: Operations must have at least one success (2xx) response
    message: Operation must define a 2xx response
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '202'
          - required:
            - '204'
  uo-response-error-present:
    description: Operations should define error responses
    message: Operation should define at least one error response (4xx or 5xx)
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
          - required:
            - '400'
          - required:
            - '401'
          - required:
            - '403'
          - required:
            - '404'
          - required:
            - '500'
  uo-schema-description-present:
    description: All schemas should have a description
    message: Schema should have a description
    severity: hint
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  uo-schema-properties-examples:
    description: Schema properties should include examples
    message: Schema property should have an example value
    severity: hint
    given: $.components.schemas[*].properties[*]
    then:
      field: example
      function: truthy
  uo-security-schemes-defined:
    description: API must define security schemes
    message: Security schemes must be defined in components
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  uo-global-security-present:
    description: API should define global security requirements
    message: Global security array should be defined
    severity: warn
    given: $
    then:
      field: security
      function: truthy
  uo-get-no-request-body:
    description: GET operations should not have a request body
    message: GET operation should not have a request body
    severity: warn
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  uo-delete-no-body:
    description: DELETE operations should not have a request body
    message: DELETE operation should not have a request body
    severity: hint
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy
  uo-affiliate-tracking-url:
    description: Affiliate product responses should include affiliate URLs
    message: Affiliate API product schema should include affiliateUrl field
    severity: hint
    given: $.components.schemas.Product.properties
    then:
      field: affiliateUrl
      function: truthy
  uo-commission-rate-defined:
    description: Commission reports should include commission rate
    message: CommissionReport schema should define commissionRate
    severity: hint
    given: $.components.schemas.CommissionReport.properties
    then:
      field: commissionRate
      function: truthy
  uo-seller-product-sku:
    description: Seller products must include a SKU
    message: SellerProduct schema must include sku field
    severity: error
    given: $.components.schemas.SellerProduct.properties
    then:
      field: sku
      function: truthy
  uo-order-status-enum:
    description: Order status should use predefined values
    message: Order status field should define an enum
    severity: warn
    given: $.components.schemas.Order.properties.status
    then:
      field: enum
      function: truthy
  uo-microcks-operation-present:
    description: Operations should include Microcks extension for mocking
    message: Operation should have x-microcks-operation extension
    severity: hint
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: x-microcks-operation
      function: truthy
  uo-examples-in-responses:
    description: Responses should include examples for documentation
    message: Response content should include examples
    severity: hint
    given: $.paths[*][get,post,put,patch,delete].responses[*].content[*]
    then:
      field: examples
      function: truthy
  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
  operationid-casing:
    description: Operation IDs should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: casing
      functionOptions:
        type: camel
  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: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  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
  error-schema-defined:
    description: A shared error schema (APIError) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: APIError
      function: truthy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy