File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 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(
211211 for ( const k of [ "allOf" , "anyOf" , "oneOf" ] ) {
212212 if ( Array . isArray ( rawNode [ k ] ) ) {
213213 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?` ) ;
214216 if ( ! ( "$ref" in o ) || typeof o . $ref !== "string" ) return true ;
215217 const ref = parseRef ( o . $ref ) ;
216218 return ! ref . path . some ( ( i ) => i . startsWith ( "x-" ) ) ; // ignore all custom "x-*" properties
217219 } ) ;
218220 }
219221 }
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+ ) ;
221226 if ( ! ( "$ref" in rawNode ) || typeof rawNode . $ref !== "string" ) return ;
222227 const node = rawNode as unknown as ReferenceObject ;
223228
You can’t perform that action at this time.
0 commit comments