Skip to content

enum values aren't exposed in swagger json #118

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
taybin opened this issue Jul 14, 2014 · 9 comments
Closed

enum values aren't exposed in swagger json #118

taybin opened this issue Jul 14, 2014 · 9 comments
Labels

Comments

@taybin
Copy link
Contributor

taybin commented Jul 14, 2014

params
  requires :foo_type, type: String, values: ["A", "B", "C", "D"], default: "C"
end

results in

<parameter>
  <paramType>form</paramType>
  <name>foo_type</name>
  <description nil="true"/>
  <type>string</type>
  <required type="boolean">true</required>
  <allowMultiple type="boolean">false</allowMultiple>
</parameter>

It would be nice if this used defaultValue and enum from the swagger spec.

@dblock
Copy link
Member

dblock commented Jul 14, 2014

Can you please check against HEAD, I believe this has been fixed by https://github.com/tim-vandecasteele/grape-swagger/pull/87.

@dblock dblock added the bug? label Jul 14, 2014
@taybin
Copy link
Contributor Author

taybin commented Jul 15, 2014

Just checked. defaultValue is fixed, but not enum.

@taybin taybin changed the title values, default param options aren't exposed in swagger json enum values aren't exposed in swagger json Jul 15, 2014
@dblock
Copy link
Member

dblock commented Jul 15, 2014

Ok, would be helpful if you could PR a test (and maybe a fix :)) that reproduces this. Thanks.

@taybin
Copy link
Contributor Author

taybin commented Jul 15, 2014

Happy to, but I'll need to refactor form_params_spec.rb first. The single test for all of the generated JSON isn't granular enough for good testing. If something in there fails, you can't tell what went wrong without a difficult string comparison. Much better to break it up into smaller assertions.

@dblock
Copy link
Member

dblock commented Jul 16, 2014

Totally agree.

@antek-drzewiecki
Copy link
Contributor

#132 Might fix this. Take a look.

@taybin
Copy link
Contributor Author

taybin commented Jul 30, 2014

Looks like this is fixed by #132. Haven't tested it yet though.

@dblock
Copy link
Member

dblock commented Jul 30, 2014

I am going to close this, please reopen bugs if #132 is not it.

@dblock dblock closed this as completed Jul 30, 2014
@taybin
Copy link
Contributor Author

taybin commented Jul 30, 2014

Verified that it's working. Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants