http4s / rho

A self documenting DSL built on http4s
Other
295 stars 65 forks source link

Provide extension point to add custom data type transformations for Swagger #26

Open arouel opened 10 years ago

arouel commented 10 years ago

After juggling around with JSON HAL and Swagger I think we need an extension point in SwaggerSupport to be able to add custom transformations for data types. The signature could be A <: AnyRef => ModelProperty or PartialFunction[A <: AnyRef, ModelProperty].

I think it should basically work as the serializers in Json4s. Maybe we can borrow some code there. Opinions?

bryce-anderson commented 10 years ago

The broad concept seems pretty reasonable. The idea is to allow for manually defined data types, right?

arouel commented 10 years ago

Exactly, I think here about common and custom data types. For example I wanna maintain in my own project org.joda.time.DataTime and some own algebraic data type. At the moment we only support case classes by default but this is too restricted for my use case.

bryce-anderson commented 9 years ago

I implemented the entry point for the custom serializers with commit 085792b02186a18aa6313f006330296e659acfc4. I'm not certain how I feel about it right now, but I'm having trouble coming up with a better, workable alternative.

arouel commented 9 years ago

I like it. Maybe we use it in an example with JSON HAL and look how it works.