datamodel-code-generator icon indicating copy to clipboard operation
datamodel-code-generator copied to clipboard

Add `requestBodies` option to `--openapi-scopes`

Open dflantz opened this issue 3 years ago • 1 comments
trafficstars

Is your feature request related to a problem? Please describe. I would like to document request bodies in OpenAPI's dedicated #/components/requestBodies section, however, it is not currently picked up by datamodel-codegen. See openapi doc on describing request bodies.

Describe the solution you'd like Add a requestBodies option to the --openapi-scopes CLI arg, and generate the objects defined therein

Describe alternatives you've considered Using the schemas section, but for large and complex API, it helps with readability to have one dedicated section to requestBodies

dflantz avatar Apr 06 '22 15:04 dflantz

Hi @dflantz --openapi-scopes paths supports parsing requestBody Could you please try it?

koxudaxi avatar Apr 16 '22 17:04 koxudaxi

@koxudaxi

datamodel-codegen: error: argument --openapi-scopes: invalid choice: 'requestBodies' (choose from 'schemas', 'paths')
datamodel-codegen --version                      
0.14.0

mayn avatar Dec 08 '22 08:12 mayn

@mayn You should do datamodel-codegen --input inputfile.yaml --openapi-scopes paths

koxudaxi avatar Dec 31 '22 16:12 koxudaxi

no response :(

koxudaxi avatar Jan 23 '23 06:01 koxudaxi