oav icon indicating copy to clipboard operation
oav copied to clipboard

Missing Required 'ID' during example generation

Open jjdharini22 opened this issue 3 years ago • 1 comments

Hello, I am trying to use OAV to generate swagger json examples. I noticed that it generates two sets of examples - MaximumSet_Gen and MinimumSet_Gen. During the example validation, it complains that id is missing in the response of Get/Put resource operations. I believe id is not required. https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#response-object

Another question is, can we choose to not generate two sets of example jsons?

{ code: 'MISSING_RESOURCE_ID', message: 'id is required to return in response of GET/PUT resource calls but not being provided', schemaUrl: <redacted>.json', exampleUrl: '<redacted>_MinimumSet_Gen.json', schemaPosition: { line: 3282, column: 46 }, schemaJsonPath: '#/x-ms-azure-resource', examplePosition: { line: 22, column: 15 }, exampleJsonPath: '$responses.201.body', severity: 0, source: 'response', operationId: 'XXX_CreateOrUpdate', level: 'error', }

jjdharini22 avatar Oct 18 '22 21:10 jjdharini22

hi @jjdharini22 , can you check if your swagger contains "x-ms-azure-resource": true? From the description of MISSING_RESOURCE_ID, id is required when the resource is annotated as x-ms-azure-resource: true

ankhyk avatar Dec 06 '22 06:12 ankhyk