22
33namespace Slack\Hack\JsonSchema\Codegen ;
44
5- use namespace HH\Lib\{C , Str} ;
5+ use namespace HH\Lib\{C , Str , Vec } ;
66
77use namespace Slack\Hack\JsonSchema ;
88
@@ -57,12 +57,12 @@ protected function resolveRef(string $ref, Context $ctx): (TSchema, ?string) {
5757
5858 // Find the schema the `ref` is pointing to
5959
60- $ref = \ substr ($ref , 1 );
61- $pointers = \ HH \ Lib \ Str \split ($ref , ' /' ) |> \ HH \ Lib \ Vec \filter ($$);
60+ $ref = Str \ slice ($ref , 1 );
61+ $pointers = Str \split ($ref , ' /' ) |> Vec \filter ($$, $str ==> $str !== ' ' );
6262
6363 while (C \count ($pointers )) {
6464 $pointer = $pointers [0 ];
65- $pointers = \ HH \ Lib \ Vec \drop ($pointers , 1 );
65+ $pointers = Vec \drop ($pointers , 1 );
6666 $array_schema = Shapes :: toArray($current_schema );
6767 $next_schema = $array_schema [$pointer ] ?? null ;
6868
@@ -97,7 +97,7 @@ protected function getRefFilePath(string $ref): string {
9797 */
9898 protected function getRefSchemaPath (string $ref ): string {
9999 if ($ref [0 ] === ' #' ) {
100- return \ substr ($ref , 1 );
100+ return Str \ slice ($ref , 1 );
101101 }
102102
103103 $paths = $this -> splitRefPaths($ref );
@@ -112,9 +112,9 @@ protected function getRefSchemaPath(string $ref): string {
112112 * { "$ref": "../../common/defs.json#/devices/tablet" }
113113 */
114114 protected function splitRefPaths (string $ref ): vec <string > {
115- $paths = \ HH \ Lib \ Vec \filter (\ HH \ Lib \ Str \split ($ref , ' #' ));
115+ $paths = Vec \filter (Str \split ($ref , ' #' ), $str ==> $str !== ' ' );
116116 if ($paths [0 ][0 ] === " /" ) {
117- $paths [0 ] = \ substr ($paths [0 ], 1 );
117+ $paths [0 ] = Str \ slice ($paths [0 ], 1 );
118118 }
119119
120120 return $paths ;
0 commit comments