[x3d-public] Checking JSON schema against JSON examples (Ajv)

John Carlson yottzumm at gmail.com
Tue Feb 1 21:42:42 PST 2022


I am not sure where to file this report since the JSON examples are not on
sourceforge.

I could use some help getting a reasonable Java JSON validator working!

These JSON files declare TODO, warning or error:


$ grep "^ file:" results.txt |sort -u|grep -v Gltf|grep -v Xvl|grep -v
development| sed 's/ file: //' | xargs egrep -l 'error|warning|TODO'
C:/x3d-code/
www.web3d.org/x3d/content/examples/Basic/CAD/CADPartChildTransformationAlternativeB.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/Basic/CAD/CADPartChildTransformationAlternativeC.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/Basic/Geospatial/newGeospatialScene.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/AllAudioGraphNodesTest.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Scanning/ScannerMetadataExample4.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPattern.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/MultiTextureDesignPattern.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/MultiTextureTeapot.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/XmpMetadataEmbedded.json

====================================================================
These files are actually in error:

$ grep "^ file:" results.txt |sort -u|grep -v Gltf|grep -v Xvl|grep -v
development| sed 's/ file: //'
C:/x3d-code/
www.web3d.org/x3d/content/examples/Basic/CAD/CADPartChildTransformationAlternativeB.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/Basic/CAD/CADPartChildTransformationAlternativeC.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/Basic/Geospatial/newGeospatialScene.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/AllAudioGraphNodesTest.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Scanning/ScannerMetadataExample4.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/Scanning/X3dMeshDesignPattern.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/MultiTextureDesignPattern.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/TextureMapping/MultiTextureTeapot.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/XmpMetadataEmbedded.json
=================================================
This looks like the files which have errors which aren't declared:

$ diff allerrors.txt declared.txt |sed 's/< //'
C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json
C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
=========================================================================

Please add TODO, warning and error meta flags to files if desired, thanks!

These conversions are slightly stale.  Use with care.

Actual error reports included below.  I have tried to highlight where I
think the issue is.

$ diff allerrors.txt declared.txt |sed 's/< //'| grep C: |xargs node
../x3dvalidate/x3dvalidate.js
Can only validate version 4.0 presently. Switching version to 4.0.
Loading schema
Parsing schema
Adding schema
Schema 4.0 added
Schema 4.0 compiled
================================================================================
File: C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
Error reading C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
 keyword: required
 instancePath: /X3D/Scene/-children/4/Group
 message: must have required property @USE
 params: {"missingProperty":"@USE"}
 file: C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
 version: 3.0

 keyword: required
 instancePath: /X3D/Scene/-children/4/Group/-children/8/Script
 message: must have required property @USE
 params: {"missingProperty":"@USE"}
 file: C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
 version: 3.0







* keyword: format instancePath:
/X3D/Scene/-children/4/Group/-children/8/Script/@url/0 message: must match
format "uri-reference" params: {"format":"uri-reference"} file:
C:/x3d-code/www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
<http://www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json>
version:
3.0*
 keyword: oneOf
 instancePath: /X3D/Scene/-children/4/Group/-children/8/Script
 message: must match exactly one schema in "oneOf"
 params: {"passingSchemas":null}
 file: C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
 version: 3.0

 keyword: oneOf
 instancePath: /X3D/Scene/-children/4/Group
 message: must match exactly one schema in "oneOf"
 params: {"passingSchemas":null}
 file: C:/x3d-code/
www.web3d.org/x3d/content/examples/Vrml2Sourcebook/Chapter30Scripts/Figure30_1ScriptSlidingBall.json
 version: 3.0

Can only validate version 4.0 presently. Switching version to 4.0.
================================================================================








*File:
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json
<http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json>Error
reading
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json
<http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json>
keyword:
required instancePath: /X3D message: must have required property
encoding params: {"missingProperty":"encoding"} file:
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json
<http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedAlternativeEncoding.json>
version:
3.3*
Can only validate version 4.0 presently. Switching version to 4.0.
================================================================================








*File:
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json
<http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json>Error
reading
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json
<http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json>
keyword:
required instancePath: /X3D message: must have required property
encoding params: {"missingProperty":"encoding"} file:
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json
<http://www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/HelloWorldScenes/HelloWorldCommentedOriginalEncoding.json>
version:
3.3*
================================================================================
File: C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
Error reading C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
 keyword: required
 instancePath: /X3D/Scene/-children/3/WorldInfo
 message: must have required property @USE
 params: {"missingProperty":"@USE"}
 file: C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
 version: 4.0







*keyword: additionalProperties instancePath:
/X3D/Scene/-children/3/WorldInfo message: must NOT have additional
properties params: {"additionalProperty":"-value"} file:
C:/x3d-code/www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
<http://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json>
version:
4.0*
 keyword: oneOf
 instancePath: /X3D/Scene/-children/3/WorldInfo
 message: must match exactly one schema in "oneOf"
 params: {"passingSchemas":null}
 file: C:/x3d-code/
www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter15Metadata/MetadataNodeExamplesX3D4.json
 version: 4.0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220201/38bd36ac/attachment-0001.html>


More information about the x3d-public mailing list