[x3d-public] X3D JSON Schema warnings and validation automation progress

John Carlson yottzumm at gmail.com
Sun Mar 27 16:17:09 PDT 2016


The schema is either complaining that -viewpoints is not valid (it’s there), or Viewpoint is not valid under -sites (as far as I can tell it’s not there), or both. The standard says:
MFNode     [in,out] viewpoints       []       [HAnimSite]
The third [ use of HAnimSite ] is to define a location for a virtual camera in the reference frame of an HAnimSegment (such as a view "through the eyes" of the humanoid for use in multi-user worlds).


-sites is defined in the schema as:


 "-sites": {
            "description": "MF HAnimSite content",
            "type": "array",
            "minItems": 1,
            "items": {
                "type": "object",
                "properties": {
                    "HAnimSite": {
                        "$ref": "#/definitions/HAnimSite"
                    },
                    "ProtoInstance": {
                        "$ref": "#/definitions/ProtoInstance"
                    }
                },
                "additionalProperties": false
            }
        },

Do we need a Viewpoint there?  Some of the files with -viewpoints in them have HAnimSite -children which have Viewpoint children.

Sorry, I don’t understand the standard well enough to tell.  My gut says to put HAnimSite between -viewpoints and Viewport, but I can’t say for sure.  I think we need to change the files in blue (second set, quoted), and make sure the files in black (first set—all the ones with -viewpoints) don’t get invalidated by changing the schema.  I don’t know if the standard currently supports both modes or not.

John

$ find examples/ -name '*json' |xargs grep -e -viewpoints
examples//Basic/development/TestSchematronDiagnostics.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/AllenDutton.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json:        "-viewpoints":[
examples//Basic/HumanoidAnimation/BoxMan.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/DiamondManLOA-0.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/DiamondManLOA-1.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/DiamondManLOA-2.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/HAnimSpecificationLOA3Illustrated.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/HAnimSpecificationLOA3Invisible.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/HAnimSpecificationLOA3Motion.json:              "-viewpoints":[
examples//Basic/HumanoidAnimation/NancyNativeTags.json:              "-viewpoints":[

