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

json array support for collectionFormat #437

Closed
dtorok opened this issue Aug 10, 2015 · 4 comments
Closed

json array support for collectionFormat #437

dtorok opened this issue Aug 10, 2015 · 4 comments

Comments

@dtorok
Copy link

dtorok commented Aug 10, 2015

The spec lists several possible formats in the collectionFormat field for an array parameter.
My suggestion is to include json too because

  • we use json everywhere, no need to introduce a new serialization format here
  • json serializer is there already on both the client and server side
  • it's as simple as csv (2 more bytes)

The swagger fragment would look like this:

        - name: id__in
          in: query
          required: false
          type: array
          collectionFormat: json
          items:
            type: integer
            format: int64

The URL would look like this:

https://example.com/api/users/?id__in=[1,2,3]
@mohsen1
Copy link
Contributor

mohsen1 commented Aug 10, 2015

Are you proposing that items can be any JSON Schema also?

@webron
Copy link
Member

webron commented Aug 10, 2015

We actually considered adding support for it around 2.0, but a substantial set of libraries that actually support this format.

@jharmn
Copy link
Contributor

jharmn commented Feb 12, 2016

Link to parent #565

@fehguy
Copy link
Contributor

fehguy commented Feb 1, 2017

This has been added by #804

@fehguy fehguy closed this as completed Feb 1, 2017
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

5 participants