@@ -79,7 +79,7 @@ public static function convertToJsonSchema($shorthand, array $customData = []):
7979 $ shorthandDefinition .= '[] ' ;
8080 }
8181
82- return self ::convertShorthandStringToJsonSchema ($ shorthandDefinition );
82+ return self ::convertShorthandStringToJsonSchema ($ shorthandDefinition, $ customData );
8383 case $ schemaProperty === '$title ' :
8484 $ schema ['title ' ] = $ shorthandDefinition ;
8585 continue 2 ;
@@ -91,7 +91,7 @@ public static function convertToJsonSchema($shorthand, array $customData = []):
9191 if (\is_array ($ shorthandDefinition )) {
9292 $ schema ['properties ' ][$ schemaProperty ] = self ::convertToJsonSchema ($ shorthandDefinition );
9393 } elseif (\is_string ($ shorthandDefinition )) {
94- $ schema ['properties ' ][$ schemaProperty ] = self ::convertShorthandStringToJsonSchema ($ shorthandDefinition );
94+ $ schema ['properties ' ][$ schemaProperty ] = self ::convertShorthandStringToJsonSchema ($ shorthandDefinition, $ customData );
9595 } else {
9696 throw InvalidShorthand::cannotParseProperty ($ schemaProperty , $ shorthand );
9797 }
@@ -106,9 +106,10 @@ public static function convertToJsonSchema($shorthand, array $customData = []):
106106
107107 /**
108108 * @param string $shorthandStr
109+ * @param array<string, mixed> $customData
109110 * @return array<string, mixed>
110111 */
111- private static function convertShorthandStringToJsonSchema (string $ shorthandStr ): array
112+ private static function convertShorthandStringToJsonSchema (string $ shorthandStr, array $ customData ): array
112113 {
113114 if ($ shorthandStr === '' ) {
114115 return ['type ' => 'string ' ];
@@ -122,14 +123,18 @@ private static function convertShorthandStringToJsonSchema(string $shorthandStr)
122123
123124 return [
124125 'type ' => 'array ' ,
125- 'items ' => self ::convertShorthandStringToJsonSchema (\implode ('| ' , $ itemsParts )),
126+ 'items ' => self ::convertShorthandStringToJsonSchema (\implode ('| ' , $ itemsParts ), $ customData ),
126127 ];
127128 }
128129
129130 $ type = $ parts [0 ];
130- $ namespace = '' ;
131+ $ namespace = $ customData [ ' voNamespace ' ] ?? '' ;
131132 $ namespaceDetected = false !== \strpos ($ parts [0 ], '/ ' );
132133
134+ if ($ namespace !== '' ) {
135+ $ namespace = \rtrim ($ namespace , '/ ' ) . '/ ' ;
136+ }
137+
133138 if ($ namespaceDetected ) {
134139 $ namespace = self ::extractNamespace ($ type );
135140 $ type = self ::extractType ($ type );
0 commit comments