Xiaomi · API Governance Rules

Xiaomi API Rules

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

8 Rules warn 5 info 3
View Rules File View on GitHub

Rule Categories

xiaomi

Rules

warn
xiaomi-operation-summary-title-case
All operation summaries must use Title Case.
$.paths[*][*].summary
warn
xiaomi-operation-id-camel-case
All operationIds must use camelCase.
$.paths[*][*].operationId
warn
xiaomi-tags-required
All operations must have at least one tag.
$.paths[*][*]
warn
xiaomi-response-200-required
All operations must define a 200 or 201 response.
$.paths[*][*].responses
info
xiaomi-security-defined
All operations must define security requirements.
$.paths[*][*]
warn
xiaomi-description-required
All operations must have a description.
$.paths[*][*].description
info
xiaomi-parameter-description
All parameters must have descriptions.
$.paths[*][*].parameters[*].description
info
xiaomi-api-version-prefix
API paths should be prefixed with a version segment like /v1/.
$.paths

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  xiaomi-operation-summary-title-case:
    description: All operation summaries must use Title Case.
    message: "Operation summary '{{value}}' must use Title Case."
    severity: warn
    given: "$.paths[*][*].summary"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-9]*([ ][A-Z][a-zA-Z0-9]*)*$"

  xiaomi-operation-id-camel-case:
    description: All operationIds must use camelCase.
    message: "OperationId '{{value}}' must use camelCase."
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  xiaomi-tags-required:
    description: All operations must have at least one tag.
    message: "Operation is missing tags."
    severity: warn
    given: "$.paths[*][*]"
    then:
      field: tags
      function: truthy

  xiaomi-response-200-required:
    description: All operations must define a 200 or 201 response.
    message: "Operation must define a success (200/201) response."
    severity: warn
    given: "$.paths[*][*].responses"
    then:
      function: schema
      functionOptions:
        schema:
          anyOf:
            - required: ['200']
            - required: ['201']

  xiaomi-security-defined:
    description: All operations must define security requirements.
    message: "Operation should define security requirements."
    severity: info
    given: "$.paths[*][*]"
    then:
      field: security
      function: truthy

  xiaomi-description-required:
    description: All operations must have a description.
    message: "Operation is missing a description."
    severity: warn
    given: "$.paths[*][*].description"
    then:
      function: truthy

  xiaomi-parameter-description:
    description: All parameters must have descriptions.
    message: "Parameter '{{value}}' is missing a description."
    severity: info
    given: "$.paths[*][*].parameters[*].description"
    then:
      function: truthy

  xiaomi-api-version-prefix:
    description: API paths should be prefixed with a version segment like /v1/.
    message: "Path '{{property}}' should begin with a version prefix (e.g., /v1/)."
    severity: info
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^/v[0-9]+"

Work with this as data

Every ruleset here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for spectral rules

4 MCP tools reach this
  • find_rulesBrowse and filter every ruleset in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This ruleset
curl "https://apis.io/api/v1/rules/xiaomi-rules"
All spectral rules
curl "https://apis.io/api/v1/rules?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.