softwaremill / softwaremill/tapir

Snake case and discriminator config ignored

Open
#3,904 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.5k
Forks
468
Avg merge
5h 37m
Merged PRs (30d)
34

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the schema- and JSON-derived endpoint with the supplied Scala Configuration and the ZIO HTTP server interpreter. Compare the generated OpenAPI behavior with request decoding and response encoding; done means the discriminator and snake_case member configuration are honored by the server interpreter as well.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.