OpenApiCodeGen.Client.RequestBody (openapi_codegen v0.1.0)

Generates request body AST from OpenAPI spec using the requestBody key.

Summary

Functions

Generates request body AST from OpenAPI spec using the requestBody key.

Functions

Link to this function

generate(client_module_name, spec)

Generates request body AST from OpenAPI spec using the requestBody key.

The rules for generation are as follows:

  • When the request body is of type application/json and has a $ref key, it will generate a variable with the name of the component and assign it to the variable.
  • When the request body is of type application/json and has items, it will generate a variable with the name of the component plurarized and assign it to the variable.
  • Otherwise, it will be a variable named body and will be assigned to the variable.