@@ -30,28 +30,28 @@ public class Schema {
3030 }
3131
3232 /// The data type.
33- let type : DataType
33+ public let type : DataType
3434
3535 /// The format of the data.
36- let format : String ?
36+ public let format : String ?
3737
3838 /// A brief description of the parameter.
39- let description : String ?
39+ public let description : String ?
4040
4141 /// Indicates if the value may be null.
42- let nullable : Bool ?
42+ public let nullable : Bool ?
4343
4444 /// Possible values of the element of type ``DataType/string`` with "enum" format.
45- let enumValues : [ String ] ?
45+ public let enumValues : [ String ] ?
4646
4747 /// Schema of the elements of type ``DataType/array``.
48- let items : Schema ?
48+ public let items : Schema ?
4949
5050 /// Properties of type ``DataType/object``.
51- let properties : [ String : Schema ] ?
51+ public let properties : [ String : Schema ] ?
5252
5353 /// Required properties of type ``DataType/object``.
54- let requiredProperties : [ String ] ?
54+ public let requiredProperties : [ String ] ?
5555
5656 /// Constructs a new `Schema`.
5757 ///
@@ -74,8 +74,7 @@ public class Schema {
7474 etc., instead.
7575 """ )
7676 public convenience init ( type: DataType , format: String ? = nil , description: String ? = nil ,
77- nullable: Bool ? = nil ,
78- enumValues: [ String ] ? = nil , items: Schema ? = nil ,
77+ nullable: Bool ? = nil , enumValues: [ String ] ? = nil , items: Schema ? = nil ,
7978 properties: [ String : Schema ] ? = nil ,
8079 requiredProperties: [ String ] ? = nil ) {
8180 self . init (
@@ -91,10 +90,8 @@ public class Schema {
9190 }
9291
9392 required init ( type: DataType , format: String ? = nil , description: String ? = nil ,
94- nullable: Bool = false ,
95- enumValues: [ String ] ? = nil , items: Schema ? = nil ,
96- properties: [ String : Schema ] ? = nil ,
97- requiredProperties: [ String ] ? = nil ) {
93+ nullable: Bool = false , enumValues: [ String ] ? = nil , items: Schema ? = nil ,
94+ properties: [ String : Schema ] ? = nil , requiredProperties: [ String ] ? = nil ) {
9895 self . type = type
9996 self . format = format
10097 self . description = description
@@ -109,33 +106,36 @@ public class Schema {
109106 format: StringFormat ? = nil ) -> Schema {
110107 return self . init (
111108 type: . string,
112- format: format? . rawValue, description: description,
109+ format: format? . rawValue,
110+ description: description,
113111 nullable: nullable
114112 )
115113 }
116114
117- public static func enumeration( values: [ String ] , description: String ? , nullable: Bool ) -> Schema {
115+ public static func enumeration( values: [ String ] , description: String ? = nil ,
116+ nullable: Bool = false ) -> Schema {
118117 return self . init (
119118 type: . string,
120- format: " enum " , description: description,
119+ format: " enum " ,
120+ description: description,
121121 nullable: nullable,
122122 enumValues: values
123123 )
124124 }
125125
126- public static func double ( description: String ? = nil , nullable: Bool = false ) -> Schema {
126+ public static func float ( description: String ? = nil , nullable: Bool = false ) -> Schema {
127127 return self . init (
128128 type: . number,
129- format: " double " ,
129+ format: " float " ,
130130 description: description,
131131 nullable: nullable
132132 )
133133 }
134134
135- public static func float ( description: String ? = nil , nullable: Bool = false ) -> Schema {
135+ public static func double ( description: String ? = nil , nullable: Bool = false ) -> Schema {
136136 return self . init (
137137 type: . number,
138- format: " float " ,
138+ format: " double " ,
139139 description: description,
140140 nullable: nullable
141141 )
@@ -155,13 +155,13 @@ public class Schema {
155155 return self . init ( type: . boolean, description: description, nullable: nullable)
156156 }
157157
158- public static func array( items: Schema , description: String ? = nil , nullable: Bool = false ) -> Schema {
158+ public static func array( items: Schema , description: String ? = nil ,
159+ nullable: Bool = false ) -> Schema {
159160 return self . init ( type: . array, description: description, nullable: nullable, items: items)
160161 }
161162
162- public static func object( description: String ? = nil , nullable: Bool = false ,
163- properties: [ String : Schema ] ,
164- optionalProperties: [ String ] = [ ] ) -> Schema {
163+ public static func object( properties: [ String : Schema ] , optionalProperties: [ String ] = [ ] ,
164+ description: String ? = nil , nullable: Bool = false ) -> Schema {
165165 var requiredProperties = Set ( properties. keys)
166166 for optionalProperty in optionalProperties {
167167 guard properties. keys. contains ( optionalProperty) else {
0 commit comments