softwaremill / softwaremill/tapir

[BUG] mapping is sometimes lost in schema generation

Open
#3,928 0 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.14

Describe the bug

Mapping for coproduct schemas is for some reason lost during the generation while oneOf contains proper ref
eg.

    Nodes_WrappedString:
      title: Nodes_WrappedString
      oneOf:
      - $ref: '#/components/schemas/Node_WrappedString'
      discriminator:
        propertyName: type
        mapping:
          Node: Defs.Node

How to reproduce?
https://scastie.scala-lang.org/anwau101QxK0XfOZ8TeK9w

Additional information
context:
https://softwaremill.community/t/custom-recursive-schemas/419/4

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 with the linked Scastie reproduction and compare the generated coproduct schema with the expected YAML, focusing on the discriminator mapping and its oneOf reference. Read the surrounding schema-generation behavior and the linked custom recursive schemas discussion. Done means the mapping is preserved during generation while the existing oneOf reference remains correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, scala
Domain
api, backend-api-design
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.