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

Extra Colon in swagger-ui for query-params #88

Closed
preoctopus opened this issue Feb 25, 2016 · 4 comments
Closed

Extra Colon in swagger-ui for query-params #88

preoctopus opened this issue Feb 25, 2016 · 4 comments

Comments

@preoctopus
Copy link

I'm working with a modified (work internal) version of liberator, so this could be part of my really weird setup.

In an attempt to get compojure-api working with liberator, I hit a weird issue.

The UI would populate, and show my required query-param field, and allow me to enter a value in it. When I clicked the "Try it out" button, my request went out with no query-params at all.

This was confirmed with the Web Inspector in Chrome.

Taking a look at the ui, I thought it was odd that the parameter type field in the UI said ":query", since the ui is mostly a java app.

The swagger.json was being generated incorrectly.

"parameters":[{"in":":query","name":"q","description":"","required":true,"type":"string"}]
@preoctopus
Copy link
Author

PR Submitted #89

@ikitommi
Copy link
Member

Thanks for the report. Will merge the PR as soon as the tests pass.

Interested in how you are doing the integration. Here is effort in getting better support for Liberator:
metosin/compojure-api#185

@preoctopus
Copy link
Author

I've updated the tests, and made the string-valued :in field to be all strings. Other places we're using strings are: :type and :format of the parameter maps.

I get the feeling to be more clojure-y it should be keywords and then convert to string when we serialize to json, but that would be more changes than this. Edit: You can use either kw or strings with this, but the json structure will have string vals.

Do keep in mind, I learned about swagger, ring-swagger and compojure-api on Tuesday, I am not confident I'm doing this correctly.

I am very interested in the Liberator compatibility, but I'm early on in figuring this out. I'll update the thread soon with anything I find out. 👍

@ikitommi
Copy link
Member

Looks good. And agree that we should use consistently strings in values. Haven't bumped into this as Cheshire generates by default JSON Strings out of keywords:

(cheshire.core/generate-string {:in :query})
; => "{\"in\":\"query\"}"

Thanks for the contribution!

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

2 participants