Or maybe just in wrong place
> On Mar 27, 2016, at 6:10 PM, John Carlson <yottzumm at gmail.com> wrote:
> 
> We should probably clean up these errors, whether they are in the schema or in the examples (X3D possibly) or in the stylesheet  or we might be validating the wrong version file with 3.3 or the schematron isn’t checking well enough (in the case of viewpoints):
> Please run your JSON schema validators on these files:
> 
> I’m rejinning the JSON files from the SVN repository to get a clean version (just checked out a fresh repository too!).
> 
> [ looks bad ]
> www.web3d.org/x3d/content/examples//Basic/CAD/CADPartChildTransformationAlternativeC.json <http://www.web3d.org/x3d/content/examples//Basic/CAD/CADPartChildTransformationAlternativeC.json>
> 
> [ @navType ]
> 
> www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json <http://www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json>
> 
> [ viewpoints, child or after HAnimHumanoid??? ]
> 
> www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json>
> www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json>
> www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json>
> www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json>
> www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json>
> 
> [ metadata ??  or SFNode ?? ]
> www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadata.json <http://www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadata.json>
> www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadataViewer.json <http://www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadataViewer.json>
> 
> [ #comment in head ]
> www.web3d.org/x3d/content/examples//X3dForAdvancedModeling/Buildings/Building.json <http://www.web3d.org/x3d/content/examples//X3dForAdvancedModeling/Buildings/Building.json>   [ No Building.x3d ???]
> 
> Errors:
> 
> $ grep "not permitted" javaresults.txt |grep -v XvlShell
> 
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/2/CADAssembly/-children/0/CADPart/-children/3: extraneous key [Transform] is not permitted /www.web3d.org/x3d/content/examples//Basic/CAD/CADPartChildTransformationAlternativeC.json <http://www.web3d.org/x3d/content/examples//Basic/CAD/CADPartChildTransformationAlternativeC.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/2/CADAssembly/-children/0/CADPart/-children/4: extraneous key [Transform] is not permitted /www.web3d.org/x3d/content/examples//Basic/CAD/CADPartChildTransformationAlternativeC.json <http://www.web3d.org/x3d/content/examples//Basic/CAD/CADPartChildTransformationAlternativeC.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/Group/-children/0/GeoViewpoint: extraneous key [@navType] is not permitted /www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json <http://www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/Group/-children/1/GeoViewpoint: extraneous key [@navType] is not permitted /www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json <http://www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/Group/-children/2/GeoViewpoint: extraneous key [@navType] is not permitted /www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json <http://www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/Group/-children/3/GeoViewpoint: extraneous key [@navType] is not permitted /www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json <http://www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/Group/-children/4/GeoViewpoint: extraneous key [@navType] is not permitted /www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json <http://www.web3d.org/x3d/content/examples//Basic/Geospatial/Mexico.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/HAnimHumanoid/-viewpoints/0: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/HAnimHumanoid/-viewpoints/1: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/HAnimHumanoid/-viewpoints/2: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/HAnimHumanoid/-viewpoints/3: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDutton.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/1/HAnimHumanoid/-skeleton/0/HAnimJoint/-children/2: extraneous key [Switch] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene: extraneous key [-viewpoints] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/AllenDuttonBlurryMotion.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/3/HAnimHumanoid/-viewpoints/0: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/3/HAnimHumanoid/-viewpoints/1: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/3/HAnimHumanoid/-viewpoints/2: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/3/HAnimHumanoid/-viewpoints/3: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/3/HAnimHumanoid/-viewpoints/4: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/BoxMan.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/2/HAnimHumanoid/-viewpoints/0: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/2/HAnimHumanoid/-viewpoints/1: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/2/HAnimHumanoid/-viewpoints/2: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/2/HAnimHumanoid/-viewpoints/3: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/DiamondManLOA-0.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/0/HAnimHumanoid/-viewpoints/0: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/0/HAnimHumanoid/-viewpoints/1: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/0/HAnimHumanoid/-viewpoints/2: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/0/HAnimHumanoid/-viewpoints/3: extraneous key [Viewpoint] is not permitted /www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json <http://www.web3d.org/x3d/content/examples//Basic/HumanoidAnimation/NancyNativeTags.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/0/Transform/-children/1/Group/-children/0/Group: extraneous key [-value] is not permitted /www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadata.json <http://www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadata.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/Scene/-children/0/Transform/-children/1/Group/-children/0/Group: extraneous key [-value] is not permitted /www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadataViewer.json <http://www.web3d.org/x3d/content/examples//Basic/Medical/MedicalMetadataViewer.json>
> json-schema Validation error org.everit.json.schema.ValidationException: #/X3D/head: extraneous key [#comment] is not permitted /www.web3d.org/x3d/content/examples//X3dForAdvancedModeling/Buildings/Building.json <http://www.web3d.org/x3d/content/examples//X3dForAdvancedModeling/Buildings/Building.json>
> 
> 
>> On Mar 27, 2016, at 1:42 PM, Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu>> wrote:
>> 
>> thanks for cross-check John - we'll keep using Roy's, it is really good that we each have lead on different parts of the project.
>> 
>> On 3/27/2016 10:09 AM, John Carlson wrote:
>>> Here’s a schema replacing tabs with spaces.  Very easy to do in vim (you should use it! :).  Thanks Roy for developing the schema!
>>> 
>>> https://raw.githubusercontent.com/coderextreme/X3DJSONLD/master/x3d-3.3-JSONSchema.json <https://raw.githubusercontent.com/coderextreme/X3DJSONLD/master/x3d-3.3-JSONSchema.json>
>>> 
>>> 
>>> You can do a diff -w on the new and old files to confirm they are the same (I haven’t tested, so there may be an issue, especially if any of the actual schema contained tabs).  I didn’t just replace leading tabs, in other words.  Will run this through some schema tests now.
>>> 
>>> John
>>> 
>>> On Mar 27, 2016, at 12:52 PM, Don Brutzman <brutzman at nps.edu <mailto:brutzman at nps.edu> <mailto:brutzman at nps.edu <mailto:brutzman at nps.edu>>> wrote:
>>>> 
>>>> On 3/27/2016 5:36 AM, Roy Walmsley wrote:
>>>>> Don,
>>>>> 
>>>>> I'm assuming that the tabs were added automatically by XMLSpy, as I generated everything graphically. When I do the auto-generation (and I'm starting to think about that now) I'll ensure that I use spaces, not tabs. In the meantime, are you happy to continue with the --white command line switch?
>>>> 
>>>> Whitespace can be a tricky business in JSON.  Douglas Crockford is very assertive over what he thinks is best and does not hesitate to impose that unilaterally in jslint.  In part this is motivated by javascript tool pathologies, not just perceived coding style.  I found several places where people disagreed with his whitespace rules and disliked that there was not finer-grained control to ignore some aspects (e.g. allow tabs instead of space characters).
>>>> 
>>>> http://jslint.com <http://jslint.com/>
>>>> 
>>>> In addition to detailed explanations of rules and relaxations, he politely warns people that they may get really upset.
>>>> 
>>>> http://jslint.com/help.html
>>>> =================================================================================
>>>> [...]
>>>>> Please let me know if JSLint is useful for you. Is it too strict? Is there a check or a report that could help you to improve the quality of your programs? douglas at crockford.com. But please don't ask me to dumb JSLint down or to make it more forgiving of bad practices. You would only be disappointed.
>>>>> 
>>>>> I intend to continue to adapt JSLint based on your comments. Keep watching for improvements. Updates are announced at https://plus.google.com/communities/104441363299760713736.
>>>> [...]
>>>>> Perfectly fine
>>>>> 
>>>>> JSLint was designed to reject code that some would consider to be perfectly fine. The reason for this is that JSLint's purpose is to help produce programs that are free of error. That is difficult in any language and is especially hard in JavaScript. JSLint attempts to help you increase the visual distance between correct programs and incorrect programs, making the remaining errors more obvious. JSLint will give warnings about things that are not necessarily wrong in the current situation, but which have been observed to mask or obscure errors. Avoid those things when there are better options available.
>>>>> 
>>>>> It is dangerous out there. JSLint is here to help.
>>>>> 
>>>>> Warning
>>>>> 
>>>>> JSLint will hurt your feelings. Side effects may include headache, irritability, dizziness, snarkiness, stomach pain, defensiveness, dry mouth, cleaner code, and a reduced error rate.
>>>> =================================================================================
>>>> 
>>>> The jshint project appears in some part motivated by these differences in opinion.  They further warn that turning off jslint whitespace checking will allow some problems to pass through.
>>>> 
>>>> http://jshint.com
>>>> 
>>>> Recommendation: as usual, let's be "strict about what we produce and lenient about what we accept."  So for X3D JSON Schema, and X3dToJson.xslt conversion outputs, let's work to match the strict (no variation) whitespace rules that jslint advocates.  That way anyone else using these X3D products doesn't have to worry about whitespace at all.
>>>> 
>>>> If XML Spy lets you clean up schema whitespace in that fashion, then great.  I can then remove the "--white" command-line switch.  If it doesn't have that option, then let me double-check with you and then we can submit an issue report to them for future improvement.
>>>> 
>>>> If the whitespace issue is at all difficult or time-consuming to fix, then let's leave it alone and address the problem later when we begin to autogenerate the X3D JSON schemas, version by version, from the X3D XML Schema-generated X3D Object Model.
>>>> 
>>>> Best-case scenario: we eventually pass all validation tools without hiccups.
>>>> 
>>>>> Great work with the validation!
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Roy
>>>> 
>>>> Thanks again Roy for the super job on the X3D JSON Schema, another big step forward for all of us.  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 http://faculty.nps.edu/brutzman
>>> 
>> 
>> 
>> all the best, Don
>> -- 
>> Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu <mailto:brutzman at nps.edu>
>> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
>> X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman <http://faculty.nps.edu/brutzman>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160327/0601515d/attachment-0001.html>


More information about the x3d-public mailing list