File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,14 +204,14 @@ public function generateSchemaForPrimitiveType(
204204 $ defaultValue ,
205205 bool $ isIterable ): Schema
206206 {
207- $ type = $ this ->canonizePrimitiveType ($ typeSpecification );
207+ $ type = $ this ->canonizePrimitiveType ($ typeSpecification, $ additionalTypeProperties );
208208
209209 if ($ isIterable ) {
210210 $ schema = new Schema ([
211211 'type ' => 'array ' ,
212212 'items ' => new Items ([
213213 'type ' => $ type ,
214- ])
214+ ] + $ additionalTypeProperties )
215215 ]);
216216
217217 if (is_array ($ defaultValue ) && !empty ($ defaultValue )) {
@@ -221,7 +221,7 @@ public function generateSchemaForPrimitiveType(
221221 } else {
222222 $ schema = new Schema ([
223223 'type ' => $ type ,
224- ]);
224+ ] + $ additionalTypeProperties );
225225 if (!empty ($ defaultValue )) {
226226 $ schema ->default = $ defaultValue ;
227227 }
@@ -276,10 +276,12 @@ protected function generateSchemaPartsForObject(
276276 * @param string $type
277277 * @return string
278278 */
279- public function canonizePrimitiveType (string $ type ): string
279+ public function canonizePrimitiveType (string $ type, & $ additionalProperties = [] ): string
280280 {
281+ $ additionalProperties = [];
281282 switch ($ type ) {
282283 case 'float ' :
284+ $ additionalProperties ['format ' ] = 'float ' ;
283285 case 'int ' :
284286 return 'integer ' ;
285287
You can’t perform that action at this time.
0 commit comments