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

Array query params #34

Open
mmcc opened this issue Jul 13, 2017 · 5 comments
Open

Array query params #34

mmcc opened this issue Jul 13, 2017 · 5 comments

Comments

@mmcc
Copy link

mmcc commented Jul 13, 2017

I'm going to preface this by saying I don't think this is supported by API Blueprint right now, but I figured it could be useful as work continues on Swagger support.

Currently, the support for array params is pretty broken. Our query params that are arrays follow the standard Phoenix syntax, foo[]=1&foo[]=21. As far as I can tell, there's currently no way to describe this in the api macro (but again, I think that's a problem all the way down to API Blueprint).

We've ended up going with just using a string for the name and setting it to param[] so it at least shows up correctly in the URI Parameter list, but unfortunately, this means that the params won't get picked up by the ConnLogger. Not a huge deal on our end, I think this solution gets us close enough, but it'd be cool to find a solution for this long term.

@woylie
Copy link
Member

woylie commented Jul 14, 2017

Here is a more recent proposal to add support to the Blueprint format. Swagger on the other hand supports array params. We should define a syntax for defining them in BlueBird and figure out a workaround for the apib output.

@mmcc
Copy link
Author

mmcc commented Jul 14, 2017

Yeah, I think I saw that proposal when I was digging into it but seems like that one's pretty dead on the vine. I agree, feels like step one is just to make this work well with Swagger output and then work backward to a reasonable apib solution if/until the proposal makes it in.

@gonzag88
Copy link

@mmcc Could you post an example of how you've ended up going using a string for the name?

Thanks!

@woylie
Copy link
Member

woylie commented Jul 25, 2017

@gonzag88 I think he just did something like this:

parameter "foo[]", :string, [description: "some description"]

@mmcc
Copy link
Author

mmcc commented Jul 25, 2017

@gonzag88 Yep, @woylie hit the nail on the head, but as I mentioned that was a pretty half-baked solution. I think what we've actually ended up doing is using the param without the brackets and then using good ol' sed to search/replace in the html output of Aglio 😬

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

No branches or pull requests

3 participants