Request body guidelines
- Last Updated: December 23, 2025
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Request bodies define the structure and content of data sent to an API operation. Properly specifying request bodies ensures accurate input validation, clear contracts, and better reuse of schemas. This section provides best practices for defining request bodies in your OpenAPI specification.
Key recommendations
The following recommendations help you define request bodies clearly and consistently in your
OpenAPI specification:
- Always specify
contentasapplication/json(or other media types) with a schema reference. - Use a top-level object schema instead of inline anonymous structures. This approach allows reuse and better naming.
- Indicate optional versus required fields using the
requiredarray. Do not rely solely on description text. - If using arrays, fully specify the
itemsschema, includingtype,$ref, anddescription. - Provide field-level
descriptionfor non-obvious semantics or constraints.
Example of a well-defined request body
The following example demonstrates how to define a request body and responses for creating a
new customer:
|