Forum Discussion
Hello,
I understand that you want to include the requestBody in the API Gateway documentation for your SAM application. I did some research and found a possible solution for you.
you can use the x-amazon-apigateway-documentation extension in your Swagger file to add documentation content for individual API entities, such as parameters, responses, models, and authorizers. You can use this extension to specify the documentation properties for the requestBody, such as description, summary, and example. Dog Needs Best
paths:
/request:
post:
summary: A sample request
description: This is a sample request
parameters:
- name: methodRequestHeaderParam
in: header
required: true
type: string
x-amazon-apigateway-documentation:
description: This is a header parameter
summary: A header parameter
- name: methodRequestQueryParam
in: query
required: false
type: string
x-amazon-apigateway-documentation:
description: This is a query parameter
summary: A query parameter
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/LoginForm'
x-amazon-apigateway-documentation:
description: This is the request body
summary: A request body
example: |
{
"username": "user",
"password": "pass"
}
responses:
'200':
description: A successful response
x-amazon-apigateway-documentation:
description: This is a successful response
summary: A success
After adding the x-amazon-apigateway-documentation extension to your Swagger file, you need to redeploy your SAM application and check the API Gateway documentation for your API. You should be able to see the request body documentation along with the other documentation content.
I hope this helps you solve your problem. If you have any other questions, feel free to ask me.
Best Regard,
BrookE1
Related Content
- 11 months ago
Recent Discussions
- 4 days ago
- 26 days ago