make consumes/produces use Akka Http ContentType or MediaType

Issue #2 new
Former user created an issue

https://bitbucket.org/jtownson/swakka/src/6a884bdb58d707ff5c8cf6e9b13cea4e3e333b85/library/src/main/scala/net/jtownson/swakka/openapimodel/OpenApi.scala?at=master&fileviewer=file-view-default

For type safety, it would be nice not to use raw strings for the content types in 'consumes' and 'produces'.

Likewise, schemes could be strongly typed too.

Comments (3)

  1. Jeremy Townson repo owner

    Yes, I take your point. The reason I originally used strings comes from my frustration at intellij's refusal to auto-complete the Akka-Http media types (application-json etc). I did not want swakka's users to face similar pain. Maybe there is an approach that retains type safety and keeps intellij ticking over.

  2. pjfanning

    Thanks for the quick response. I haven't had too much trouble with IntelliJ and its autocomplete for ContentTypes. I have the latest Community Edition and just recently refactored a fair amount of akka-http code. Great project btw. I maintain the swagger-akka-http project but I do like your approach.

  3. Jeremy Townson repo owner

    Cheers, appreciate the feedback. I will have a play around using the Akka-Http media types in place of Strings. If I don't commit anything immediately it's because I am letting feedback filter in after I did a v0.5 release yesterday.

  4. Log in to comment