US Department of Commerce · API Governance Rules

US Department of Commerce API Rules

Spectral linting rules defining API design standards and conventions for US Department of Commerce.

10 Rules error 2 warn 7 info 1
View Rules File View on GitHub

Rule Categories

commerce

Rules

warn
commerce-operation-ids-camel-case
Operation IDs must use camelCase naming
$.paths[*][*].operationId
warn
commerce-response-200-present
All operations should define a 200 response
$.paths[*][get,post,put,patch]
warn
commerce-path-kebab-case
API paths must use kebab-case for path segments
$.paths
error
commerce-operations-have-summaries
All operations must have a summary
$.paths[*][get,post,put,patch,delete]
warn
commerce-operations-have-tags
All operations should have at least one tag
$.paths[*][get,post,put,patch,delete]
info
commerce-pagination-params-consistent
List operations should use consistent pagination parameters
$.paths[*][get]
warn
commerce-response-schema-defined
Successful responses should reference a schema
$.paths[*][get].responses.200
warn
commerce-info-contact-present
API info should include contact information
$.info
error
commerce-servers-defined
API must define at least one server
$
warn
commerce-tags-title-case
Tags must use Title Case naming
$.tags[*].name

Spectral Ruleset

Raw ↑
extends: spectral:oas
rules:
  commerce-operation-ids-camel-case:
    description: Operation IDs must use camelCase naming
    message: Operation ID "{{value}}" should use camelCase (e.g., listNews, getBlogPost)
    severity: warn
    given: "$.paths[*][*].operationId"
    then:
      function: pattern
      functionOptions:
        match: "^[a-z][a-zA-Z0-9]*$"

  commerce-response-200-present:
    description: All operations should define a 200 response
    message: Operation is missing a 200 OK response
    severity: warn
    given: "$.paths[*][get,post,put,patch]"
    then:
      field: responses.200
      function: truthy

  commerce-path-kebab-case:
    description: API paths must use kebab-case for path segments
    message: Path segment "{{value}}" should use kebab-case
    severity: warn
    given: "$.paths"
    then:
      function: pattern
      functionOptions:
        match: "^(\\/([a-z][a-z0-9-]*|\\{[a-zA-Z][a-zA-Z0-9_]*\\}))*$"

  commerce-operations-have-summaries:
    description: All operations must have a summary
    message: Operation is missing a summary
    severity: error
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: summary
      function: truthy

  commerce-operations-have-tags:
    description: All operations should have at least one tag
    message: Operation is missing tags
    severity: warn
    given: "$.paths[*][get,post,put,patch,delete]"
    then:
      field: tags
      function: truthy

  commerce-pagination-params-consistent:
    description: List operations should use consistent pagination parameters
    message: List operations should support page and items_per_page parameters
    severity: info
    given: "$.paths[*][get]"
    then:
      function: schema
      functionOptions:
        schema:
          type: object

  commerce-response-schema-defined:
    description: Successful responses should reference a schema
    message: Response 200 should define a content schema
    severity: warn
    given: "$.paths[*][get].responses.200"
    then:
      field: content
      function: truthy

  commerce-info-contact-present:
    description: API info should include contact information
    message: API info is missing contact details
    severity: warn
    given: "$.info"
    then:
      field: contact
      function: truthy

  commerce-servers-defined:
    description: API must define at least one server
    message: No servers defined in the API specification
    severity: error
    given: "$"
    then:
      field: servers
      function: truthy

  commerce-tags-title-case:
    description: Tags must use Title Case naming
    message: Tag "{{value}}" should use Title Case (e.g., "News", "Blog Posts")
    severity: warn
    given: "$.tags[*].name"
    then:
      function: pattern
      functionOptions:
        match: "^[A-Z][a-zA-Z0-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/commerce-gov-api-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.