Consumer Product Safety Commission · API Governance Rules

Consumer Product Safety Commission API Rules

Spectral linting rules defining API design standards and conventions for Consumer Product Safety Commission.

7 Rules error 3 warn 2 info 2
View Rules File View on GitHub

Rule Categories

cpsc

Rules

error
cpsc-info-contact
API contact information must be present.
$.info
error
cpsc-server-https
All server URLs must use HTTPS.
$.servers[*].url
warn
cpsc-server-host
Server URLs must point to a *.cpsc.gov or saferproducts.gov host.
$.servers[*].url
error
cpsc-operation-id
Every operation must declare a unique operationId.
$.paths[*][get,post,put,patch,delete]
warn
cpsc-operation-tags
Operations must declare at least one tag.
$.paths[*][get,post,put,patch,delete]
info
cpsc-format-parameter
GET endpoints should accept a `format` parameter for JSON or XML.
$.paths[*].get
info
cpsc-content-types
Responses should declare application/json and application/xml.
$.paths[*].get.responses['200'].content

Spectral Ruleset

Raw ↑
extends:
  - spectral:oas

# Spectral linting rules for the CPSC Recalls API.
# Tuned to saferproducts.gov / cpsc.gov public-data conventions: HTTPS,
# unauthenticated public access, JSON or XML output, and PascalCase
# query parameter names.
rules:
  cpsc-info-contact:
    description: API contact information must be present.
    severity: error
    given: "$.info"
    then:
      field: contact
      function: truthy

  cpsc-server-https:
    description: All server URLs must use HTTPS.
    severity: error
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "^https://"

  cpsc-server-host:
    description: Server URLs must point to a *.cpsc.gov or saferproducts.gov host.
    severity: warn
    given: "$.servers[*].url"
    then:
      function: pattern
      functionOptions:
        match: "(cpsc\\.gov|saferproducts\\.gov)"

  cpsc-operation-id:
    description: Every operation must declare a unique operationId.
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: operationId
      function: truthy

  cpsc-operation-tags:
    description: Operations must declare at least one tag.
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1

  cpsc-format-parameter:
    description: GET endpoints should accept a `format` parameter for JSON or XML.
    severity: info
    given: "$.paths[*].get"
    then:
      field: parameters
      function: schema
      functionOptions:
        schema:
          type: array
          contains:
            type: object
            properties:
              name:
                enum: ["format"]

  cpsc-content-types:
    description: Responses should declare application/json and application/xml.
    severity: info
    given: "$.paths[*].get.responses['200'].content"
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          anyOf:
            - required: ["application/json"]
            - required: ["application/xml"]

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/consumer-product-safety-commission-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.