File tree 4 files changed +15
-6
lines changed
4 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -56,4 +56,14 @@ export class RegularNode extends BaseNode {
56
56
this . primaryType !== SchemaNodeKind . Array && this . primaryType !== SchemaNodeKind . Object && this . combiners === null
57
57
) ;
58
58
}
59
+
60
+ public get unknown ( ) {
61
+ return (
62
+ this . types === null &&
63
+ this . combiners === null &&
64
+ this . format === null &&
65
+ this . enum === null &&
66
+ Object . keys ( this . annotations ) . length + Object . keys ( this . validations ) . length === 0
67
+ ) ;
68
+ }
59
69
}
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ export class MirroredRegularNode extends BaseNode implements RegularNode {
22
22
public readonly validations ! : Readonly < Dictionary < unknown > > ;
23
23
24
24
public readonly simple ! : boolean ;
25
+ public readonly unknown ! : boolean ;
25
26
26
27
constructor ( public readonly mirroredNode : RegularNode ) {
27
28
super ( mirroredNode . fragment ) ;
Original file line number Diff line number Diff line change @@ -35,7 +35,6 @@ export type WalkerEmitter = {
35
35
stepOutNode : WalkerNodeEventHandler ;
36
36
37
37
enterFragment : WalkerFragmentEventHandler ;
38
- skipFragment : WalkerFragmentEventHandler ;
39
38
exitFragment : WalkerFragmentEventHandler ;
40
39
41
40
error : WalkerErrorEventHandler ;
Original file line number Diff line number Diff line change @@ -80,14 +80,13 @@ export class Walker extends EventEmitter<WalkerEmitter> {
80
80
public walk ( ) : void {
81
81
const { depth : initialDepth , schemaNode : initialSchemaNode , fragment } = this ;
82
82
83
- const state = this . dumpInternalWalkerState ( ) ;
84
-
85
- if ( Object . keys ( fragment ) . length === 0 ) {
86
- // empty fragment, nothing to do.
87
- super . emit ( 'skipFragment' , fragment ) ;
83
+ if ( initialDepth === - 1 && Object . keys ( fragment ) . length === 0 ) {
84
+ // empty schema, nothing to do
88
85
return ;
89
86
}
90
87
88
+ const state = this . dumpInternalWalkerState ( ) ;
89
+
91
90
super . emit ( 'enterFragment' , fragment ) ;
92
91
93
92
for ( const schemaNode of this . processFragment ( ) ) {
You can’t perform that action at this time.
0 commit comments