Swift4: Fix issue 6746 - problem with arrays of primitives (#7072)

* Update samples using latest codegen and templates

* Fix issue 6746 - problem with array models where array element type is a primitive
This commit is contained in:
ehyche
2017-11-30 21:30:24 -05:00
committed by William Cheng
parent 8baa6779ab
commit 76d3cb5002
5 changed files with 59 additions and 1 deletions

View File

@@ -11,7 +11,7 @@ import Foundation
/** {{description}} */{{/description}}
{{#isArrayModel}}
public typealias {{classname}} = [{{arrayModelType}}]
public typealias {{classname}} = {{parent}}
{{/isArrayModel}}
{{^isArrayModel}}
{{#isEnum}}

View File

@@ -251,6 +251,28 @@
},
"description": "Example Error object"
},
"ModelStringArray": {
"type": "array",
"description": "This defines an array of strings.",
"items": {
"type": "string"
}
},
"ModelDoubleArray": {
"type": "array",
"description": "This defines an array of doubles.",
"items": {
"type": "number",
"format": "double"
}
},
"ModelErrorInfoArray": {
"type": "array",
"description": "This defines an array of ErrorInfo objects.",
"items": {
"$ref": "#/definitions/ErrorInfo"
}
},
"VariableNameTest": {
"description": "This object contains property names which we know will be different from their variable name. Examples of this include snake case property names and property names which are Swift 4 reserved words.",
"type": "object",

View File

@@ -0,0 +1,12 @@
//
// ModelDoubleArray.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** This defines an array of doubles. */
public typealias ModelDoubleArray = [Double]

View File

@@ -0,0 +1,12 @@
//
// ModelErrorInfoArray.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** This defines an array of ErrorInfo objects. */
public typealias ModelErrorInfoArray = [ErrorInfo]

View File

@@ -0,0 +1,12 @@
//
// ModelStringArray.swift
//
// Generated by swagger-codegen
// https://github.com/swagger-api/swagger-codegen
//
import Foundation
/** This defines an array of strings. */
public typealias ModelStringArray = [String]