http4s generator does not handle non-string headers #155
Labels
bug
Unexpected behaviour for functionality that either was intended to work, or has worked in the past
good first issue
Does not require deep knowledge of the codebase and is easily testable
help wanted
Easy to moderately difficult issues that don't require deep knowledge or architectural thought
scala-http4s
Pertains to guardrail-scala-http4s
Related to #150
Currently, server headers are handled as:
... resulting in attempting to parse the JSON literal
"false"
as aBoolean
, which can never be true. This is related to a similar issue in the akka-http generator, whereX-Header: ""
will be silently converted to an empty string, as circeDecoder
s are used similar toparser.parse(str).orElse(Json.fromString(str)).flatMap(_.as[Boolean])
to attempt to decode all possiblex-scala-type
overrides.I believe the most effective way to disambiguate this usecase is to alter
headersToHttp4s
(and likelyformToHttp4s
, and any other placeJson.fromString
is used) by adding an additional parameter to each case indirectivesFromParams
,baseType: Type.Name
, to explicitly handleString
decoders vs other JSON literal values.Test swagger spec:
The text was updated successfully, but these errors were encountered: