Ask a Question

Post method with empty requestBody

chichepo
Contributor

Post method with empty requestBody

Hello the community

 

I would like to pick up where this thread left off.

In a Post request, if I don't need any payload in the requestBody ( For example, my inputs are sent within the path or the headers, I would define it as following:

 

requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EmptyBody'
# # # # # # 
     EmptyBody:
          type: object
          nullable: true
          additionalProperties: false

 

 

The idea with additionalProperties: true is that it should comply with data security rules (further details here).

What do you think, folks?

0 REPLIES 0
cancel
Showing results for 
Search instead for 
Did you mean: