Project: KICS (Provisioning / Security & Compliance)
File: c5bb7461-aa57-470b-a714-3bc3d74f4669.md

title: Link Object OperationId Does Not Target Operation Object hide: toc: true navigation: true <style> .highlight .hll { background-color: #ff171742; } .md-content { max-width: 1100px; margin: 0 auto; } </style> Query id: c5bb7461-aa57-470b-a714-3bc3d74f4669 Query name: Link Object OperationId Does Not Target Operation Object Platform: OpenAPI Severity: <span style="color:#5bc0de">Info</span> Category: Structure and Semantics URL: Link object 'OperationId' should target an existing operation object in the OpenAPI definition<br> ```json title="Positive test num. 1 - json file" hl_lines="71" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" } } } } } } } } }, "/users/{userid}/address": { "parameters": [ { "name": "userid", "in": "path", "required": true, "description": "the user identifier, as userId", "schema": { "type": "string" } } ], "get": { "operationId": "getUserAddress", "responses": { "200": { "description": "the user's address" } } } } }, "components": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" } } } } }, "links": { "address": { "operationId": "getUser2Address", "parameters": { "userId": "$request.path.id" } } } } }, "schemas": { "Pet": { "$ref": "../models/pet.yaml" }, "User": { "$ref": "https://api.example.com/v2/openapi.yaml#/components/schemas/User" } } } } ``` ```json title="Positive test num. 2 - json file" hl_lines="28" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/test": { "get": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "format": "uuid", "type": "string" } } } } }, "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" } } ], "get": { "operationId": "getUserwAddress", "responses": { "200": { "description": "the user's address" } } } } } } ``` ```json title="Positive test num. 3 - json file" hl_lines="68" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" } } } } } } } } }, "/users/{userid}/address": { "parameters": [ { "name": "userid", "in": "path", "required": true, "description": "the user identifier, as userId", "schema": { "type": "string" } } ], "get": { "operationId": "getUserAddress", "responses": { "200": { "description": "the user's address" } } } } }, "components": { "schemas": { "Pet": { "$ref": "../models/pet.yaml" }, "User": { "$ref": "https://api.example.com/v2/openapi.yaml#/components/schemas/User" } }, "responses": { "GenericError": {

"../template-api.yaml#/components/responses/GenericError" } }, "links": { "address": { "operationId": "getUsewerAddress", "parameters": { "userId": "$request.path.id" } } } } } ``` <details><summary>Positive test num. 4 - yaml file</summary> ```yaml hl_lines="51" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: responses: "200": description: the user being returned content: application/json: schema: type: object properties: uuid: type: string format: uuid "/users/{userid}/address": parameters: name: userid in: path required: true description: the user identifier, as userId schema: type: string get: operationId: getUserAddress responses: "200": description: the user's address components: schemas: Pet: $ref: "../models/pet.yaml" User: $ref: "https://api.example.com/v2/openapi.yaml#/components/schemas/User" responses: "200": description: the user being returned content: application/json: schema: type: object properties: uuid: type: string format: uuid links: address: operationId: getUserAsddress parameters: userId: $request.path.id ``` </details> <details><summary>Positive test num. 5 - yaml file</summary> ```yaml hl_lines="21" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/test": get: responses: "200": description: the user being returned content: application/json: schema: type: object 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 get: operationId: getUserAdsssdress responses: "200": description: the user's address ``` </details> <details><summary>Positive test num. 6 - yaml file</summary> ```yaml hl_lines="43" openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: responses: "200": description: the user being returned content: application/json: schema: type: object properties: uuid: type: string format: uuid "/users/{userid}/address": parameters: name: userid in: path required: true description: the user identifier, as userId schema: type: string get: operationId: getUserAddress responses: "200": description: the user's address components: schemas: Pet: $ref: "../models/pet.yaml" User: $ref: "https://api.example.com/v2/openapi.yaml#/components/schemas/User" responses: GenericError: $ref: "../template-api.yaml#/components/responses/GenericError" links: address: operationId: getUssssserAddress parameters: userId: $request.path.id ``` </details> ```json title="Negative test num. 1 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" } } } } } } } } }, "/users/{userid}/address": { "parameters": [ { "name": "userid", "in": "path", "required": true, "description": "the user identifier, as userId", "schema": { "type": "string" } } ], "get": { "operationId": "getUserAddress", "responses": { "200": { "description": "the user's address" } } } } }, "components": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" } } } } }, "links": { "address": { "operationId": "getUserAddress", "parameters": { "userId": "$request.path.id" } } } } }, "schemas": { "Pet": { "$ref": "../models/pet.yaml" }, "User": { "$ref": "https://api.example.com/v2/openapi.yaml#/components/schemas/User" } } } } ``` ```json title="Negative test num. 2 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version":

}, "paths": { "/": { "get": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "format": "uuid", "type": "string" } } } } }, "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" } } ], "get": { "operationId": "getUserAddress", "responses": { "200": { "description": "the user's address" } } } } } } ``` ```json title="Negative test num. 3 - json file" { "openapi": "3.0.0", "info": { "title": "Simple API overview", "version": "1.0.0" }, "paths": { "/": { "get": { "responses": { "200": { "description": "the user being returned", "content": { "application/json": { "schema": { "type": "object", "properties": { "uuid": { "type": "string", "format": "uuid" } } } } } } } } }, "/users/{userid}/address": { "parameters": [ { "name": "userid", "in": "path", "required": true, "description": "the user identifier, as userId", "schema": { "type": "string" } } ], "get": { "operationId": "getUserAddress", "responses": { "200": { "description": "the user's address" } } } } }, "components": { "schemas": { "Pet": { "$ref": "../models/pet.yaml" }, "User": { "$ref": "https://api.example.com/v2/openapi.yaml#/components/schemas/User" } }, "responses": { "GenericError": { "$ref": "../template-api.yaml#/components/responses/GenericError" } }, "links": { "address": { "operationId": "getUserAddress", "parameters": { "userId": "$request.path.id" } } } } } ``` <details><summary>Negative test num. 4 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: responses: "200": description: the user being returned content: application/json: schema: type: object properties: uuid: type: string format: uuid "/users/{userid}/address": parameters: name: userid in: path required: true description: the user identifier, as userId schema: type: string get: operationId: getUserAddress responses: "200": description: the user's address components: schemas: Pet: $ref: "../models/pet.yaml" User: $ref: "https://api.example.com/v2/openapi.yaml#/components/schemas/User" responses: "200": description: the user being returned content: application/json: schema: type: object properties: uuid: type: string format: uuid links: address: operationId: getUserAddress parameters: userId: $request.path.id ``` </details> <details><summary>Negative test num. 5 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: responses: "200": description: the user being returned content: application/json: schema: type: object 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 get: operationId: getUserAddress responses: "200": description: the user's address ``` </details> <details><summary>Negative test num. 6 - yaml file</summary> ```yaml openapi: 3.0.0 info: title: Simple API overview version: 1.0.0 paths: "/": get: responses: "200": description: the user being returned content: application/json: schema: type: object properties: uuid: type: string format: uuid "/users/{userid}/address": parameters: name: userid in: path required: true description: the user identifier, as userId schema: type: string get: operationId: getUserAddress responses: "200": description: the user's address components: schemas: Pet: $ref: "../models/pet.yaml" User: $ref: "https://api.example.com/v2/openapi.yaml#/components/schemas/User" responses: GenericError: $ref: "../template-api.yaml#/components/responses/GenericError" links: address: operationId: getUserAddress parameters: userId: $request.path.id ``` </details>