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

Proposal: dotDelimited style for query serialization. #3084

Open
maarlo opened this issue Nov 29, 2022 · 9 comments
Open

Proposal: dotDelimited style for query serialization. #3084

maarlo opened this issue Nov 29, 2022 · 9 comments
Labels
param serialization Issues related to parameter and/or header serialization

Comments

@maarlo
Copy link

maarlo commented Nov 29, 2022

Regarding [ and ] must be urlencoded, I propose the usage of dot notation to serialize arrays and objects at query parameters.

Having the following array:

{
  "x": ["b","d","f"]
}

It could be serailized as:

?x.0=b&x.1=d&x.2=f 

Having the following object:

{
  "x": {
    "a": "b",
    "c": "d",
    "e": "f"
  }
}

It could be serailized as

?x.a=b&x.c=d&x.e=f

And mixing both of them:

{
  "x": [
    {
      "a": "b"
    },
    {
      "a": "d"
    }
  ]
}

It could be serailized as

?x.0.a=b&x.1.a=d
@jeremyfiel
Copy link

you can find serialization examples here, multiple types are supported

https://spec.openapis.org/oas/v3.0.3#fixed-fields-9

@maarlo
Copy link
Author

maarlo commented Jan 20, 2023

Yes, but the proposed style is not defined.

@handrews handrews added the param serialization Issues related to parameter and/or header serialization label Jan 27, 2024
@handrews
Copy link
Contributor

@OAI/tsc review request: Can we decide whether to add this or not? My sense is that we don't want to add further serialization options/complexity, but if we do it is straightforward. This issue has been open for a year and a half without attracting further support or examples of usage in existing APIs.

@karenetheridge
Copy link
Contributor

Previous serialization styles have been defined in terms of uri-template syntax (although only the swagger documentation -- https://swagger.io/docs/specification/serialization/ -- explicitly provides those templates - it's not even at https://learn.openapis.org/specification/parameters.html).

If we want to restrict ourselves to this, is it possible to define the newly proposed dotDelimited format in terms of uri-templates?

@maarlo
Copy link
Author

maarlo commented Apr 29, 2024

I think so, just like happens with deepObject, but instead of using brackets using points, and with the addition of also allowing the serialization of deep objects and arrays.

@ralfhandl
Copy link
Contributor

is it possible to define the newly proposed dotDelimited format in terms of uri-templates?

I couldn't find anything in RFC6570

@handrews
Copy link
Contributor

I'm leaning towards advocating that we support #1502 (Support for arbitrary query strings) in 3.2, which could allow folks to experiment with new/custom serializations without us having to add more complexity to the mandatory options.

@mikekistler
Copy link
Contributor

The sense I have gotten from recent discussions in the TDC meetings is that there is already too much undefined behavior in the query string, and there are efforts to correct this (which I am nominally part of). Doesn't this only make the problem worse?

@handrews
Copy link
Contributor

handrews commented May 9, 2024

In today's TDC call, we decided to consider a proposal for #1502, which will allow experimentation in the query string. So it will not solve this but it will allow extensions to try it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
param serialization Issues related to parameter and/or header serialization
Projects
None yet
Development

No branches or pull requests

6 participants