OpenAPITools / OpenAPITools/openapi-generator
[BUG][SWIFT4] Inherited enumerations are not being generated correctly
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
Whenever a definition is inheriting enumeration fields (using allOf), these end up being generated without any options.
public enum Status: String, Codable {
}
Those same enumerations are being generated correctly on the original definition.
Our spec is still using swagger 2.0.
openapi-generator version
Happening on v3.3.4. Was using swagger-codegen before and did not have this issue.
OpenAPI declaration file content or url
ParentObject:
type: object
required:
- id
- status
properties:
id:
type: string
status:
type: string
enum:
- generate
- activate
- suspend
- refund
- expire
- burn
NamedChildObject:
allOf:
- $ref: '#/definitions/ParentObject'
- type: object
properties:
name:
type: string
Using the example above, NamedObject will look like:
public struct NamedChildObject: Codable {
public enum Status: String, Codable {
}
public var _id: String
public var status: Status
public init(_id: String, status: Status) {
self._id = _id
self.status = status
}
public enum CodingKeys: String, CodingKey {
case _id = "id"
case status
}
}
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
Reproduce the issue with the supplied Swagger 2.0 declaration using openapi-generator v3.3.4, then inspect Swift 4 generation for inherited properties handled through allOf. Done when NamedChildObject.Status contains the inherited enum options while the original definition continues to generate correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100