When I am trying to access the requestBody it is giving me error cannot access undefined.
Then I checked by printing the req.swagger.params it looked like this:
{ _id:
{ path: '/v0/users/config/{_id}',
schema: [Object],
originalValue: '123',
value: '123' },
undefined:
{ path: '/v0/users/config/{_id}',
schema: [Object],
originalValue: [Object],
value: [Object] } }
Not able to understand the reason of requestBody coming in undefined key name.
How do I access the requestBody now?
I found the solution posting the solution for other people who face the same issue. Its not mentioned in its documentation.
requestBody:
x-name: body
content:
application/json:
schema:
required:
- name
properties:
name:
type: array
items:
type: string
description: Updated name of the pet
status:
type: string
description: Updated status of the pet
We have to mention the name of requestBody in x-name