Socket · API Governance Rules

Socket API Rules

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

12 Rules error 2 warn 7
View Rules File View on GitHub

Rule Categories

socket

Rules

warn
socket-info-contact
Socket OpenAPI documents should declare an info.contact block.
$.info
warn
socket-info-license
Socket OpenAPI documents should declare an info.license block.
$.info
error
socket-server-https-only
Socket servers must use HTTPS.
$.servers[*].url
warn
socket-server-base-path
Socket servers should be rooted at api.socket.dev/v0.
$.servers[*].url
error
socket-operation-id-required
Every operation must declare an operationId.
$.paths[*][get,post,put,patch,delete]
warn
socket-operation-summary-required
Every operation must declare a human-readable summary.
$.paths[*][get,post,put,patch,delete]
hint
socket-operation-summary-title-case
Socket operation summaries should use Title Case.
$.paths[*][get,post,put,patch,delete].summary
warn
socket-operation-tags-required
Every operation must declare at least one tag (Socket groups its API by resource tag).
$.paths[*][get,post,put,patch,delete]
warn
socket-deprecated-flag
Operations tagged as deprecated must set the deprecated flag.
$.paths[*][get,post,put,patch,delete][?(@.tags && @.tags.indexOf('deprecated') !== -1)]
hint
socket-org-slug-path-parameter
Organization-scoped paths use the path parameter name `org_slug`.
$.paths[?(@property.match(/{org_slug}/))]
hint
socket-purl-vocabulary
Endpoints handling packages should reference Package URL (purl) in their description.
$.paths[/purl,/orgs/{org_slug}/purl][post].description
warn
socket-response-success-required
Every operation must declare at least one 2xx response.
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
extends: spectral:oas
formats:
  - oas3
  - oas3_0
  - oas3_1
functions: []
rules:
  socket-info-contact:
    description: Socket OpenAPI documents should declare an info.contact block.
    message: '`info.contact` is missing — add Socket support contact metadata.'
    given: '$.info'
    severity: warn
    then:
      field: contact
      function: truthy

  socket-info-license:
    description: Socket OpenAPI documents should declare an info.license block.
    message: '`info.license` is missing.'
    given: '$.info'
    severity: warn
    then:
      field: license
      function: truthy

  socket-server-https-only:
    description: Socket servers must use HTTPS.
    message: 'Socket servers must use https:// — found {{value}}.'
    given: '$.servers[*].url'
    severity: error
    then:
      function: pattern
      functionOptions:
        match: '^https://'

  socket-server-base-path:
    description: Socket servers should be rooted at api.socket.dev/v0.
    message: 'Socket production base URL is https://api.socket.dev/v0 — found {{value}}.'
    given: '$.servers[*].url'
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^https://api\.socket\.dev/v0'

  socket-operation-id-required:
    description: Every operation must declare an operationId.
    message: 'Operation is missing operationId.'
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: error
    then:
      field: operationId
      function: truthy

  socket-operation-summary-required:
    description: Every operation must declare a human-readable summary.
    message: 'Operation is missing summary.'
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: summary
      function: truthy

  socket-operation-summary-title-case:
    description: Socket operation summaries should use Title Case.
    message: 'Operation summary should be Title Case — found "{{value}}".'
    given: "$.paths[*][get,post,put,patch,delete].summary"
    severity: hint
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z]'

  socket-operation-tags-required:
    description: Every operation must declare at least one tag (Socket groups its API by resource tag).
    message: 'Operation must declare at least one tag.'
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: tags
      function: schema
      functionOptions:
        schema:
          type: array
          minItems: 1

  socket-deprecated-flag:
    description: Operations tagged as deprecated must set the deprecated flag.
    message: 'Operations tagged "deprecated" must set `deprecated: true`.'
    given: "$.paths[*][get,post,put,patch,delete][?(@.tags && @.tags.indexOf('deprecated') !== -1)]"
    severity: warn
    then:
      field: deprecated
      function: truthy

  socket-org-slug-path-parameter:
    description: Organization-scoped paths use the path parameter name `org_slug`.
    message: 'Organization-scoped paths must use the path parameter name `org_slug`.'
    given: "$.paths[?(@property.match(/{org_slug}/))]"
    severity: hint
    then:
      function: truthy

  socket-purl-vocabulary:
    description: Endpoints handling packages should reference Package URL (purl) in their
      description.
    message: 'Package-oriented operations should mention the Package URL (purl) terminology.'
    given: "$.paths[/purl,/orgs/{org_slug}/purl][post].description"
    severity: hint
    then:
      function: pattern
      functionOptions:
        match: 'purl|Package URL'

  socket-response-success-required:
    description: Every operation must declare at least one 2xx response.
    message: 'Operation is missing a 2xx response definition.'
    given: "$.paths[*][get,post,put,patch,delete].responses"
    severity: warn
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            '^2': {}
          minProperties: 1

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/socket-dev-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.