File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ export interface Reference {
2
+ $ref : string ,
3
+ }
4
+
5
+ export function isReference ( schema : any ) : schema is Reference {
6
+ return typeof schema . $ref === 'string' ;
7
+ }
8
+
1
9
export interface NullJsonSchema {
2
10
allOf ?: Array < NullJsonSchema > ,
3
11
anyOf ?: Array < NullJsonSchema > ,
@@ -326,7 +334,8 @@ export interface AnyJsonSchema {
326
334
}
327
335
328
336
export function isAnyJsonSchema ( schema : any ) : schema is AnyJsonSchema {
329
- return ! isNullJsonSchema ( schema )
337
+ return ! isReference ( schema )
338
+ && ! isNullJsonSchema ( schema )
330
339
&& ! isBooleanJsonSchema ( schema )
331
340
&& ! isStringJsonSchema ( schema )
332
341
&& ! isNumberJsonSchema ( schema )
@@ -335,4 +344,4 @@ export function isAnyJsonSchema(schema: any): schema is AnyJsonSchema {
335
344
&& ! isObjectJsonSchema ( schema ) ;
336
345
}
337
346
338
- export type JsonSchema = NullJsonSchema | BooleanJsonSchema | StringJsonSchema | NumberJsonSchema | IntegerJsonSchema | ArrayJsonSchema | ObjectJsonSchema | AnyJsonSchema ;
347
+ export type JsonSchema = Reference | NullJsonSchema | BooleanJsonSchema | StringJsonSchema | NumberJsonSchema | IntegerJsonSchema | ArrayJsonSchema | ObjectJsonSchema | AnyJsonSchema ;
You can’t perform that action at this time.
0 commit comments