Skip to content

[Question] Optional response payloads #2236

@jdegre

Description

@jdegre

Hi,
How to express in OpenAPI that a response payload is optional for a given HTTP response code?

I noticed that the keyword "required: true/false" is applicable only to Request Body Object, but not to Response Body Object.

So, if a Response Body Object has a "content" field, does it indicate that a response payload is mandatory, and receiving an empty payload is considered as not allowed?

My goal is to express that a given HTTP response (mainly error codes, 4xx, 5xx) can be sent with, or without response payload. Per RFC 7231, the presence of response payloads in these error codes is encouraged (should) but it's not really mandated.

Thanks!
/Jesús.

Metadata

Metadata

Assignees

No one assigned

    Labels

    media and encodingIssues regarding media type support and how to encode data (outside of query/path params)question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions