wkennedy / swagger4spring-web

Swagger support for Spring MVC
89 stars 46 forks source link

Expose correct mapping in Response Class / Model #77

Open ryancutter opened 10 years ago

ryancutter commented 10 years ago

I integrated our Jackson2ObjectMapperFactoryBean settings with com.knappsack.swagger4springweb.util.ScalaObjectMapper to create a new MappingJackson2HttpMessageConverter. However, the Response Class / Model value is still the "un-mapped" value:

TestClass {
    someDate(Instant, optional)
}

TestClass.java's someDate is an Instant but it should become a string when mapped.

Is the model created by reflection? Is there something I can do to adjust this final value?

Thanks for such a great tool, BTW!

wkennedy commented 10 years ago

Yes, the model is created through reflection. I see what you mean about wanting to override the type for the JSON, but right now I don't know of a solution for that. It would be cool if there was some way to set that, because someone might want to represent the Instant as a date rather than a string.

SingleShot commented 10 years ago

Most uses of Java-to-JSON I have experienced require customization that reflection cannot detect. Perhaps some kind of descriptor could be provided as an alternative to reflecting on the return value and params...