wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

Generated api has an Option field instantiated as null #62

Open TimSoethout opened 10 years ago

TimSoethout commented 10 years ago

When using the ApiParserImpl's createApiListings() method to generated the swagger model, the deprecated field inside the operations of the apis, which is of type Option[String] has a value of null, which causes the swagger json serializer to crash.

I was able to fix it using the following code, but I think the null should not have been there in the first place.

val fixedApis = apis.map(api => api.copy(operations = api.operations.map(operation => operation.copy(deprecated = Option(operation.deprecated).flatten))))