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

Reusable parameters can't actually be reused #552

Closed
rbdixon opened this issue Mar 25, 2015 · 2 comments
Closed

Reusable parameters can't actually be reused #552

rbdixon opened this issue Mar 25, 2015 · 2 comments

Comments

@rbdixon
Copy link

rbdixon commented Mar 25, 2015

I've modified the reusableParameters.json example from the Swagger 2.0 spec. In the example the parameters limitParam and skipParam are not actually reused. I modified the example to use them again.

When I modified the example to use these parameters by simply duplicating the /pets path as /dup_pets I get the following failure:

java.lang.ClassCastException: com.wordnik.swagger.models.parameters.RefParameter cannot be cast to com.wordnik.swagger.models.parameters.BodyParameter
    at com.wordnik.swagger.codegen.DefaultCodegen.fromParameter(DefaultCodegen.java:796)
    at com.wordnik.swagger.codegen.DefaultCodegen.fromOperation(DefaultCodegen.java:688)
    at com.wordnik.swagger.codegen.DefaultGenerator.processOperation(DefaultGenerator.java:239)
    at com.wordnik.swagger.codegen.DefaultGenerator.processPaths(DefaultGenerator.java:220)
    at com.wordnik.swagger.codegen.DefaultGenerator.generate(DefaultGenerator.java:108)
    at com.wordnik.swagger.codegen.Codegen.main(Codegen.java:99)

Full example: https://gist.github.com/rbdixon/21fa977e4af15e7a0da7

I'm confused since this seems to be the purpose of having parameters refs. Where am I going wrong?

@jrcamp
Copy link

jrcamp commented Apr 1, 2015

I'm having the exact same problem. Best I can tell it's to the spec but the codegen is broken.

@fehguy
Copy link
Contributor

fehguy commented Apr 2, 2015

This is a bug. If you remove the first operation it works fine, I believe this is a problem in the parser project.

swagger-api/swagger-parser#33

@fehguy fehguy closed this as completed Apr 4, 2015
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

3 participants