swagger-api / swagger-play

Apache License 2.0
330 stars 180 forks source link

Swagger-play simple usage advice required - limitations or bug? #29

Closed sundriver closed 8 years ago

sundriver commented 8 years ago

Hi there, Thanks for developing swagger-play, it is quite useful. We are using 1.3.13 version with play 2.4.4.

I have issue trying to generate correct swagger code for the following simple model. It is likely I am missing something but since I couldn't figure out what, I thought of posting it here for advice.

case class Application2( @(ApiModelProperty @field)(required=true) audit:Audit2 )

case class Audit2( @(ApiModelProperty @field)(required=true) createdAt:String )

@Api(value="/rest/applications", description="Applications") class ApplicationController extends Controller { @ApiOperation( nickname = "getApplication", produces = "application/json", response = classOf[Application2], value = "Gets an application" ) def application = Action{r=>Ok("test")} }

For the route /rest/applications above, this is producing:

Application2 { audit (object, optional) }

in other words: { "audit": {} }

Issues:

Could you please advise how these issues can be fixed. Are these bugs or limitation of swagger-play library?

Thanks, Ali

fehguy commented 8 years ago

hi @sundriver, just now (as in, within the last 10 minutes), we updated the play2 library for play 2.4 + swagger-spec 2.0. Can you please take a look at the sample here:

scala-play2.4

which leverages this new library implementation:

swagger-play2

sundriver commented 8 years ago

This is perfect, thanks guys, all working now. I am closing the issue