Inline requestBody generates incorrect resource code #1103
Labels
bug
Unexpected behaviour for functionality that either was intended to work, or has worked in the past
scala
Broadly concerning Scala code generation or the generated Scala code
scala-http4s
Pertains to guardrail-scala-http4s
This affects Guardrail version
0.64.1
and scala http server generation.It affects the following scala frameworks:
When you have an API endpoint which takes an application/json payload, and you define the payload schema inside the endpoint definition, invalid code is generated which attempts to read the fields from the payload from a
urlForm
variable which does not exist.This can be fixed by instead making the endpoint payload refer to a schema defined in the
components
section.From my understanding, there should be no difference between these two definitions in the open-api spec.
Example spec which generates valid code:
Valid handler generated for this spec:
Example spec which produces invalid code:
Example generated invalid code:
Notice that it still decodes the payload but as just raw JSON, and then it tries to extract the individual fields from
urlForm
rather than the json body it just parsed.The text was updated successfully, but these errors were encountered: