11<?php
2+
3+ /**
4+ * @see https://github.com/open-code-modeling/json-schema-to-php for the canonical source repository
5+ * @copyright https://github.com/open-code-modeling/json-schema-to-php/blob/master/COPYRIGHT.md
6+ * @license https://github.com/open-code-modeling/json-schema-to-php/blob/master/LICENSE.md MIT License
7+ */
8+
29declare (strict_types=1 );
310
411namespace OpenCodeModelingTest \JsonSchemaToPhp \Shorthand ;
@@ -31,7 +38,7 @@ public function it_converts_enum_shorthand_to_json_schema_string(): void
3138 $ schema = Shorthand::convertToJsonSchema (['test ' => 'enum|available|blocked|bought ' ]);
3239
3340 $ this ->assertEquals ($ this ->jsonSchemaObject (
34- ['test ' => ['enum ' => [" available " , " blocked " , " bought " ]]],
41+ ['test ' => ['enum ' => [' available ' , ' blocked ' , ' bought ' ]]],
3542 ['test ' ]
3643 ), $ schema );
3744 }
@@ -117,7 +124,7 @@ public function it_parses_shorthand_validation_and_adds_it_to_json_schema(): voi
117124 'test2 ' => 'number|minimum:0.5|maximum:10 ' ,
118125 'test3 ' => 'string|null|format:email ' ,
119126 'test4 ' => 'boolean|default:false ' ,
120- 'test5 ' => 'boolean|null|default:true '
127+ 'test5 ' => 'boolean|null|default:true ' ,
121128 ]);
122129
123130 $ this ->assertEquals ($ this ->jsonSchemaObject (
@@ -178,7 +185,7 @@ public function it_converts_shorthand_object_to_json_schema_object(): void
178185 'searchProfile? ' => [
179186 'roomsMin ' => 'number|null|minimum:0.5 ' ,
180187 'roomsMax ' => 'number|null|minimum:0.5 ' ,
181- ]
188+ ],
182189 ]);
183190
184191 $ this ->assertEquals (
@@ -194,7 +201,7 @@ public function it_converts_shorthand_object_to_json_schema_object(): void
194201 'searchProfile ' => $ this ->jsonSchemaObject ([
195202 'roomsMin ' => ['type ' => ['number ' , 'null ' ], 'minimum ' => 0.5 ],
196203 'roomsMax ' => ['type ' => ['number ' , 'null ' ], 'minimum ' => 0.5 ],
197- ], ['roomsMin ' , 'roomsMax ' ])
204+ ], ['roomsMin ' , 'roomsMax ' ]),
198205 ], ['name ' , 'email ' , 'address ' , 'tags ' ], 'Prospect ' ),
199206 $ schema
200207 );
@@ -212,10 +219,10 @@ private function jsonSchemaObject(array $properties, array $required = [], strin
212219 'type ' => 'object ' ,
213220 'properties ' => $ properties ,
214221 'additionalProperties ' => false ,
215- 'required ' => $ required
222+ 'required ' => $ required,
216223 ];
217224
218- if ($ title ) {
225+ if ($ title ) {
219226 $ obj ['title ' ] = $ title ;
220227 }
221228
0 commit comments