kanye.rest · API Governance Rules

kanye.rest API Rules

Spectral linting rules defining API design standards and conventions for kanye.rest.

43 Rules error 14 warn 21 info 8
View Rules File View on GitHub

Rule Categories

error info method no openapi operation parameters paths requestbody response schema security servers tags

Rules

warn
info-title-prefix
Spec title must begin with "Kanye REST".
$.info.title
warn
info-description-required
A long-form description is required on info.
$.info
warn
info-license-required
License metadata is required (project is MIT).
$.info
info
info-contact-required
Contact info is required so consumers know who to reach.
$.info
warn
openapi-version-3-0-3
Pin OpenAPI to the 3.0.x line used by this provider.
$.openapi
error
servers-defined
At least one server must be defined.
$.servers
error
servers-https-only
All servers must use HTTPS.
$.servers[*].url
warn
servers-canonical-host
The Kanye REST canonical host is api.kanye.rest.
$.servers[*].url
info
servers-description-required
Servers should describe what environment they represent.
$.servers[*]
error
paths-lowercase
Path segments must be lowercase.
$.paths[*]~
error
paths-no-trailing-slash
Paths must not end with a trailing slash (except root).
$.paths[*]~
error
paths-no-path-parameters
Kanye REST exposes no path parameters; resources are flat.
$.paths[*]~
error
paths-no-query-string
Paths must not contain a query string.
$.paths[*]~
warn
operation-get-only
All Kanye REST operations are GET.
$.paths[*]
error
operation-summary-required
Every operation must have a summary.
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-prefix
Operation summaries must start with "Kanye REST".
$.paths[*][get,post,put,patch,delete].summary
error
operation-description-required
Every operation must have a description.
$.paths[*][get,post,put,patch,delete]
error
operation-operationid-required
Every operation must have a camelCase operationId.
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camelcase
operationId must be camelCase.
$.paths[*][get,post,put,patch,delete].operationId
info
operation-operationid-verb-prefix
operationId must start with a known verb prefix.
$.paths[*][get,post,put,patch,delete].operationId
error
operation-tags-required
Every operation must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
info
operation-microcks-operation-required
Every operation must declare an x-microcks-operation block for mockability.
$.paths[*][get,post,put,patch,delete]
warn
tags-defined-globally
A global tags array must be defined with descriptions.
$
warn
tags-title-case
Tags must use Title Case (e.g. "Quotes").
$.tags[*].name
warn
tags-description-required
Each global tag must have a description.
$.tags[*]
warn
parameters-not-used
Kanye REST exposes no parameters; reject any.
$.paths[*][get,post,put,patch,delete].parameters
warn
requestbody-not-used
Kanye REST exposes no request bodies; all operations are pure reads.
$.paths[*][get,post,put,patch,delete].requestBody
error
response-200-required
Every operation must define a 200 success response.
$.paths[*][get,post,put,patch,delete].responses
warn
response-500-required
Every operation must define a 500 error response.
$.paths[*][get,post,put,patch,delete].responses
error
response-description-required
Each response must have a description.
$.paths[*][get,post,put,patch,delete].responses[*]
info
response-json-content
2xx responses other than /text must use application/json.
$.paths[*][get,post,put,patch,delete].responses[200].content
info
response-example-required
Every 200 response should ship a named example for mock servers.
$.paths[*][get,post,put,patch,delete].responses[200].content[*]
warn
schema-property-camelcase
Schema property names must be camelCase or single-word lowercase.
$.components.schemas[*].properties[*]~
warn
schema-property-description
Schema properties must be described.
$.components.schemas[*].properties[*]
error
schema-property-type-required
Schema properties must declare a type or $ref.
$.components.schemas[*].properties[*]
info
schema-property-example
Schema properties should declare an example value.
$.components.schemas[*].properties[*]
warn
schema-top-level-description
Top-level schemas must have a description.
$.components.schemas[*]
info
security-none
Kanye REST is an open, unauthenticated public API; reject security schemes.
$.components.securitySchemes
error
method-get-no-request-body
GET operations must not declare a request body.
$.paths[*].get.requestBody
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description
warn
servers-expected-domain
Server URLs should be on the kanye.rest domain.
$.servers[*].url
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
warn
error-schema-defined
A shared error schema (Error) should be defined for error payloads.
$.components.schemas

