[x3d-public] json schema validation problem: "-children" commentsinside"head"element

Roy Walmsley roy.walmsley at ntlworld.com
Sat Jul 2 11:41:11 PDT 2016


John,

 

You are right, the “#comment” is not permitted as you list in the first listing below, and in your appended file. Furthermore, when I amend your file to reproduce the last listing, it also fails validation. This is what I expect. I am using XMLSpy as my validation tool? What are you using?

 

As you deduced, the “-textureTransform” field has no child. And there can be no comment within the field. The comment would have to precede the field. An example would be:

 

                    "Appearance": {

                      "@DEF": "DECLDarkOak_INSTANCE_DarkOakAppearance",

                      "-children": [

                        {

                          "#comment": "textureTransform field IS exposed through the Prototype field interface with same name"

                        },

                        {

                          "#comment": "NULL node as child"

                        }

                      ],

                      "-textureTransform": {

                      },

                      …

 

 

 

 

From: John Carlson [mailto:yottzumm at gmail.com] 
Sent: 02 July 2016 13:03
To: Roy Walmsley
Cc: X3D Graphics public mailing list; Don Brutzman
Subject: RE: json schema validation problem: "-children" commentsinside"head"element

 

This is only in the prototype expander.  Now fairly sure there is a bug in my code.  The #comment in question in red, and I’m assuming it’s getting there because the textureTransform field did not get set:

"-appearance": {

                    "Appearance": {

                      "@DEF": "DECLDarkOak_INSTANCE_DarkOakAppearance",

                      "-children": [

                        {

                          "#comment": "textureTransform field IS exposed through the Prototype field interface with same name"

                        }

                      ],

                      "-textureTransform": {

                        "#comment": "NULL node as child"

                      },

                      "-material": {

                        "Material": {

                          "@diffuseColor": [

                            1,

                            0.45,

                            0.23

                          ]

                        }

                      },

                      "-texture": {

                        "ImageTexture": {

                          "@DEF": "DECLDarkOak_INSTANCE_wood_g",

                          "@url": [

                            "wood_g.jpg",

                            "http://www.web3d.org/x3d/content/examples/Vrml2.0Sourcebook/Chapter31-Prototypes/wood_g.jpg"

                          ]

                        }

                      }

 

Here’s a good one in the same file:

 

         "-textureTransform": {

                        "TextureTransform": {

                          "@center": [

                            0,

                            5

                          ],

                          "@rotation": 0.758,

                          "@scale": [

                            2,

                            0.5

                          ],

                          "@translation": [

                            0.5,

                            0

                          ]

                        }

                      },

>From the prototype expansion of:

 

examples/Vrml2.0Sourcebook/Chapter31-Prototypes/Figure31.5WoodAppearanceExternalPrototypes.json

Looking at the JSON, it looks like the node should appear like:

 

                      "-textureTransform": {

                         “-children”: [ {

                        "#comment": "NULL node as child"

                         }]

                      },

 

Which does pass schema without error. Why, I don’t know.  Is this the general way to get extra nodes into a containerField through JSON schema?  Roy?   Full prototype expanded file attached.

 

Hmm.

Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986>  for Windows 10

 

From: John Carlson <mailto:yottzumm at gmail.com> 
Sent: Saturday, July 2, 2016 7:22 AM
To: Don Brutzman <mailto:brutzman at nps.edu> ; Roy Walmsley <mailto:roy.walmsley at ntlworld.com> 
Cc: X3D Graphics public mailing list <mailto:x3d-public at web3d.org> 
Subject: RE: json schema validation problem: "-children" commentsinside"head"element

 

Turns out there’s a bug in my program.

 

John

 

Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986>  for Windows 10

 

From: John Carlson <mailto:yottzumm at gmail.com> 
Sent: Saturday, July 2, 2016 6:38 AM
To: Don Brutzman <mailto:brutzman at nps.edu> ; Roy Walmsley <mailto:roy.walmsley at ntlworld.com> 
Cc: X3D Graphics public mailing list <mailto:x3d-public at web3d.org> 
Subject: RE: json schema validation problem: "-children" comments inside"head"element

 

I believe I have another place where #comment should appear, but it’s not allowed.  This may be a more general problem that will be solved when the schema is generated from the object model (it’s too hard to put all the #comments in by hand, I think, but I could be wrong).  Meanwhile, if you need a file to pass, I suggest hand modifying the schema.

 

John

 

Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986>  for Windows 10

 

From: Don Brutzman <mailto:brutzman at nps.edu> 
Sent: Saturday, July 2, 2016 2:04 AM
To: Roy Walmsley <mailto:roy.walmsley at ntlworld.com> 
Cc: John Carlson <mailto:yottzumm at gmail.com> ; X3D Graphics public mailing list <mailto:x3d-public at web3d.org> 
Subject: json schema validation problem: "-children" comments inside "head"element

 

Am getting json validation errors like the following when a comment appears inside a head tag, originally as peer of meta tags.

 

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

validation error:

 

C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors/Chapter05-AppearanceMaterialTextures//FillProperties.json error checking with json-schema-validator

--- BEGIN C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\Chapter05-AppearanceMaterialTextures\FillProperties.json---

validation: FAILURE

[ {

   "level" : "error",

   "schema" : {

     "loadingURI" : "file:/C:/x3d-code/www.web3d.org/specifications/x3d-3.3-JSONSchema.json#",

     "pointer" : "/definitions/head"

   },

   "instance" : {

     "pointer" : "/X3D/head"

   },

   "domain" : "validation",

   "keyword" : "additionalProperties",

   "message" : "object instance has properties which are not allowed by the schema: [\"-children\"]",

   "unwanted" : [ "-children" ]

} ]

--- END C:\x3d-code\www.web3d.org\x3d\content\examples\X3dForWebAuthors\Chapter05-AppearanceMaterialTextures\FillProperties.json---

Java Result: 100

 

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

snippets:

 

     "head": {

         "-children":[

           { "#comment":"The following component tag is needed since FillProperties node is not part of the default Immersive profile"

           }

         ],

         "component": [

           {

             "@name":"Shape",

             "@level":3

           }

         ],

         "meta": [

           {

             "@name":"title",

             "@content":"FillProperties.x3d"

           },

           {

             "@name":"description",

             "@content":"Demonstrate various FillProperties values."

           },

etc.

         ]

     },

 

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

   <head>

     <!-- The following component tag is needed since FillProperties node is not part of the default Immersive profile -->

     <component level='3' name='Shape'/>

     <meta content='FillProperties.x3d' name='title'/>

     <meta content='Demonstrate various FillProperties values.' name='description'/>

etc.

   </head>

 

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

 

I think that the json schema needs to be allow the "-children" field here, and similarly inside other statements, wherever a "#comment" is allowed to appear.

 

Once we get this sorted out, we should check on the corresponding prose in the new draft X3D JSON Encoding specification.

 

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

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160702/035a6341/attachment-0001.html>


More information about the x3d-public mailing list