Skip to content

Commit fa053a3

Browse files
authored
Update TypeDescriber.php
1 parent bbadf18 commit fa053a3

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/Generator/TypeDescriber.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)