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

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Wed Feb 2 03:01:44 PST 2022


Hi John, thanks for serious testing and an excellent trouble report.  Here is further information and suggestions.

For the example archives, we only check in the .x3d master files.  Autogenerated conversions are produced and maintained in the same directories with similar filenames.

All examples are found as follows, and yesterday I pushed a refresh of X3D For Web Authors.


  *   X3D Resources, Examples: Scene Archives for X3D
  *   https://www.web3d.org/x3d/content/examples/X3dResources.html#Examples



  *   X3D for Web Authors
  *   https://x3dgraphics.com/examples/X3dForWebAuthors

As your initial grep reveals, the first scenes are showing all document meta information for errors, warnings, etc.  A number of those scenes are not expected to work.  The first entry in your list, for example, includes the following warning which triggered your search:
          {
            "@name":"warning",
            "@content":"This scene is intended for specification development only, and is not expected to validate or work."
          },

Suggested next steps:

  *   whittle down your list to models that are expected to be valid,
  *   check that the .x3d source is valid and actually correct,
  *   then check whether the JSON conversion is what you expect,
  *   possibly cross-check the other conversions to isolate if the error is part of original .x3d model, or the converter.

Just seeing a reported error in JSON is insufficient, need to "zero in" on the precise issue.  To identify a needed fix, you need:

  1.  X3D model source excerpt,
  2.  Corresponding JSON conversion, and
  3.  Explanation of why converter is in error, or else suggested improvement in original .x3d model.
  4.  Then we can fix the offending problem and check it back in.

Of note: errors can only be identified and fixed one at a time.  Each error correction can then avoid similar problems in all the other models.

Having fun with X3D Quality Assurance (QA) !  Again thanks for steadfast efforts for everyone's benefit.  8)

all the best, Don
--
Don Brutzman  Naval Postgraduate School, Code USW/Br        brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA    +1.831.656.2149
X3D graphics, virtual worlds, Navy robotics https:// faculty.nps.edu/brutzman

From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of John Carlson
Sent: Tuesday, February 1, 2022 9:43 PM
To: X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: [x3d-public] Checking JSON schema against JSON examples (Ajv)

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
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
Error reading C:/x3d-code/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
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
Error reading C:/x3d-code/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
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
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/20220202/983e0d04/attachment-0001.html>


More information about the x3d-public mailing list