[x3d-public] Discussion about another ECMAScript SAI Library.

John Carlson yottzumm at gmail.com
Wed Apr 8 16:10:50 PDT 2020


Suggest we annotate the X3DJSAIL POJOs in one of these ways for easier
JAX-B schema generation:
https://github.com/victools/jsonschema-generator/blob/master/README.md

Need some help on this one, since it will involve modifying the stylesheet
for Java code.

I will try to pull together a project that will demonstrate Java-based JSON
schema generation (for draft 2019-09).  Meanwhile, see my comments:
https://github.com/victools/jsonschema-generator/issues/70

Note, the annotations should be for the JSON property, comment, text and
field names.

This build script will get you half the way there.

What is the plan for automatic JSON schema generation?

Checked in at: /x3d-code/www.web3d.org/x3d/stylesheets/java/src/build.sh
#!/bin/bash

# generate a schema from X3DJSAIL

export HOME=c:/Users/coderextreme
export REPOSITORY=${HOME}/.m2/repository
javac -cp
"${REPOSITORY}/org/slf4j/slf4j-jdk14/1.7.12/slf4j-jdk14-1.7.12.jar;${REPOSITORY}/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar;${REPOSITORY}/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar;${HOME}/jsonschema-generator/jsonschema-generator/target/jsonschema-generator-4.10.0-SNAPSHOT.jar;../jars/X3DJSAIL.3.3.full.jar;."
net/coderextreme/SchemaG.java
npm install -g jsonlint
java -cp
"${REPOSITORY}/org/slf4j/slf4j-jdk14/1.7.12/slf4j-jdk14-1.7.12.jar;${REPOSITORY}/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar;${REPOSITORY}/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar;${HOME}/jsonschema-generator/jsonschema-generator/target/jsonschema-generator-4.10.0-SNAPSHOT.jar;../jars/X3DJSAIL.3.3.full.jar;."
net.coderextreme.SchemaG | jsonlint




On Wed, Apr 8, 2020 at 4:14 PM John Carlson <yottzumm at gmail.com> wrote:

