apicollective/apibuilder-generator

http4s 0.18: Server `Matchers` object calls `QueryParamDecoderMatcher` which doesn't exist

Closed this issue · 4 comments

In the server implementation, the Matchers object calls QueryParamDecoderMatcher which doesn't exist in that context. These are defined by Http4sDsl[F].

Due to this, the server code currently does not compile.

We can make Matchers a trait that extends Http4sDsl and have all the Routes extend Matchers

Also ApiVersion.apply might not want a type parameter any more.

Other issues:

  • import org.http4s.syntax.string._ not needed to get syntax to create X-Apidoc-Version-Major
  • Unauthorized(headers: _*) doesn't work - requires a WWW-Authenticate header.
  • Other response types will fail in the same way - depends on trait in https://github.com/http4s/http4s/blob/master/dsl/src/main/scala/org/http4s/dsl/impl/ResponseGenerator.scala
  • While this issue reveals an issue with apibuilder server API (not enforcing required fields), might be safer to go with MyStatus().map(_.putHeaders(headers: _*)) which works for all status types (though it won't enforce that you provide the headers that are needed).

Ooh sorry about that! Didn't notice the matcher issue when i tested :(

ApiVersion.apply currently wants the type parameter because it's in an object, but if we move to trait yes F will be defined in the trait

Ok for the .map(_.putHeaders(headers: _*)) as well