Skip to content

Updates to parameter and requestBody #884

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

Merged
merged 4 commits into from
Feb 22, 2017
Merged

Conversation

webron
Copy link
Member

@webron webron commented Feb 11, 2017

Summary of changes:

  • Renamed commaDelimited to simple, reference the type in the RFC and made not applicable to query. Described behavior for primitive value, added exploded example.
  • Set default style based on parameter type.
  • Explained allowEmptyValue is inapplicable if example table value is n/a.
  • Added example of free-form query parameters, made explicit typed example.
  • Added support for style to header and cookie params - only one style allowed for each.
  • Fixed anchors in Encoding Object.
  • Changed the default style of x-www-form-urlencoded to form, set behavior to be like query parameters.
  • Made contentType not required, described default values.

Note that the behavior of headeer and cookie parameters is different than what we discussed.

header

For values [ red, green, blue ]:

/test:
  get:
    parameters:
    - in: header
      name: colors
      required: true
      type: array
      style: simple
      items:
        type: string

will be colors: red,green,blue regardless of whether explode is true/false.
This is different than the discussed result of explode true represented as:
colors: colors=red&colors=green&colors=blue.

cookie

By following style being form, we get the representation of Set-Cookie: colors=red,green,blue by default, so no extra explanation needed (unlike using simple).


Open issues:

  • What would explode being true for cookie parameter will look like?
  • Many users requested that the collectionFormat by default be multi and not csv. This means that we should set explode to true for query parameters by default. It's a cumbersome explanation (if this then that, otherwise something else), but doable. Opinions welcome.

@fehguy
Copy link
Contributor

fehguy commented Feb 16, 2017

simple? Seems like that's a bit harder to figure out without cross-referencing...

@webron
Copy link
Member Author

webron commented Feb 16, 2017

Reusing the name from https://tools.ietf.org/html/rfc6570#section-3.2.2, like the other style names from there.

@fehguy
Copy link
Contributor

fehguy commented Feb 16, 2017

OK sure, but it still sucks

@webron
Copy link
Member Author

webron commented Feb 16, 2017

Alternatives welcome.

@fehguy
Copy link
Contributor

fehguy commented Feb 16, 2017

commaSeparated is a good idea... but we can follow the standard

@webron
Copy link
Member Author

webron commented Feb 16, 2017

We can discuss it tomorrow. I don't think it's a good idea because unlike in 2.0, it cannot be applied to query and formData (or requestBody now).

csv has been effectively replaced by both simple and form, depending on the situation.

@darrelmiller
Copy link
Member

Were there still open issues here? I thought we resolved everything.

@webron
Copy link
Member Author

webron commented Feb 22, 2017

Per our discussion, changed the default value of explode to true when the style is form and the rest has a default value of false. This makes the default from 2.0 be multi instead of csv.

@webron webron merged commit d78e003 into OpenAPI.next Feb 22, 2017
@webron webron deleted the parameter_requestBody branch February 22, 2017 19:13
AndersDJohnson pushed a commit to AndersDJohnson/OpenAPI-Specification that referenced this pull request Apr 8, 2019
Updates to parameter and requestBody
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

Successfully merging this pull request may close these issues.

3 participants