@@ -2,7 +2,6 @@ import type { Dictionary } from '@stoplight/types';
2
2
3
3
import { getAnnotations } from '../accessors/getAnnotations' ;
4
4
import { getCombiners } from '../accessors/getCombiners' ;
5
- import { getMeta } from '../accessors/getMeta' ;
6
5
import { getPrimaryType } from '../accessors/getPrimaryType' ;
7
6
import { getRequired } from '../accessors/getRequired' ;
8
7
import { getTypes } from '../accessors/getTypes' ;
@@ -13,9 +12,10 @@ import { isRegularNode, isSchemaNode } from '../guards';
13
12
import type { SchemaFragment } from '../types' ;
14
13
import { BaseNode } from './BaseNode' ;
15
14
import type { ReferenceNode } from './ReferenceNode' ;
16
- import { MirroredSchemaNode , SchemaAnnotations , SchemaCombinerName , SchemaMeta , SchemaNodeKind } from './types' ;
15
+ import { MirroredSchemaNode , SchemaAnnotations , SchemaCombinerName , SchemaNodeKind } from './types' ;
17
16
18
17
export class RegularNode extends BaseNode {
18
+ public readonly $id : string | null ;
19
19
public readonly types : SchemaNodeKind [ ] | null ;
20
20
public readonly primaryType : SchemaNodeKind | null ; // object (first choice) or array (second option), primitive last
21
21
public readonly combiners : SchemaCombinerName [ ] | null ;
@@ -28,24 +28,23 @@ export class RegularNode extends BaseNode {
28
28
29
29
public children : ( RegularNode | ReferenceNode | MirroredSchemaNode ) [ ] | null | undefined ;
30
30
31
- public readonly meta : Readonly < Partial < Dictionary < unknown , SchemaMeta > > > ;
32
31
public readonly annotations : Readonly < Partial < Dictionary < unknown , SchemaAnnotations > > > ;
33
32
public readonly validations : Readonly < Dictionary < unknown > > ;
34
33
35
34
constructor ( public readonly fragment : SchemaFragment ) {
36
35
super ( fragment ) ;
37
36
37
+ this . $id = unwrapStringOrNull ( 'id' in fragment ? fragment . id : fragment . $id ) ;
38
38
this . types = getTypes ( fragment ) ;
39
39
this . primaryType = getPrimaryType ( fragment , this . types ) ;
40
40
this . combiners = getCombiners ( fragment ) ;
41
41
42
42
this . deprecated = isDeprecated ( fragment ) ;
43
- this . enum = unwrapArrayOrNull ( fragment . enum ) ;
43
+ this . enum = 'const' in fragment ? [ fragment . const ] : unwrapArrayOrNull ( fragment . enum ) ;
44
44
this . required = getRequired ( fragment . required ) ;
45
45
this . format = unwrapStringOrNull ( fragment . format ) ;
46
46
this . title = unwrapStringOrNull ( fragment . title ) ;
47
47
48
- this . meta = getMeta ( fragment ) ;
49
48
this . annotations = getAnnotations ( fragment ) ;
50
49
this . validations = getValidations ( fragment , this . types ) ;
51
50
0 commit comments