extends: ["spectral:oas"] documentationUrl: https://docs.countrystatecity.in/api/introduction rules: csc-info-title: description: API title must mention Country State City. given: "$.info.title" severity: error then: function: pattern functionOptions: match: "Country State City" csc-server-base-url: description: Servers must reference https://api.countrystatecity.in/v1. given: "$.servers[*].url" severity: warn then: function: pattern functionOptions: match: "api.countrystatecity.in" csc-api-key-security: description: Spec must define an X-CSCAPI-KEY API key security scheme. given: "$.components.securitySchemes" severity: error then: field: ApiKeyAuth function: truthy csc-global-security: description: API must apply the API key security globally. given: "$" severity: warn then: field: security function: truthy csc-operation-id: description: Every operation must define an operationId. given: "$.paths.*.get" severity: error then: field: operationId function: truthy csc-operation-tags: description: Every operation must define at least one tag. given: "$.paths.*.get" severity: error then: field: tags function: truthy csc-401-response: description: All authenticated operations should document a 401 response. given: "$.paths.*.get.responses" severity: warn then: field: '401' function: truthy