Spectral Ruleset

Raw ↑
# kanye-rest — 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 kanye.rest
#   - operationid-casing: camel @ 100% (n=3)
#   - schema-names-casing: pascal @ 100% (n=3)
#   - error-schema-defined: Error
#   - operation-documents-500: 100% adherence
#   - merge: kept 40 existing, added 3 measured, upgraded 0
#   - added: servers-expected-domain, schema-names-casing, error-schema-defined
extends:
  - spectral:oas
rules:
  info-title-prefix:
    description: Spec title must begin with "Kanye REST".
    message: info.title should start with 'Kanye REST'
    severity: warn
    given: $.info.title
    then:
      function: pattern
      functionOptions:
        match: ^Kanye REST
  info-description-required:
    description: A long-form description is required on info.
    message: info.description is required and must be at least 60 characters
    severity: warn
    given: $.info
    then:
      field: description
      function: length
      functionOptions:
        min: 60
  info-license-required:
    description: License metadata is required (project is MIT).
    message: info.license is required and should be MIT
    severity: warn
    given: $.info
    then:
      field: license
      function: truthy
  info-contact-required:
    description: Contact info is required so consumers know who to reach.
    message: info.contact is required
    severity: info
    given: $.info
    then:
      field: contact
      function: truthy
  openapi-version-3-0-3:
    description: Pin OpenAPI to the 3.0.x line used by this provider.
    message: openapi version should be 3.0.x
    severity: warn
    given: $.openapi
    then:
      function: pattern
      functionOptions:
        match: ^3\.0\.
  servers-defined:
    description: At least one server must be defined.
    message: servers array must contain at least one entry
    severity: error
    given: $.servers
    then:
      function: length
      functionOptions:
        min: 1
  servers-https-only:
    description: All servers must use HTTPS.
    message: server URL must use https://
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  servers-canonical-host:
    description: The Kanye REST canonical host is api.kanye.rest.
    message: server URL should be https://api.kanye.rest
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://api\.kanye\.rest
  servers-description-required:
    description: Servers should describe what environment they represent.
    message: server entries should have a description
    severity: info
    given: $.servers[*]
    then:
      field: description
      function: truthy
  paths-lowercase:
    description: Path segments must be lowercase.
    message: path '{{value}}' must be lowercase
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^/[a-z]*$
  paths-no-trailing-slash:
    description: Paths must not end with a trailing slash (except root).
    message: path '{{value}}' must not end with a trailing slash
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: .+/$
  paths-no-path-parameters:
    description: Kanye REST exposes no path parameters; resources are flat.
    message: Kanye REST paths must not contain {parameters}
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \{.+\}
  paths-no-query-string:
    description: Paths must not contain a query string.
    message: path '{{value}}' must not contain a query string
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \?
  operation-get-only:
    description: All Kanye REST operations are GET.
    message: Kanye REST exposes only GET operations; remove '{{property}}'
    severity: warn
    given: $.paths[*]
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^(get|parameters|summary|description)$
  operation-summary-required:
    description: Every operation must have a summary.
    message: operation summary is required
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: summary
      function: truthy
  operation-summary-prefix:
    description: Operation summaries must start with "Kanye REST".
    message: operation summary should start with 'Kanye REST'
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].summary
    then:
      function: pattern
      functionOptions:
        match: '^Kanye REST '
  operation-description-required:
    description: Every operation must have a description.
    message: operation description is required
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: description
      function: truthy
  operation-operationid-required:
    description: Every operation must have a camelCase operationId.
    message: operation must define an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: operationId
      function: truthy
  operation-operationid-camelcase:
    description: operationId must be camelCase.
    message: operationId '{{value}}' must be camelCase
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]+$
  operation-operationid-verb-prefix:
    description: operationId must start with a known verb prefix.
    message: operationId '{{value}}' should start with get/list/create/update/delete/search
    severity: info
    given: $.paths[*][get,post,put,patch,delete].operationId
    then:
      function: pattern
      functionOptions:
        match: ^(get|list|create|update|delete|search|count|find)
  operation-tags-required:
    description: Every operation must declare at least one tag.
    message: operation must declare at least one tag
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: tags
      function: truthy
  operation-microcks-operation-required:
    description: Every operation must declare an x-microcks-operation block for mockability.
    message: operation should declare x-microcks-operation
    severity: info
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: x-microcks-operation
      function: truthy
  tags-defined-globally:
    description: A global tags array must be defined with descriptions.
    message: global tags array must be defined
    severity: warn
    given: $
    then:
      field: tags
      function: truthy
  tags-title-case:
    description: Tags must use Title Case (e.g. "Quotes").
    message: tag '{{value}}' must be Title Case
    severity: warn
    given: $.tags[*].name
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z][a-zA-Z0-9]*( [A-Z][a-zA-Z0-9]*)*$
  tags-description-required:
    description: Each global tag must have a description.
    message: tag descriptions are required
    severity: warn
    given: $.tags[*]
    then:
      field: description
      function: truthy
  parameters-not-used:
    description: Kanye REST exposes no parameters; reject any.
    message: Kanye REST operations must not declare parameters
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters
    then:
      function: falsy
  requestbody-not-used:
    description: Kanye REST exposes no request bodies; all operations are pure reads.
    message: Kanye REST operations must not declare request bodies
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].requestBody
    then:
      function: falsy
  response-200-required:
    description: Every operation must define a 200 success response.
    message: operation must define a 200 response
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '200'
      function: truthy
  response-500-required:
    description: Every operation must define a 500 error response.
    message: operation must define a 500 response
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '500'
      function: truthy
  response-description-required:
    description: Each response must have a description.
    message: response description is required
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy
  response-json-content:
    description: 2xx responses other than /text must use application/json.
    message: 2xx responses should use application/json
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses[200].content
    then:
      function: truthy
  response-example-required:
    description: Every 200 response should ship a named example for mock servers.
    message: 200 responses should include named examples
    severity: info
    given: $.paths[*][get,post,put,patch,delete].responses[200].content[*]
    then:
      field: examples
      function: truthy
  schema-property-camelcase:
    description: Schema property names must be camelCase or single-word lowercase.
    message: schema property '{{property}}' must be camelCase
    severity: warn
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  schema-property-description:
    description: Schema properties must be described.
    message: schema property '{{property}}' is missing a description
    severity: warn
    given: $.components.schemas[*].properties[*]
    then:
      field: description
      function: truthy
  schema-property-type-required:
    description: Schema properties must declare a type or $ref.
    message: schema property '{{property}}' must declare a type or $ref
    severity: error
    given: $.components.schemas[*].properties[*]
    then:
      function: schema
      functionOptions:
        schema:
          oneOf:
          - required:
            - type
          - required:
            - $ref
  schema-property-example:
    description: Schema properties should declare an example value.
    message: schema property '{{property}}' should include an example
    severity: info
    given: $.components.schemas[*].properties[*]
    then:
      field: example
      function: truthy
  schema-top-level-description:
    description: Top-level schemas must have a description.
    message: schema '{{property}}' is missing a description
    severity: warn
    given: $.components.schemas[*]
    then:
      field: description
      function: truthy
  security-none:
    description: Kanye REST is an open, unauthenticated public API; reject security schemes.
    message: Kanye REST has no authentication; remove security schemes
    severity: info
    given: $.components.securitySchemes
    then:
      function: falsy
  method-get-no-request-body:
    description: GET operations must not declare a request body.
    message: GET operations must not declare a requestBody
    severity: error
    given: $.paths[*].get.requestBody
    then:
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    message: description must not be empty
    severity: warn
    given: $..description
    then:
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the kanye.rest domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: kanye\.rest
  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
  error-schema-defined:
    description: A shared error schema (Error) should be defined for error payloads.
    severity: warn
    given: $.components.schemas
    then:
      field: Error
      function: truthy