Pocket Network · API Governance Rules

Pocket Network API Rules

Spectral linting rules defining API design standards and conventions for Pocket Network.

8 Rules error 2 warn 5 info 1
View Rules File View on GitHub

Rule Categories

pocket

Rules

error
pocket-network-title-required
Every Pocket Network OpenAPI spec must declare a clear title.
$.info
warn
pocket-network-description-required
Every operation must include a description so integrators understand the relay semantics.
$.paths[*][get,post,put,patch,delete]
warn
pocket-network-operation-summary-title-case
Operation summaries should use Title Case (matches API Evangelist style).
$.paths[*][get,post,put,patch,delete].summary
warn
pocket-network-tags-required
Every operation must be tagged so it groups under a Shannon module or PATH surface.
$.paths[*][get,post,put,patch,delete]
error
pocket-network-server-url-required
At least one server must be declared. Production specs should use the grove.city or poktroll.com host families.
$.servers
warn
pocket-network-json-rpc-body-schema
Operations that accept a JSON-RPC payload must reference the JsonRpcRequest schema (or an equivalent envelope).
$.paths[?(@property == '/v1/{appId}' || @property == '/v1')].post.requestBody.content['application/json'].schema
warn
pocket-network-shannon-rest-bech32
Path parameters named 'address' on Shannon REST endpoints should describe Bech32 'pokt1...' addresses.
$.paths..parameters[?(@.name == 'address')]
info
pocket-network-compute-units-mentioned
API descriptions for Shannon and PATH should mention compute units somewhere — the protocol's metering unit.
$.info.description

Spectral Ruleset

Raw ↑
extends:
  - 'spectral:oas'
  - 'spectral:asyncapi'

rules:
  pocket-network-title-required:
    description: Every Pocket Network OpenAPI spec must declare a clear title.
    given: '$.info'
    severity: error
    then:
      field: title
      function: truthy

  pocket-network-description-required:
    description: Every operation must include a description so integrators understand the relay
      semantics.
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: description
      function: truthy

  pocket-network-operation-summary-title-case:
    description: Operation summaries should use Title Case (matches API Evangelist style).
    given: "$.paths[*][get,post,put,patch,delete].summary"
    severity: warn
    then:
      function: pattern
      functionOptions:
        match: '^[A-Z][A-Za-z0-9]*( [A-Z][A-Za-z0-9]*)*$'

  pocket-network-tags-required:
    description: Every operation must be tagged so it groups under a Shannon module or PATH surface.
    given: "$.paths[*][get,post,put,patch,delete]"
    severity: warn
    then:
      field: tags
      function: truthy

  pocket-network-server-url-required:
    description: At least one server must be declared. Production specs should use the
      grove.city or poktroll.com host families.
    given: '$.servers'
    severity: error
    then:
      function: length
      functionOptions:
        min: 1

  pocket-network-json-rpc-body-schema:
    description: Operations that accept a JSON-RPC payload must reference the JsonRpcRequest schema
      (or an equivalent envelope).
    given: "$.paths[?(@property == '/v1/{appId}' || @property == '/v1')].post.requestBody.content['application/json'].schema"
    severity: warn
    then:
      function: truthy

  pocket-network-shannon-rest-bech32:
    description: Path parameters named 'address' on Shannon REST endpoints should describe Bech32
      'pokt1...' addresses.
    given: "$.paths..parameters[?(@.name == 'address')]"
    severity: warn
    then:
      field: description
      function: pattern
      functionOptions:
        match: 'Bech32|pokt1'

  pocket-network-compute-units-mentioned:
    description: API descriptions for Shannon and PATH should mention compute units somewhere — the
      protocol's metering unit.
    given: '$.info.description'
    severity: info
    then:
      function: pattern
      functionOptions:
        match: '(compute units?|CU)'