operation-operationId
Operation must have "operationId".
- Applies to
operationId- Selects
#OperationObject- Function
truthy- Specs
- OpenAPI 2.0OpenAPI 3.0OpenAPI 3.1OpenAPI 3.2
Use it
This rule ships with OpenLint in spectral:oas. Extending the ruleset turns it on:
extends: spectral:oas
rules:
operation-operationId: warn # or off, or another severity
Definition
As defined in @openlint/openlint-rulesets. Functions show by name.
operation-operationId:
description: Operation must have "operationId".
recommended: true
given: '#OperationObject'
then:
field: operationId
function: truthy
About this rule
This operation ID is essentially a reference for the operation, which can be used to visually suggest a connection to other operations. This is like some theoretical static HATEOAS-style referencing, but it’s also used for the URL in some documentation systems.
Make the value lower-hyphen-case, and try and think of a name for the action which does not relate to the HTTP message. Base it off the actual action being performed. create-polygon? search-by-polygon? filter-companies?