Specifying the request body

Our Create User endpoint does not accept any parameters, but it does require a JSON payload that conforms to our User schema. Therefore, we should add a new requestBody field inside our Operation Object to define this requirement.

The value of the requestBody field should contain three fields:

  • description: A short description of the payload.
  • content(object): This specifies the valid MIME types (for example, application/jsontext/plainthat are acceptable for this endpoint, as well as the expected structure of the payload. This structure is defined under the MIME type property, under a sub-property called schema, and is very similar to the JSON schema syntax, represented as YAML.
  • required (boolean): This specifies ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.