> The author of jsonschema-generator suggested looking at their test cases,
> so I did.  I have 2 that look relevant to the multiclass situation:
>
>
> https://github.com/victools/jsonschema-generator/issues/70#issuecomment-611191905
>
> I'm guessing that this will generate a schema very different from the
> existing JSON schemas, and will be similar to the XML schema.  Thus in
> order to use any JSON schema we generate from this, we will either have to
> annotate the X3DJSAIL classes, or hand modify the generated schema.  I have
> provide the caretaker of jsonschema-generator with the X3DJSAIL page, and
> my maven project that mirrors X3DJSAIL (I think he'll want to use maven).
>
> John
>
> On Wed, Apr 8, 2020 at 2:13 PM John Carlson <yottzumm at gmail.com> wrote:
>
>> examples for jsonschema-generator only show 1 client class.  Whether this
>> is enough, remains to be seen.
>>
>> On Wed, Apr 8, 2020 at 2:04 PM John Carlson <yottzumm at gmail.com> wrote:
>>
>>> Don:  One may be interested in generating JSON schema from Java classes
>>> (a new twist), replacing prototype Python code:
>>>
>>> https://github.com/victools/jsonschema-generator
>>>
>>> Kambi, you may be interested in this Delphi app:
>>>
>>> https://github.com/schlothauer-wauer/DJsonSchema
>>>
>>>
>>>
>>> On Wed, Apr 8, 2020 at 1:45 PM John Carlson <yottzumm at gmail.com> wrote:
>>>
>>>> google "create ECMAScript classes from JSON schema"
>>>>
>>>> On Wed, Apr 8, 2020 at 1:42 PM John Carlson <yottzumm at gmail.com> wrote:
>>>>
>>>>> Hmm.  Other, perhaps better links are showing up for constructing
>>>>> ECMAScript classes from JSON schema.  Anyone care to review them?
>>>>>
>>>>> On Wed, Apr 8, 2020 at 1:28 PM John Carlson <yottzumm at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> If you read anything in this email, read the final paragraph.
>>>>>>
>>>>>> $ wc x_ite.js
>>>>>>  117547  459584 3631471 x_ite.js
>>>>>> $ wc x3dom-full.js
>>>>>>    8211   29765 1526481 x3dom-full.js
>>>>>>
>>>>>> Current ECMAScript library version of X3DJSAIL
>>>>>> $ find org -name '*.js'|xargs cat|wc
>>>>>>  530284 2544727 30175297
>>>>>>
>>>>>> As you can see, a potential library created from X3DJSAIL would be
>>>>>> around 300MB, much larger than x_ite.js or x3dom-full.js.
>>>>>>
>>>>>> What are the benefits to the ECMAScript developer for X3DESAIL?
>>>>>> validation? use of stylesheets?  Is that worth 270MB, downloaded over the
>>>>>> web?  Especially if ECMAScripts are also downloaded, and may be excluded
>>>>>> from the application by ECMAScript blockers?
>>>>>>
>>>>>> Consider that all the JSON schemas together are only 3MB, or 144kB
>>>>>> compressed:
>>>>>>
>>>>>> $ wc x3d-[3-4]*a.json
>>>>>>   15638   25131  401463 x3d-3.0-JSONSchema.json
>>>>>>   18179   29269  467163 x3d-3.1-JSONSchema.json
>>>>>>   26266   42638  679482 x3d-3.2-JSONSchema.json
>>>>>>   28221   45877  731894 x3d-3.3-JSONSchema.json
>>>>>>   28801   46716  751848 x3d-4.0-JSONSchema.json
>>>>>>  117105  189631 3031850 total
>>>>>>
>>>>>> $ cat x3d-[3-4]*a.json|gzip -c|wc
>>>>>>     586    3029  143877
>>>>>>
>>>>>> Perhaps it would be better to develop an X3DESAIL from JSON schema
>>>>>> instead of X3DUOM? :) :)   What if we could create X3D potential libraries
>>>>>> from *any* JSON schema?
>>>>>>
>>>>>> Are we just trying to do SAI on the web?   Isn't that what X_ITE does?
>>>>>>
>>>>>> Surely there is already a second implementation of ECMAScript SAI???
>>>>>>
>>>>>> It would seem like a good target for X3DESAIL would be 1100kB--The
>>>>>> difference between X_ITE and X3DOM.   What are the differences between
>>>>>> X_ITE and X3DOM, and when should I choose one over the other (I've heard
>>>>>> Leonard's comment that X_ITE is not enterprise s/w).
>>>>>>
>>>>>> I do not have extensive knowledge of either X_ITE or X3DOM.  I
>>>>>> learned just enough to slide X3DJSONLD and the PrototypeExpander (only for
>>>>>> X3DOM) into the codebases.
>>>>>>
>>>>>> I think it would be better to focus on particular tags that would be
>>>>>> useful as a replacement for a lot of ECMAScript, moving even farther away
>>>>>> from dependency on scripts? What can we learn from our current scripts?
>>>>>>
>>>>>> I've already suggested that we use D3.js as a basis for new tags for
>>>>>> data visualization.  What tag support is there currently for data
>>>>>> visualization (charts)?  I've also suggested that we have XPath or similar
>>>>>> for route to/from nodes.   What can we learn from OpenInventor?
>>>>>>
>>>>>> This appears like a fairly good way to get an ECMAScript library
>>>>>> from JSON schema:
>>>>>> https://stackoverflow.com/questions/55157190/generate-javascript-classes-from-json-schema/55157356
>>>>>> what do you think?
>>>>>>
>>>>>> John
>>>>>>
>>>>>>
>>>>>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20200408/07c2f58e/attachment.html>


More information about the x3d-public mailing list