[x3d-public] 4.0 generated X3D JSON schema

Brutzman, Donald (Don) (CIV) brutzman at nps.edu
Fri Jan 4 00:11:21 PST 2019


On 1/2/2019 5:13 PM, John Carlson wrote:
> Here’s a pointer to the X3D 4.0  JSON schema, autogenerated:
> 
> https://raw.githubusercontent.com/coderextreme/x3dschema/master/x3d-4.0-JSONSchema.json
> 
> Version 3.3 available on request (see folder above).
> 
> By all means review.
> 
> Major changes in enumerations.
> 
> John

Thanks John, very interesting!  Let's roll right into this topic after regular teleconference Friday, if you can attend.

Am interested in learning more how you autogenerated it (X3DUOM perhaps) and what changes you have made to the current JSON schema.

http://www.web3d.org/specifications
http://www.web3d.org/specifications/x3d-3.3-JSONSchema.json
http://www.web3d.org/specifications/X3dJsonSchemaDocumentation3.3/x3d-3.3-JSONSchema.html

Versions of JSON schemas (latest is still draft-07) are found at

	https://json-schema.org

X3D JSON pages are at

	X3D JSON Encoding
	http://www.web3d.org/wiki/index.php/X3D_JSON_Encoding

	X3DJSONLD: JavaScript Loader for X3D JSON
	https://github.com/coderextreme/X3DJSONLD

	X3D to JSON Stylesheet Converter
	http://www.web3d.org/x3d/stylesheets/X3dToJson.html

There is also a draft specification document in the github specification archive - members only.

	X3D/ISO-IEC 19776/ISO-IEC 19776-5/ISO-IEC 19776-5 V3.3/ISO-IEC 19776-5 V3.3 WD1/
	https://github.com/Web3DConsortium/X3D/tree/master/ISO-IEC%2019776/ISO-IEC%2019776-5/ISO-IEC%2019776-5%20V3.3/ISO-IEC%2019776-5%20V3.3%20WD1

If memory serves, believe that draft and the 3.3 JSON schema was manually authored by Roy Walmsley.

Here's a comparison of prior Anchor definitions (3.3 and 4.0) with your new Anchor definition.  Looks like ordering of attribute definitions is a little different but otherwise quite similar.

=================================================================
{
	"$schema": "http://json-schema.org/draft-06/schema#",
	"title": "JSON Schema X3D V3.3",
	"description": "Experimental JSON Schema for X3D V3.3 ",
	"type": "object",
	"properties": {
		"X3D": {
			"$ref": "#/definitions/X3D"
		}
	},
	"required": [
		"X3D"
	],
	"additionalProperties": false,
	"definitions": {
		"Anchor": {
			"type": "object",
			"properties": {
				"@DEF": {
					"type": "string"
				},
				"@USE": {
					"type": "string"
				},
				"IS": {
					"$ref": "#/definitions/IS"
				},
				"@bboxCenter": {
					"type": "array",
					"minItems": 3,
					"maxItems": 3,
					"items": {
						"type": "number",
						"default": 0
					}
				},
				"@bboxSize": {
					"$ref": "#/definitions/@bboxSize"
				},
				"-children": {
					"$ref": "#/definitions/-children"
				},
				"@description": {
					"type": "string"
				},
				"-metadata": {
					"$ref": "#/definitions/-metadata"
				},
				"@parameter": {
					"type": "array",
					"minItems": 1,
					"items": {
						"type": "string"
					}
				},
				"@url": {
					"type": "array",
					"minItems": 1,
					"items": {
						"type": "string",
						"format": "uri-reference"
					}
				}
			},
			"additionalProperties": false
		},

=================================================================
x3d-4.0-JSONSchema.2019JAN3.json (your latest)

{
   "$schema": "http://json-schema.org/draft-07/schema#",
   "title": "JSON Schema X3D V3.3",
   "description": "Experimental JSON Schema for X3D V3.3 ",
   "type": "object",
   "properties": {
     "X3D": {
       "$ref": "#/definitions/X3D"
     }
   },
   "required": [
     "X3D"
   ],
   "additionalProperties": false,
   "definitions": {
     "-childrenStatements": {

[... snip ...]

     "Anchor": {
       "type": "object",
       "oneOf": [
         {
           "type": "object",
           "properties": {
             "@USE": {
               "type": "string"
             },
             "-children": {
               "type": "array",
               "minItems": 1,
               "items": {
                 "type": "object",
                 "properties": {
                   "#comment": {
                     "type": "string"
                   }
                 },
                 "additionalProperties": false
               }
             }
           },
           "required": [
             "@USE"
           ],
           "additionalProperties": false
         },
         {
           "type": "object",
           "properties": {
             "IS": {
               "$ref": "#/definitions/IS"
             },
             "@bboxCenter": {
               "type": "array",
               "minItems": 3,
               "maxItems": 3,
               "items": {
                 "default": 0,
                 "type": "number"
               }
             },
             "@bboxSize": {
               "type": "array",
               "minItems": 3,
               "maxItems": 3,
               "items": {
                 "default": -1,
                 "type": "number"
               }
             },
             "-children": {
               "$ref": "#/definitions/-X3DChildNodeMFNode"
             },
             "@description": {
               "type": "string"
             },
             "-metadata": {
               "$ref": "#/definitions/-X3DMetadataObjectSFNode"
             },
             "@parameter": {
               "type": "array",
               "items": {
                 "type": "string"
               }
             },
             "@url": {
               "type": "array",
               "minItems": 1,
               "items": {
                 "format": "uri-reference",
                 "type": "string"
               }
             },
             "@DEF": {
               "type": "string"
             },
             "@class": {
               "type": "string"
             }
           },
           "additionalProperties": false
         }
       ]
     },
=================================================================

Wondering if you have used any JSON Schema Validators to test this?

	https://json-schema.org/implementations.html#validators

I tried validating HelloWorld.json as test scene at

	http://www.web3d.org/x3d/content/examples/HelloWorld.json

- No joy with latest Altova XML Spy, it is stuck on JSON schema v4.

- https://json-schema-validator.herokuapp.com assumes draft-04

- https://www.jsonschemavalidator.net reports 9 errors when validating against your schema:

  Found 9 error(s)
No errors found. JSON validates against the schema

Message:
     Property '$schema' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'title' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'description' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'type' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'properties' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'required' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'additionalProperties' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Property 'definitions' has not been defined and the schema does not allow additional properties.
Schema path:
     #/additionalProperties

Message:
     Required properties are missing from object: X3D.
Schema path:
     #/required
=================================================================

we can likely expect tool immaturity to continue until they get to draft-08 but it is good to refine this anyway if we can.

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


More information about the x3d-public mailing list