Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for header parameters to be objects #652

Closed
Sauradyuti opened this issue Apr 13, 2016 · 7 comments
Closed

Allow for header parameters to be objects #652

Sauradyuti opened this issue Apr 13, 2016 · 7 comments

Comments

@Sauradyuti
Copy link

Currently, Swagger 2.0 specifies a header parameter " is limited to simple types (that is, not an object)". Please allow header parameters to be of object type.

@ePaul
Copy link
Contributor

ePaul commented Apr 13, 2016

The simple types being allowed are those that have a simple string representation (without needing quotes or similar), and arrays of such have some ways of formatting (see collectionFormat).

How would such an object be represented? Simply one line of JSON?

@Sauradyuti
Copy link
Author

Preferably, the way it is specified for a body parameter, ie, to have a schema field.

@ePaul
Copy link
Contributor

ePaul commented Jun 26, 2016

I just found that there currently is an Internet draft discussed in the HTTP working group. This basically defines a format to transport JSON arrays (while omitting the brackets) in HTTP headers.

I guess this could work for custom headers with OpenAPI schema definitions for them.

@fehguy
Copy link
Contributor

fehguy commented Jun 26, 2016

FYI we have accepted the change to allow schemas for all payloads, please see #654

@fehguy fehguy closed this as completed Jun 26, 2016
@wparad
Copy link

wparad commented Jun 26, 2016

(RFC only applies to newly created headers, as in the format for the header must already be defined as one that is a json representation, interesting consequence for yaml and other non json body media types)

@ePaul
Copy link
Contributor

ePaul commented Jun 26, 2016

@fehguy But as I understand, there is not yet a definition which says how to serialize a JSON object/array/... into a header. My proposal was to adopt the one from the RFC, when it is done.

@wparad yes, this only applies to new headers ... I was mainly thinking about custom headers defined by an API (which would fit "newly created headers"), or new standard headers which refer to that RFC (after it is published), and then need to be described in an API definition.

This doesn't solve describing existing headers, for them we need a different solution.

@fehguy
Copy link
Contributor

fehguy commented Jun 26, 2016

@ePaul sure, but let's put that on the appropriate ticket. This one is requesting that header parameters can be objects, which is accepted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants