[BUG] Composed properties are missing from allVars
Created by: glennschmidt
Description
When a model includes properties by composition (allOf
, without a discriminator), these properties end up in the vars
template variable but they are missing from the allVars
variable.
I would expect allVars
to include, at minimum, everything in vars
. Some generators only iterate allVars
when producing a model class, so they will be missing these composed properties.
openapi-generator version
4.1.0
OpenAPI declaration file content or url
https://gist.github.com/glennschmidt/d5e87fe518ac5afc7c39032ae1df479e
Command line used for generation
openapi-generator generate -i openapi.json -g swift4 -o apigen
Steps to reproduce
- Execute the above CLI with the schema from the linked gist
- Look at the generated output
apigen/OpenAPIClient/Classes/OpenAPIs/Models/EventCollection.swift
It will contain
public struct EventCollection: Codable {
public init() {
}
}
ie. The EventCollection model has no properties, but it should have
- page
- page_count
- page_size
- total_items
- events
Suggest a fix
In DefaultCodegen.fromModel()
, when adding composed properties to properties
, also add them to allProperties
(i will submit a PR with this).