'OperationId' of the link object does not point to an operation object
Issue ID: v3-semantic-link-operationid-undefined
Description
The value you have defined for the operationId
property of a link
object is not an operation defined in your API. All operationId
properties must point to the operationId
of an operation
object that exists in the OpenAPI definition.
For more details, see the OpenAPI Specification.
Example
The following is an example of how this issue could look in your API definition. The operationId
in the link
object is getAddress
, but the operationId
of the operation is getUserAddress
:
{
"paths": {
"/users/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "the user identifier, as userId",
"schema": {
"type": "string",
"additionalProperties": false
}
}
],
"get": {
"responses": {
"200": {
"description": "the user being returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
},
"links": {
"address": {
"operationId": "getAddress",
"parameters": {
"userId": "$request.path.id"
}
}
}
}
}
}
},
"/users/{userid}/address": {
"parameters": [
{
"name": "userid",
"in": "path",
"required": true,
"description": "the user identifier, as userId",
"schema": {
"type": "string",
"additionalProperties": false
}
}
],
"get": {
"operationId": "getUserAddress",
"responses": {
"200": {
"description": "the user's address"
}
}
}
}
}
}
Remediation
Make sure that all operationId
properties in link
objects match the operationId
properties of the operations you want to link to.
{
"paths": {
"/users/{id}": {
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "the user identifier, as userId",
"schema": {
"type": "string",
"additionalProperties": false
}
}
],
"get": {
"responses": {
"200": {
"description": "the user being returned",
"content": {
"application/json": {
"schema": {
"type": "object",
"additionalProperties": false,
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
}
}
}
}
},
"links": {
"address": {
"operationId": "getUserAddress",
"parameters": {
"userId": "$request.path.id"
}
}
}
}
}
}
},
"/users/{userid}/address": {
"parameters": [
{
"name": "userid",
"in": "path",
"required": true,
"description": "the user identifier, as userId",
"schema": {
"type": "string",
"additionalProperties": false
}
}
],
"get": {
"operationId": "getUserAddress",
"responses": {
"200": {
"description": "the user's address"
}
}
}
}
}
}