[x3d-public] Potential needed upgrades to JSON schema, JSON schema generator?

John Carlson yottzumm at gmail.com
Sun May 23 23:25:13 PDT 2021


X3D JSON validate:

~/x3dvalidate$ node x3dvalidate.js 
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/Filters.json
Loading schema
Parsing schema
Adding schema
Schema 4.0 added
Schema 4.0 compiled
================================================================================
File: 
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/Filters.json
Error reading 
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/Filters.json 

  keyword: additionalProperties
  dataPath: X3D > Scene > -children > 2 > Viewpoint
  value: 
{"@bind":true,"@orientation":"|omitted|","@position":"|omitted|","@retainUserOffsets":true}
  message: should not have additional properties
  params: {"additionalProperty":"@bind"}
  file: 
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/Filters.json
  version: 4.0

  keyword: additionalProperties
  dataPath: X3D > Scene > -children > 2 > Viewpoint
  value: 
{"@bind":true,"@orientation":"|omitted|","@position":"|omitted|","@retainUserOffsets":true}
  message: should not have additional properties
  params: {"additionalProperty":"@bind"}
  file: 
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/Filters.json
  version: 4.0

  keyword: oneOf
  dataPath: X3D > Scene > -children > 2 > Viewpoint
  value: 
{"@bind":true,"@orientation":"|omitted|","@position":"|omitted|","@retainUserOffsets":true}
  message: should match exactly one schema in "oneOf"
  params: {"passingSchemas":null}
  file: 
/c/x3d-code/www.web3d.org/x3d/content/examples/X3dForAdvancedModeling/AudioSpatialSound/Filters.json
  version: 4.0


Seems to be an issue with the @bind property.

================================================================================================

~/x3dvalidate$ grep -w set_bind x3d-4.0-JSONSchema.json
             "@set_bind": {
             "@set_bind": {
             "@set_bind": {
             "@set_bind": {
             "@set_bind": {
             "@set_bind": {
             "@set_bind": {

========================

Grep bind AudioSpatialSound folder (more results than these):

Filters.json:              "@bind":true,
Filters.x3d:    <Viewpoint bind='true' fieldOfView='0.7854' 
orientation='1 0 0 -0.5' position='0.0 500.0 600.0' 
retainUserOffsets='true'/>


X3DUOM:


             <field name="set_bind"
                    type="SFBool"
                    accessType="inputOnly"
                    inheritedFrom="X3DBindableNode"
                    description="Sending event set_bind=true makes this 
node active."/>


Should the JSON schema generator generate a property for set_bind 
(@bind?) and set_ in general, such that set_ fields also generates 
properties without set_, including the following:

~/x3dvalidate$ grep set_ x3d-4.0-JSONSchema.json |sort -u
             "@set_articulationParameterValue0": {
             "@set_articulationParameterValue1": {
             "@set_articulationParameterValue2": {
             "@set_articulationParameterValue3": {
             "@set_articulationParameterValue4": {
             "@set_articulationParameterValue5": {
             "@set_articulationParameterValue6": {
             "@set_articulationParameterValue7": {
             "@set_bind": {
             "@set_boolean": {
             "@set_colorIndex": {
             "-set_contacts": {
             "@set_coordIndex": {
             "@set_crossSection": {
             "@set_destination": {
             "@set_fraction": {
             "@set_height": {
             "@set_index": {
             "@set_normalIndex": {
             "@set_orientation": {
             "@set_scale": {
             "@set_spine": {
             "@set_texCoordIndex": {
             "@set_triggerTime": {
             "@set_value": {

Likewise for "_changed"

~/x3dvalidate$ grep _changed x3d-4.0-JSONSchema.json |sort -u
             "@articulationParameterValue0_changed": {
             "@articulationParameterValue1_changed": {
             "@articulationParameterValue2_changed": {
             "@articulationParameterValue3_changed": {
             "@articulationParameterValue4_changed": {
             "@articulationParameterValue5_changed": {
             "@articulationParameterValue6_changed": {
             "@articulationParameterValue7_changed": {
             "@centerOfRotation_changed": {
             "@duration_changed": {
             "@fraction_changed": {
             "@geoCoord_changed": {
             "@geovalue_changed": {
             "@hitGeoCoord_changed": {
             "@hitNormal_changed": {
             "@hitPoint_changed": {
             "@hitTexCoord_changed": {
             "@level_changed": {
             "@modifiedFraction_changed": {
             "@normal_changed": {
             "@orientation_changed": {
             "@position_changed": {
             "@rotation_changed": {
             "@trackPoint_changed": {
             "@translation_changed": {
             "@value_changed": {

Or should the XML and JSON examples use set_bind?

Search through all examples:


/c/x3d-code/www.web3d.org/x3d/content/examples$ find . -name '*json' 
|xargs grep -w bind|egrep 'true|false'
grep: 
./Savage/Tools/Visualization/XSL./X3dForAdvancedModeling/Animation/ViewpointSequencerPrototype.json:" 
viewpoints[0].bind = true;",
: No such file or directory
./X3dForAdvancedModeling/AudioSpatialSound/Filters.json: "@bind":true,
./X3dForAdvancedModeling/AudioSpatialSound/SplitChannels.json: "@bind":true,
grep: Output18JAN2010.json: No such file or directory
./Savage/Tools/Animation/ViewpointSequencerPrototype.json:" 
viewpoints[0].bind = true;",


/c/x3d-code/www.web3d.org/x3d/content/examples$ find . -name '*x3d' 
|xargs grep -w bind|egrep 'true|false'
grep: 
./Savage/Tools/Visualization/XSL./X3dForAdvancedModeling/Animation/ViewpointSequencerPrototype.x3d: 
viewpoints[0].bind = true;
./X3dForAdvancedModeling/AudioSpatialSound/SplitChannels.x3d: <Viewpoint 
bind='true' fieldOfView='0.7854' orientation='1 0 0 -0.5' position='0.0 
500.0 600.0' retainUserOffsets='true'/>
./X3dForAdvancedModeling/AudioSpatialSound/Filters.x3d: <Viewpoint 
bind='true' fieldOfView='0.7854' orientation='1 0 0 -0.5' position='0.0 
500.0 600.0' retainUserOffsets='true'/>
: No such file or directory
grep: Output18JAN2010.x3d: No such file or directory
./Savage/Tools/Animation/ViewpointSequencerPrototype.x3d: 
viewpoints[0].bind = true;

=================================

I'm not quite sure how XML schema validation would handle Filters.x3d?

Thanks,

John







More information about the x3d-public mailing list