Spectral linting rules defining API design standards and conventions for Gravitee.
9 Ruleserror 5warn 3
Rules by declared severity: the level each rule assigns to a violation. These are not lint results.
Authorship not recorded
No authorship marker is recorded for this file. It is not presented as the provider's; it was most likely written by an API Evangelist pass before outputs were stamped.
extends: [[spectral:oas, recommended]]
documentationUrl: https://documentation.gravitee.io/apim
rules:
# Gravitee operationIds follow camelCase verb-noun (e.g. listApis, createApi, deployApi)
gravitee-operation-id-camelcase:
description: Operation IDs MUST use camelCase verb-noun form (listApis, createApi, deployApi).
message: "{{property}} must use camelCase verb-noun (e.g. listApis)"
severity: error
given: "$.paths.*[get,post,put,patch,delete].operationId"
then:
function: pattern
functionOptions:
match: "^[a-z][a-zA-Z0-9]*$"
gravitee-operation-id-verb-prefix:
description: Operation IDs SHOULD start with an action verb.
message: "{{property}} should start with a verb (list, get, create, update, delete, deploy, start, stop, accept, reject, publish, close, search, import, query)"
severity: warn
given: "$.paths.*[get,post,put,patch,delete].operationId"
then:
function: pattern
functionOptions:
match: "^(list|get|create|update|delete|deploy|start|stop|accept|reject|publish|close|search|import|query|find|add|remove|verify|patch|put|post|resolve|transfer)[A-Z]"
gravitee-summary-title-case:
description: Operation summaries MUST be Title Case.
message: "Operation summary must use Title Case"
severity: error
given: "$.paths.*[get,post,put,patch,delete].summary"
then:
function: pattern
functionOptions:
match: "^[A-Z][a-zA-Z0-9]*( [a-zA-Z0-9\\-/'()]+)*$"
gravitee-tag-defined:
description: Operations MUST have at least one tag from the published tag list.
severity: error
given: "$.paths.*[get,post,put,patch,delete]"
then:
field: tags
function: truthy
gravitee-security-required:
description: All operations MUST declare security (Bearer, Basic, or Cookie); public endpoints must explicitly set security to an empty array.
severity: error
given: "$"
then:
field: security
function: truthy
gravitee-server-versioned:
description: Servers MUST reference the /management/v2 base URL.
severity: warn
given: "$.servers[*].url"
then:
function: pattern
functionOptions:
match: "/management/v\\d+"
gravitee-environment-path-parameter:
description: Environment-scoped paths MUST take envId as a path parameter.
severity: warn
given: "$.paths[?(@property.match(/^\\/environments\\/\\{envId\\}/))]"
then:
function: truthy
gravitee-no-trailing-slash:
description: Paths MUST NOT end with a trailing slash (except the root path).
severity: error
given: "$.paths"
then:
function: pattern
functionOptions:
match: "^(?!.*\\/$|^\\/$).*"
gravitee-action-paths-use-underscore-prefix:
description: Imperative action paths SHOULD use the _verb convention (_deploy, _start, _stop, _publish, _close, _accept, _reject, _search, _import, _verify, _process).
severity: hint
given: "$.paths"
then:
function: pattern
functionOptions:
match: "^\\/.*(\\/_[a-z]+)?$"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
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. By signing up you are subscribing to the APIs.io and API Evangelist
newsletters — you can unsubscribe from any issue. See our
Privacy Policy and Terms.