File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -211,13 +211,18 @@ export default async function load(
211
211
for ( const k of [ "allOf" , "anyOf" , "oneOf" ] ) {
212
212
if ( Array . isArray ( rawNode [ k ] ) ) {
213
213
rawNode [ k ] = ( rawNode as any ) [ k ] . filter ( ( o : SchemaObject | ReferenceObject ) => {
214
+ if ( ! o || typeof o !== "object" || Array . isArray ( o ) )
215
+ throw new Error ( `${ nodePath } .${ k } : Expected array of objects. Is your schema valid?` ) ;
214
216
if ( ! ( "$ref" in o ) || typeof o . $ref !== "string" ) return true ;
215
217
const ref = parseRef ( o . $ref ) ;
216
218
return ! ref . path . some ( ( i ) => i . startsWith ( "x-" ) ) ; // ignore all custom "x-*" properties
217
219
} ) ;
218
220
}
219
221
}
220
-
222
+ if ( ! rawNode || typeof rawNode !== "object" || Array . isArray ( rawNode ) )
223
+ throw new Error (
224
+ `${ nodePath } : Expected object, got ${ Array . isArray ( rawNode ) ? "array" : typeof rawNode } . Is your schema valid?`
225
+ ) ;
221
226
if ( ! ( "$ref" in rawNode ) || typeof rawNode . $ref !== "string" ) return ;
222
227
const node = rawNode as unknown as ReferenceObject ;
223
228
You can’t perform that action at this time.
0 commit comments