Forum Discussion

chichepo's avatar
chichepo
Champion Level 3
2 years ago

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?

No RepliesBe the first to reply