-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snake case and discriminator config ignored #3904
Comments
Which JSON library are you using to perform the deserialisation? You need to configure both tapir & the JSON codec separately, see: https://tapir.softwaremill.com/en/latest/endpoint/json.html |
i am using circe. I had to make sure the
Then I also had to figure out the right import incantation such that the implicits align in just the right way to work... not sure which of these are actually needed.
|
It may be beneficial to have a documented nontrivial example of this use case of snake case + discriminator |
There's an example here on how to use discriminators: tapir/examples/src/main/scala/sttp/tapir/examples/custom_types/sealedTraitWithDiscriminator.scala Line 23 in 7f6d421
I'm currently working on having these examples better visible and discoverable :) |
As for the improts, you need the |
Tapir version: 1.10.12
Scala version: 2.13
I created a simple http post endpoint that receives a json request and produces a json response. It uses schema derivation to map the request and response to case classes.
i added implicit config to use discrinator and snake case members
‘’’
implicit val customConfiguration: Configuration =
Configuration.default.withDiscriminator(“type_discriminator”).withSnakeCaseMemberNames
‘’’
What is the problem?
The discriminator and snake case work in openapi spec generation but they are completely ignored for zio http server interpretation https://tapir.softwaremill.com/en/latest/server/ziohttp.html
How to reproduce?
Apply the implicit config to a tapir endpoint with schema/json derivation and run it in zio server interpreter.
Maybe you can provide code to reproduce the problem?
Additional information
The text was updated successfully, but these errors were encountered: