OpenAPITools / OpenAPITools/openapi-generator
[BUG][Scala][scala-sttp] Schema with enums as reserved "names" get a bad variable name
Open
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 I generate a client for this schema (using circe for json library):
PaginationInfo:
type: object
properties:
type:
type: string
enum:
- foo
- bar
I get the following variable names for the JSON decoders and encoders:
implicit val PaginationInfo`Type`Decoder: Decoder[PaginationInfoEnums.`Type`] = Decoder.decodeEnumeration(PaginationInfoEnums.`Type`)
implicit val PaginationInfo`Type`Encoder: Encoder[PaginationInfoEnums.`Type`] = Encoder.encodeEnumeration(PaginationInfoEnums.`Type`)
Causing a compilcation error
openapi-generator version
5.4.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the provided PaginationInfo schema with the scala-sttp generator and circe, then trace how enum properties such as the reserved name "type" become decoder and encoder variable names. Done means the generated Scala identifiers are valid and the generated client compiles without the shown error.
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
- 42/100