swagger-codegen contains a template-driven engine to generate documentation, API clients and server stubs in different languages by parsing your OpenAPI / Swagger definition.
1) Run the above command to produce swift models based off of the https://petstore.swagger.io/v2/swagger.json Open Api Specification.
2) Inspect the Order.swift model
3) The Order.swift model contains a class definition that looks like this:
public struct Order: Codable {
public enum Status: String, Codable {
case placed = "placed"
case approved = "approved"
case delivered = "delivered"
}
public var _id: Int64?
public var petId: Int64?
public var quantity: Int?
public var shipDate: Date?
/** Order Status */
public var status: Status?
public var complete: Bool?
The complete Boolean property is defined with a default value, but the default value is not set:
Description
It doesn't appear that the defaultValue variable is being generated when generating models with the language swift4.
Swagger-codegen version
2.4.0
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
1) Run the above command to produce swift models based off of the https://petstore.swagger.io/v2/swagger.json Open Api Specification. 2) Inspect the Order.swift model 3) The Order.swift model contains a class definition that looks like this:
The complete Boolean property is defined with a default value, but the default value is not set:
Related issues/PRs
Suggest a fix/enhancement
When I debug with
-DdebugModels
I see this output for the OrderClass:
But the defaultValue parameter used in the mustache file doesn't seem to exist at all:
My only guess is that the defaultValue variable is no longer used or it's not being generated for some reason?
Thank you for any insight!