extends: - spectral:oas # Spectral linting rules for CoinGecko APIs (Crypto Market Data, Pro, # Onchain DEX). Tuned to api.coingecko.com / pro-api.coingecko.com host # conventions, x-cg-demo-api-key / x-cg-pro-api-key auth headers, and # the /api/v3 versioned URI prefix. rules: coingecko-info-contact: description: API contact information must be present. severity: error given: "$.info" then: field: contact function: truthy coingecko-server-https: description: All server URLs must use HTTPS. severity: error given: "$.servers[*].url" then: function: pattern functionOptions: match: "^https://" coingecko-server-host: description: Server URLs must reference a CoinGecko host. severity: warn given: "$.servers[*].url" then: function: pattern functionOptions: match: "(api\\.coingecko\\.com|pro-api\\.coingecko\\.com)" coingecko-versioned-path: description: Server URLs should expose /api/v3 versioning. severity: info given: "$.servers[*].url" then: function: pattern functionOptions: match: "/api/v3" coingecko-api-key-header: description: Authenticated APIs should use x-cg-demo-api-key or x-cg-pro-api-key. severity: warn given: "$.components.securitySchemes[*]" then: function: schema functionOptions: schema: type: object properties: type: const: apiKey in: const: header name: enum: - x-cg-demo-api-key - x-cg-pro-api-key coingecko-operation-id: description: Every operation must declare a unique operationId. severity: error given: "$.paths[*][get,post,put,patch,delete]" then: field: operationId function: truthy coingecko-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 coingecko-operation-summary: description: Operations should declare a summary. severity: warn given: "$.paths[*][get,post,put,patch,delete]" then: field: summary function: truthy coingecko-error-responses: description: GET operations should declare 401 and 429 error responses. severity: warn given: "$.paths[*].get.responses" then: function: schema functionOptions: schema: type: object anyOf: - required: ["401"] - required: ["429"] coingecko-currency-param: description: Pricing endpoints should accept vs_currency or vs_currencies. severity: info given: "$.paths[*].get.parameters[?(@.in == 'query')]" then: field: name function: enumeration functionOptions: values: - vs_currency - vs_currencies - ids - id - contract_address - addresses - days - precision - per_page - page - order - category