Microsoft Teams · API Governance Rules

Microsoft Teams API Rules

Spectral linting rules defining API design standards and conventions for Microsoft Teams.

28 Rules error 14 warn 11 info 3
View Rules File View on GitHub

Rule Categories

delete error get info no openapi operation parameter path response schema security servers tag

Rules

error
info-title-must-contain-microsoft-teams
Info title must contain 'Microsoft' or 'Teams'
$.info.title
error
info-description-required
Info description is required and must be at least 20 characters
$.info
error
info-version-required
Info version is required
$.info
error
openapi-version-3
Must use OpenAPI 3.x
$.openapi
error
servers-must-be-defined
Servers array must be defined
$
error
servers-https-required
All server URLs must use HTTPS
$.servers[*].url
error
operation-operationid-required
Every operation must have an operationId
$.paths[*][get,post,put,patch,delete]
error
operation-summary-required
Every operation must have a summary
$.paths[*][get,post,put,patch,delete]
warn
operation-summary-prefix
Operation summaries should start with 'Microsoft Teams'
$.paths[*][get,post,put,patch,delete].summary
warn
operation-description-required
Every operation must have a description
$.paths[*][get,post,put,patch,delete]
error
operation-tags-required
Every operation must have at least one tag
$.paths[*][get,post,put,patch,delete]
warn
operation-operationid-camel-case
operationId should use camelCase
$.paths[*][get,post,put,patch,delete].operationId
info
tag-description-required
Global tags should have descriptions
$.tags[*]
warn
parameter-description-required
Parameters must have a description
$.paths[*][get,post,put,patch,delete].parameters[*]
error
parameter-schema-required
Parameters must have a schema
$.paths[*][get,post,put,patch,delete].parameters[*]
error
response-success-required
Every operation must define a success response (2xx)
$.paths[*][get,post,put,patch,delete].responses
warn
response-401-recommended
Operations should define a 401 Unauthorized response
$.paths[*][get,post,put,patch,delete].responses
info
schema-properties-description
Schema properties should have descriptions
$.components.schemas[*].properties[*]
error
security-global-defined
Global security must be defined
$
error
security-schemes-defined
Security schemes must be defined
$.components
error
get-no-request-body
GET operations must not have a request body
$.paths[*].get
warn
delete-no-request-body
DELETE operations must not have a request body
$.paths[*].delete
warn
no-empty-descriptions
Descriptions must not be empty strings.
$..description
warn
servers-expected-domain
Server URLs should be on the microsoft.com domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be kebab-case (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
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 (ErrorResponse) should be defined for error payloads.
$.components.schemas

Spectral Ruleset

Raw ↑
# microsoft-teams — 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 microsoft.com
#   - path-params-casing: kebab @ 100% (n=25)
#   - operationid-casing: camel @ 100% (n=24)
#   - schema-names-casing: pascal @ 100% (n=15)
#   - schema-properties-casing: snake @ 59% (n=51)
#   - security: global (root) — NOT emitting operation-security-required
#   - error-schema-defined: ErrorResponse
#   - operation-documents-401: 100% adherence
#   - merge: kept 23 existing, added 6 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, schema-names-casing, schema-properties-casing, error-schema-defined, no-empty-descriptions
extends:
  - spectral:oas
rules:
  info-title-must-contain-microsoft-teams:
    description: Info title must contain 'Microsoft' or 'Teams'
    given: $.info.title
    severity: error
    then:
      function: pattern
      functionOptions:
        match: (Microsoft|Teams)
  info-description-required:
    description: Info description is required and must be at least 20 characters
    given: $.info
    severity: error
    then:
      field: description
      function: truthy
  info-version-required:
    description: Info version is required
    given: $.info
    severity: error
    then:
      field: version
      function: truthy
  openapi-version-3:
    description: Must use OpenAPI 3.x
    given: $.openapi
    severity: error
    then:
      function: pattern
      functionOptions:
        match: ^3\.
  servers-must-be-defined:
    description: Servers array must be defined
    given: $
    severity: error
    then:
      field: servers
      function: truthy
  servers-https-required:
    description: All server URLs must use HTTPS
    given: $.servers[*].url
    severity: error
    then:
      function: pattern
      functionOptions:
        match: ^https://
  operation-operationid-required:
    description: Every operation must have an operationId
    given: $.paths[*][get,post,put,patch,delete]
    severity: error
    then:
      field: operationId
      function: truthy
  operation-summary-required:
    description: Every operation must have a summary
    given: $.paths[*][get,post,put,patch,delete]
    severity: error
    then:
      field: summary
      function: truthy
  operation-summary-prefix:
    description: Operation summaries should start with 'Microsoft Teams'
    given: $.paths[*][get,post,put,patch,delete].summary
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: ^Microsoft Teams
  operation-description-required:
    description: Every operation must have a description
    given: $.paths[*][get,post,put,patch,delete]
    severity: warn
    then:
      field: description
      function: truthy
  operation-tags-required:
    description: Every operation must have at least one tag
    given: $.paths[*][get,post,put,patch,delete]
    severity: error
    then:
      field: tags
      function: truthy
  operation-operationid-camel-case:
    description: operationId should use camelCase
    given: $.paths[*][get,post,put,patch,delete].operationId
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  tag-description-required:
    description: Global tags should have descriptions
    given: $.tags[*]
    severity: info
    then:
      field: description
      function: truthy
  parameter-description-required:
    description: Parameters must have a description
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    severity: warn
    then:
      field: description
      function: truthy
  parameter-schema-required:
    description: Parameters must have a schema
    given: $.paths[*][get,post,put,patch,delete].parameters[*]
    severity: error
    then:
      field: schema
      function: truthy
  response-success-required:
    description: Every operation must define a success response (2xx)
    given: $.paths[*][get,post,put,patch,delete].responses
    severity: error
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
          - required:
            - '200'
          - required:
            - '201'
          - required:
            - '202'
          - required:
            - '204'
  response-401-recommended:
    description: Operations should define a 401 Unauthorized response
    given: $.paths[*][get,post,put,patch,delete].responses
    severity: warn
    then:
      field: '401'
      function: truthy
  schema-properties-description:
    description: Schema properties should have descriptions
    given: $.components.schemas[*].properties[*]
    severity: info
    then:
      field: description
      function: truthy
  security-global-defined:
    description: Global security must be defined
    given: $
    severity: error
    then:
      field: security
      function: truthy
  security-schemes-defined:
    description: Security schemes must be defined
    given: $.components
    severity: error
    then:
      field: securitySchemes
      function: truthy
  get-no-request-body:
    description: GET operations must not have a request body
    given: $.paths[*].get
    severity: error
    then:
      field: requestBody
      function: falsy
  delete-no-request-body:
    description: DELETE operations must not have a request body
    given: $.paths[*].delete
    severity: warn
    then:
      field: requestBody
      function: falsy
  no-empty-descriptions:
    description: Descriptions must not be empty strings.
    severity: warn
    given: $..description
    then:
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the microsoft.com domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: microsoft\.com
  path-params-casing:
    description: Path parameters should be kebab-case (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: kebab
  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
  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