Rswag: [Feature Request] Support for requestBody being required

Created on 2 Jul 2020  路  3Comments  路  Source: rswag/rswag

Problem

Open API 3.x adds support for requestBody to be required. By default, it is optional. Currently, rswag doesn't have the option to declare the request body as mandatory.

Proposed Solution

Add support for a required key to the parameter method. If the parameter is in: :body, the required boolean will be respected. E.g.

parameter name: :order, in: :body, required: true, schema: { '$ref' => '#/components/schemas/order' }

I believe modifying this method should be enough to get it done. I'd be happy to open up a PR once the team okays the approach.

Most helpful comment

Addressed in: #342

All 3 comments

Let me know what you think @BookOfGreg! Shouldn't be too tough to knock this out quickly.

Addressed in: #342

+1 for this!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kutomore picture Kutomore  路  3Comments

eric-hemasystems picture eric-hemasystems  路  3Comments

salzig picture salzig  路  5Comments

hannesstruss picture hannesstruss  路  6Comments

zlesnr picture zlesnr  路  4Comments