1 | import { JSONSchema4Type } from 'json-schema';
|
2 | export declare type AST_TYPE = AST['type'];
|
3 | export declare type AST = TAny | TArray | TBoolean | TEnum | TInterface | TNamedInterface | TIntersection | TLiteral | TNumber | TNull | TObject | TReference | TString | TTuple | TUnion | TUnknown | TCustomType;
|
4 | export interface AbstractAST {
|
5 | comment?: string;
|
6 | keyName?: string;
|
7 | standaloneName?: string;
|
8 | type: AST_TYPE;
|
9 | }
|
10 | export declare type ASTWithComment = AST & {
|
11 | comment: string;
|
12 | };
|
13 | export declare type ASTWithName = AST & {
|
14 | keyName: string;
|
15 | };
|
16 | export declare type ASTWithStandaloneName = AST & {
|
17 | standaloneName: string;
|
18 | };
|
19 | export declare function hasComment(ast: AST): ast is ASTWithComment;
|
20 | export declare function hasStandaloneName(ast: AST): ast is ASTWithStandaloneName;
|
21 | export interface TAny extends AbstractAST {
|
22 | type: 'ANY';
|
23 | }
|
24 | export interface TArray extends AbstractAST {
|
25 | type: 'ARRAY';
|
26 | params: AST;
|
27 | }
|
28 | export interface TBoolean extends AbstractAST {
|
29 | type: 'BOOLEAN';
|
30 | }
|
31 | export interface TEnum extends AbstractAST {
|
32 | standaloneName: string;
|
33 | type: 'ENUM';
|
34 | params: TEnumParam[];
|
35 | }
|
36 | export interface TEnumParam {
|
37 | ast: AST;
|
38 | keyName: string;
|
39 | }
|
40 | export interface TInterface extends AbstractAST {
|
41 | type: 'INTERFACE';
|
42 | params: TInterfaceParam[];
|
43 | superTypes: TNamedInterface[];
|
44 | }
|
45 | export interface TNamedInterface extends AbstractAST {
|
46 | standaloneName: string;
|
47 | type: 'INTERFACE';
|
48 | params: TInterfaceParam[];
|
49 | superTypes: TNamedInterface[];
|
50 | }
|
51 | export interface TInterfaceParam {
|
52 | ast: AST;
|
53 | keyName: string;
|
54 | isRequired: boolean;
|
55 | isPatternProperty: boolean;
|
56 | isUnreachableDefinition: boolean;
|
57 | }
|
58 | export interface TIntersection extends AbstractAST {
|
59 | type: 'INTERSECTION';
|
60 | params: AST[];
|
61 | }
|
62 | export interface TLiteral extends AbstractAST {
|
63 | params: JSONSchema4Type;
|
64 | type: 'LITERAL';
|
65 | }
|
66 | export interface TNumber extends AbstractAST {
|
67 | type: 'NUMBER';
|
68 | }
|
69 | export interface TNull extends AbstractAST {
|
70 | type: 'NULL';
|
71 | }
|
72 | export interface TObject extends AbstractAST {
|
73 | type: 'OBJECT';
|
74 | }
|
75 | export interface TReference extends AbstractAST {
|
76 | type: 'REFERENCE';
|
77 | params: string;
|
78 | }
|
79 | export interface TString extends AbstractAST {
|
80 | type: 'STRING';
|
81 | }
|
82 | export interface TTuple extends AbstractAST {
|
83 | type: 'TUPLE';
|
84 | params: AST[];
|
85 | spreadParam?: AST;
|
86 | minItems: number;
|
87 | maxItems?: number;
|
88 | }
|
89 | export interface TUnion extends AbstractAST {
|
90 | type: 'UNION';
|
91 | params: AST[];
|
92 | }
|
93 | export interface TUnknown extends AbstractAST {
|
94 | type: 'UNKNOWN';
|
95 | }
|
96 | export interface TCustomType extends AbstractAST {
|
97 | type: 'CUSTOM_TYPE';
|
98 | params: string;
|
99 | }
|
100 | export declare const T_ANY: TAny;
|
101 | export declare const T_ANY_ADDITIONAL_PROPERTIES: TAny & ASTWithName;
|
102 | export declare const T_UNKNOWN: TUnknown;
|
103 | export declare const T_UNKNOWN_ADDITIONAL_PROPERTIES: TUnknown & ASTWithName;
|