Uniswap · API Governance Rules

Uniswap API Rules

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

43 Rules error 14 warn 24 info 5
View Rules File View on GitHub

Rule Categories

components delete get info no openapi operation parameter path paths post query request response schema security server servers

Rules

error
info-title-required
$.info
warn
info-description-required
$.info
error
info-version-required
$.info
error
openapi-version-3
$
error
servers-defined
$
error
servers-https-only
$.servers[*].url
warn
server-description-required
$.servers[*]
warn
paths-no-trailing-slash
$.paths[*]~
error
paths-no-query-strings
$.paths[*]~
warn
paths-kebab-case
$.paths[*]~
error
operation-id-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-id-snake-case
$.paths[*][get,post,put,patch,delete,head,options].operationId
error
operation-summary-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-summary-title-case
$.paths[*][get,post,put,patch,delete,head,options].summary
warn
operation-description-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
operation-tags-required
$.paths[*][get,post,put,patch,delete,head,options]
warn
parameter-description-required
$.paths[*][get,post,put,patch,delete,head,options].parameters[*]
error
parameter-schema-required
$.paths[*][get,post,put,patch,delete,head,options].parameters[*]
warn
request-body-description
$.paths[*][post,put,patch].requestBody
warn
request-body-json-content
$.paths[*][post,put,patch].requestBody.content
error
response-success-required
$.paths[*][get,post,put,patch,delete]
error
response-description-required
$.paths[*][get,post,put,patch,delete].responses[*]
warn
response-401-unauthorized
$.paths[*][post,get]
info
response-429-rate-limit
$.paths[*][post,get]
info
schema-property-camel-case
$.components.schemas[*].properties[*]~
warn
schema-type-defined
$.components.schemas[*]
error
security-schemes-defined
$.components
error
security-api-key-header
$.components.securitySchemes[*][?(@.type=='apiKey')]
error
get-no-request-body
$.paths[*].get
warn
delete-no-request-body
$.paths[*].delete
info
post-should-have-request-body
$.paths[*].post
warn
no-empty-descriptions
$..description
info
components-schemas-defined
$.components
warn
servers-expected-domain
Server URLs should be on the uniswap.org domain.
$.servers[*].url
warn
path-params-casing
Path parameters should be camelCase (the dominant convention in this API).
$.paths[*].parameters[?(@.in=='path')].name
warn
query-params-casing
Query parameters should be camelCase (the dominant convention in this API).
$.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
warn
schema-names-casing
Component schema names should be PascalCase (the dominant convention in this API).
$.components.schemas
info
schema-properties-casing
Schema properties should be camelCase (the dominant convention in this API).
$.components.schemas[*].properties
warn
operation-documents-400
Operations should document a 400 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-401
Operations should document a 401 response (documented on 92% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-404
Operations should document a 404 response (documented on 92% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-429
Operations should document a 429 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses
warn
operation-documents-500
Operations should document a 500 response (documented on 100% of this API's operations).
$.paths[*][get,post,put,patch,delete].responses

Spectral Ruleset

Raw ↑
# uniswap — Spectral ruleset (strengthened)
# Plain Spectral. Existing hand-authored rules preserved; measured rules added
# from this provider's own OpenAPI conventions by strengthen_ruleset.py,
# then self-validated against the spec.
#
# Provenance:
#   - servers-https-only: 100% of servers already https (error)
#   - servers-expected-domain: 2/2 servers on uniswap.org
#   - path-params-casing: camel @ 100% (n=4)
#   - query-params-casing: camel @ 69% (n=32)
#   - operationid-casing: snake @ 100% (n=48)
#   - schema-names-casing: pascal @ 79% (n=380)
#   - schema-properties-casing: camel @ 66% (n=1444)
#   - security: global (root) — NOT emitting operation-security-required
#   - operation-documents-400: 100% adherence
#   - operation-documents-401: 92% adherence
#   - operation-documents-404: 92% adherence
#   - operation-documents-429: 100% adherence
#   - operation-documents-500: 100% adherence
#   - pagination params observed: ['cursor', 'limit']
#   - merge: kept 33 existing, added 10 measured, upgraded 0
#   - added: servers-expected-domain, path-params-casing, query-params-casing, schema-names-casing, schema-properties-casing, operation-documents-400, operation-documents-401, operation-documents-404, operation-documents-429, operation-documents-500
extends:
  - spectral:oas
rules:
  info-title-required:
    message: API info title is required
    severity: error
    given: $.info
    then:
      field: title
      function: truthy
  info-description-required:
    message: API info description is required and should be meaningful
    severity: warn
    given: $.info
    then:
      field: description
      function: truthy
  info-version-required:
    message: API info version is required
    severity: error
    given: $.info
    then:
      field: version
      function: truthy
  openapi-version-3:
    message: OpenAPI version must be 3.x
    severity: error
    given: $
    then:
      field: openapi
      function: pattern
      functionOptions:
        match: ^3\.
  servers-defined:
    message: At least one server must be defined
    severity: error
    given: $
    then:
      field: servers
      function: truthy
  servers-https-only:
    message: Server URLs must use HTTPS
    severity: error
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: ^https://
  server-description-required:
    message: Server entries should have descriptions
    severity: warn
    given: $.servers[*]
    then:
      field: description
      function: truthy
  paths-no-trailing-slash:
    message: Paths must not end with a trailing slash
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: /$
  paths-no-query-strings:
    message: Query strings must not appear in path definitions
    severity: error
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        notMatch: \?
  paths-kebab-case:
    message: Path segments should use kebab-case (lowercase with hyphens)
    severity: warn
    given: $.paths[*]~
    then:
      function: pattern
      functionOptions:
        match: ^(/[a-z0-9_{}/-]+)+$
  operation-id-required:
    message: Every operation must have an operationId
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: operationId
      function: truthy
  operation-id-snake-case:
    message: operationId should use snake_case
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].operationId
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-z0-9_]*$
  operation-summary-required:
    message: Every operation must have a summary
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: summary
      function: truthy
  operation-summary-title-case:
    message: Operation summaries should use Title Case
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].summary
    then:
      function: pattern
      functionOptions:
        match: ^[A-Z]
  operation-description-required:
    message: Every operation should have a description
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: description
      function: truthy
  operation-tags-required:
    message: Every operation should have at least one tag
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options]
    then:
      field: tags
      function: truthy
  parameter-description-required:
    message: All parameters must have descriptions
    severity: warn
    given: $.paths[*][get,post,put,patch,delete,head,options].parameters[*]
    then:
      field: description
      function: truthy
  parameter-schema-required:
    message: All parameters must have a schema
    severity: error
    given: $.paths[*][get,post,put,patch,delete,head,options].parameters[*]
    then:
      field: schema
      function: truthy
  request-body-description:
    message: Request bodies should have a description
    severity: warn
    given: $.paths[*][post,put,patch].requestBody
    then:
      field: description
      function: truthy
  request-body-json-content:
    message: Request bodies should define application/json content
    severity: warn
    given: $.paths[*][post,put,patch].requestBody.content
    then:
      function: schema
      functionOptions:
        schema:
          type: object
          minProperties: 1
  response-success-required:
    message: Every operation must define at least one 2xx success response
    severity: error
    given: $.paths[*][get,post,put,patch,delete]
    then:
      field: responses
      function: schema
      functionOptions:
        schema:
          type: object
          patternProperties:
            ^2[0-9]{2}$: {}
          minProperties: 1
  response-description-required:
    message: All responses must have a description
    severity: error
    given: $.paths[*][get,post,put,patch,delete].responses[*]
    then:
      field: description
      function: truthy
  response-401-unauthorized:
    message: Authenticated APIs should define a 401 response
    severity: warn
    given: $.paths[*][post,get]
    then:
      field: responses.401
      function: truthy
  response-429-rate-limit:
    message: APIs with rate limits should define a 429 response
    severity: info
    given: $.paths[*][post,get]
    then:
      field: responses.429
      function: truthy
  schema-property-camel-case:
    message: Schema properties should use camelCase (Uniswap convention)
    severity: info
    given: $.components.schemas[*].properties[*]~
    then:
      function: pattern
      functionOptions:
        match: ^[a-z][a-zA-Z0-9]*$
  schema-type-defined:
    message: Schema objects should define a type
    severity: warn
    given: $.components.schemas[*]
    then:
      field: type
      function: truthy
  security-schemes-defined:
    message: Security schemes must be defined
    severity: error
    given: $.components
    then:
      field: securitySchemes
      function: truthy
  security-api-key-header:
    message: API key should be passed in x-api-key header (not as a query param)
    severity: error
    given: $.components.securitySchemes[*][?(@.type=='apiKey')]
    then:
      field: in
      function: enumeration
      functionOptions:
        values:
        - header
  get-no-request-body:
    message: GET operations must not have a request body
    severity: error
    given: $.paths[*].get
    then:
      field: requestBody
      function: falsy
  delete-no-request-body:
    message: DELETE operations should not have a request body
    severity: warn
    given: $.paths[*].delete
    then:
      field: requestBody
      function: falsy
  post-should-have-request-body:
    message: POST operations should typically include a request body
    severity: info
    given: $.paths[*].post
    then:
      field: requestBody
      function: truthy
  no-empty-descriptions:
    message: Descriptions must not be empty strings
    severity: warn
    given: $..description
    then:
      function: pattern
      functionOptions:
        match: .+
  components-schemas-defined:
    message: Components schemas section should be defined for reusable types
    severity: info
    given: $.components
    then:
      field: schemas
      function: truthy
  servers-expected-domain:
    description: Server URLs should be on the uniswap.org domain.
    severity: warn
    given: $.servers[*].url
    then:
      function: pattern
      functionOptions:
        match: uniswap\.org
  path-params-casing:
    description: Path parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*].parameters[?(@.in=='path')].name
    then:
      function: casing
      functionOptions:
        type: camel
  query-params-casing:
    description: Query parameters should be camelCase (the dominant convention in this API).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].parameters[?(@.in=='query')]
    then:
      field: name
      function: casing
      functionOptions:
        type: camel
  schema-names-casing:
    description: Component schema names should be PascalCase (the dominant convention in this API).
    severity: warn
    given: $.components.schemas
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[A-Z][A-Za-z0-9]*$
  schema-properties-casing:
    description: Schema properties should be camelCase (the dominant convention in this API).
    severity: info
    given: $.components.schemas[*].properties
    then:
      field: '@key'
      function: pattern
      functionOptions:
        match: ^[a-z][A-Za-z0-9]*$
  operation-documents-400:
    description: Operations should document a 400 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '400'
      function: truthy
  operation-documents-401:
    description: Operations should document a 401 response (documented on 92% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '401'
      function: truthy
  operation-documents-404:
    description: Operations should document a 404 response (documented on 92% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '404'
      function: truthy
  operation-documents-429:
    description: Operations should document a 429 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '429'
      function: truthy
  operation-documents-500:
    description: Operations should document a 500 response (documented on 100% of this API's operations).
    severity: warn
    given: $.paths[*][get,post,put,patch,delete].responses
    then:
      field: '500'
      function: truthy