Skip to content

Stack trace while validating bad file. Could use help with schema and oneOf errors. #253

@coderextreme

Description

@coderextreme

better ajv:

$ node.exe index.betterajverrors.js examples.bad/HelloWorldProgramOutput.json
Loading schema
Parsing schema
Adding schema
Schema 4.1 added
Schema 4.1 compiled
================================================================================
File: examples.bad/HelloWorldProgramOutput.json
================================================================================
File: examples.bad/HelloWorldProgramOutput.json
Error: Couldn't find property -children of /X3D/Scene/-children/1/NavigationInfo
    at file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/json/get-meta-from-path.mjs:13:17
    at Array.reduce (<anonymous>)
    at getMetaFromPath (file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/json/get-meta-from-path.mjs:6:19)
    at RequiredValidationError.getLocation (file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/validation-errors/base.mjs:14:21)
    at RequiredValidationError.getLocation (file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/validation-errors/required.mjs:6:29)
    at RequiredValidationError.getError (file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/validation-errors/required.mjs:21:15)
    at customErrorToStructure (file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/index.mjs:9:51)
    at Array.map (<anonymous>)
    at index_default (file:///C:/Users/jcarl/x3dvalidate/node_modules/better-ajv-errors/lib/esm/index.mjs:19:25)
    at doValidate (file:///C:/Users/jcarl/x3dvalidate/index.betterajverrors.js:48:19)

Normal ajv:

$ node.exe index.js --fullreport examples.bad/HelloWorldProgramOutput.json
Toggling suppression in in files now.
Loading schema
Parsing schema
Adding schema
Schema 4.1 added
Schema 4.1 compiled
================================================================================
File: examples.bad/HelloWorldProgramOutput.json
Error invalid file examples.bad/HelloWorldProgramOutput.json
 keyword: required
 location in document: /X3D/Scene/-children/1/NavigationInfo
 message: must have required property '@USE'
 params: {"missingProperty":"@USE"}
 file: examples.bad/HelloWorldProgramOutput.json
 version: 4.1

 keyword: type
 location in document: /X3D/Scene/-children/1/NavigationInfo/@type
 message: must be array
 params: {"type":"array"}
 file: examples.bad/HelloWorldProgramOutput.json
 version: 4.1

 keyword: oneOf
 location in document: /X3D/Scene/-children/1/NavigationInfo
 message: must match exactly one schema in oneOf
 params: {"passingSchemas":null}
 file: examples.bad/HelloWorldProgramOutput.json
 version: 4.1

I am also including schema and AllAudioGraphNodesTest.json and a normal ajv error reporter which seems to close down on the error in the file better than better-ajv-errors.

$ node.exe index.betterajverrors.js examples.bad/AllAudioGraphNodesTest.json
Loading schema
Parsing schema
Adding schema
Schema 4.1 added
Schema 4.1 compiled
================================================================================
File: examples.bad/AllAudioGraphNodesTest.json
Error invalid file examples.bad/AllAudioGraphNodesTest.json [
  {
    start: { line: 67, column: 13, offset: 2161 },
    error: "/X3D/Scene/-children/1/Shape must have required property '@USE'",
    path: '/X3D/Scene/-children/1/Shape'
  }
]

Filtered ajv:

$ node.exe index.js examples.bad/AllAudioGraphNodesTest.json
Loading schema
Parsing schema
Adding schema
Schema 4.1 added
Schema 4.1 compiled
================================================================================
File: examples.bad/AllAudioGraphNodesTest.json
Suppressing @USE missing property.  Use --fullreport to reveal possibly confusing errors
Suppressing @USE missing property.  Use --fullreport to reveal possibly confusing errors
Suppressing null passingSchemas.  Use --fullreport to reveal possibly confusing errors
Suppressing null passingSchemas.  Use --fullreport to reveal possibly confusing errors
Error invalid file examples.bad/AllAudioGraphNodesTest.json
 keyword: type
 location in document: /X3D/Scene/-children/1/Shape/-appearance/Appearance/-acousticProperties
 message: must be object
 params: {"type":"object"}
 file: examples.bad/AllAudioGraphNodesTest.json
 version: 4.1

Normal ajv:

$ node.exe index.js --fullreport examples.bad/AllAudioGraphNodesTest.json
Toggling suppression in in files now.
Loading schema
Parsing schema
Adding schema
Schema 4.1 added
Schema 4.1 compiled
================================================================================
File: examples.bad/AllAudioGraphNodesTest.json
Error invalid file examples.bad/AllAudioGraphNodesTest.json
 keyword: required
 location in document: /X3D/Scene/-children/1/Shape
 message: must have required property '@USE'
 params: {"missingProperty":"@USE"}
 file: examples.bad/AllAudioGraphNodesTest.json
 version: 4.1

 keyword: required
 location in document: /X3D/Scene/-children/1/Shape/-appearance/Appearance
 message: must have required property '@USE'
 params: {"missingProperty":"@USE"}
 file: examples.bad/AllAudioGraphNodesTest.json
 version: 4.1

 keyword: type
 location in document: /X3D/Scene/-children/1/Shape/-appearance/Appearance/-acousticProperties
 message: must be object
 params: {"type":"object"}
 file: examples.bad/AllAudioGraphNodesTest.json
 version: 4.1

 keyword: oneOf
 location in document: /X3D/Scene/-children/1/Shape/-appearance/Appearance
 message: must match exactly one schema in oneOf
 params: {"passingSchemas":null}
 file: examples.bad/AllAudioGraphNodesTest.json
 version: 4.1

 keyword: oneOf
 location in document: /X3D/Scene/-children/1/Shape
 message: must match exactly one schema in oneOf
 params: {"passingSchemas":null}
 file: examples.bad/AllAudioGraphNodesTest.json
 version: 4.1

If you can catch my error in the schema why there's so many errors, great. Apparently, I can't use strict mode currently.

StackTraceErrorZip.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions