OpenAPITools / OpenAPITools/openapi-generator

[BUG] scala-cask generates invalid enum entries

Open
#20,214 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Description

When generating enums there are several problems.

  1. Unlike all the other code this appears to try to use the braceless syntax, but fails as the case statements are not correctly indented. I suspect it would be much simpler to use braces rather that trying to force the indentation levels in the mustache templates

  2. A Scala 3 enum should be of the form:-

   enum derives RW {
      case a,b,c,d
      }

rather than having multiple cases. Also the cases in my case(s) ended up as integers, scala requires identifiers

  1. Although the use of derives RW seems to work elsewhere, when used with enums it gets an is imported twice on the same import line.
openapi-generator version

7.10

Contributor guide

Open the contributing guide

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 Scala 3 enum output from the scala-cask generator using the reported OpenAPI Generator 7.10 setup. Inspect the mustache templates and generated imports for enum indentation, case identifiers, enum syntax, and duplicate derives RW imports. Done means the generated Scala compiles and produces valid enums with correct imports.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.