@QueryParam using custom class returns Error: Operation Parameter

92 views
Skip to first unread message

satheesh kumar

unread,
Apr 17, 2014, 12:53:09 PM4/17/14
to swagger-sw...@googlegroups.com
Hi,

I'm using a custom class as a query parameter.

public Track getTrackInJSON(@QueryParam(value = "track") String track,
            @QueryParam(value = "sk") SiteParam sk) {
..
}

I'm trying to generate java client codegen for this api.

>scala -cp target/scala-2.10/swagger-codegen.jar samples/client/test/java/MyCodegen.scala http://localhost:10900/test/api/api-docs special-key

When I run the above command, I get the following error

Error: Operation Parameter - StoreApi.getTrackInJSON(query_sk: SiteParam) | Invalid SiteParam. Best guess: SiteParam

Can anyone help me with this?





tony tam

unread,
Apr 17, 2014, 1:34:11 PM4/17/14
to swagger-sw...@googlegroups.com
Can you please confirm that there is a SiteParam model in your json?

satheesh kumar

unread,
Apr 17, 2014, 3:34:49 PM4/17/14
to swagger-sw...@googlegroups.com
Hi Tony,

You mean whether I have a json file describing the SiteParam class? If so I don't have it.

Do you want me to describe my SiteParam like given in this example?
https://github.com/wordnik/swagger-node-express/blob/master/Apps/petstore/models.js

Where should I put model.js in my war file? Under js folder?

satheesh kumar

unread,
Apr 18, 2014, 11:29:22 AM4/18/14
to swagger-sw...@googlegroups.com
I was able to fix this issue by writing a custom filter class implementing SwaggerSpecFilter and adding @ApiParam(access = "internal").
Reply all
Reply to author
Forward
0 new messages