Closed hamir-suspect closed 1 month ago
The library was initially implemented with all params merged into conn.params
as per the docs. Unfortunately it is problematic with struct based body schemas.
If your body schema is a struct, the adding additional query params creates a struct with undeclared fields set. It technically works since structs are just maps, but it is confusing and may cause type errors in future elixir versions.
According to Plug documentation
conn.params
isWhen using
OpenApiSpex.Plug.CastAndValidate
plug the params will overwrite only with params from:path | :query | :header | :cookie
meaning that there is never parameters fromrequest_body
there.This should be clearly stated in
CastAndValidate
plug like it is for cast plug as it can cause some confusion.