OpenAPITools / OpenAPITools/openapi-generator
[BUG] [scala-pekko] Array of enums fails to generate valid code
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
https://github.com/OpenAPITools/openapi-generator/commit/72e942f81b2636ce69bfe32018de0ccb26bb1bd3 fix was applied for sttp generator. Same problem still occures with scala-pekko.
Tried with all the recent versions and 3.0.4, same issue occures
OpenAPI declaration file content or url
type: object
required:
- id
properties:
id:
type: string
format: uuid
categoryKey:
type: string
templateKey:
type: string
stateFilters:
type: array
items:
type: string
enum:
- state_new
- state_pending
- state_approved
- state_rejected
- state_archived
This generates invalid class where with typing
case class ConditionalActionGenericForIssue (
id: UUID,
categoryKey: Option[String] = None,
templateKey: Option[String] = None,
stateFilters: Option[ConditionalActionGenericForIssueEnums.Seq[StateFilters]] = None
) extends ApiModel
object ConditionalActionGenericForIssueEnums {
type Seq[StateFilters] = Seq[StateFilters].Value
object Seq[StateFilters] extends Enumeration {
}
}
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 with the scala-pekko generator and compare its array-of-enums handling with the referenced sttp fix. Reproduce the issue using the YAML declaration in the report; done when the generated Scala code is valid and represents stateFilters as an array of enum values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100