[x3d-public] How to achieve JSON validation.

John Carlson yottzumm at gmail.com
Mon Jan 23 17:34:47 PST 2023


I don’t expect devs using JavaScript to also use my JSON schema in a
browser.  My guess is that they will do validation on the server, such that
the schema does not need to be downloaded.  Or if validation is necessary
in the browser, they may shrink the schema.  Another option is to convert
JSON to a DOM document (X3DJSONLD.*) and validate the DOM document.
Software other than mine should provide their own/borrowed validation
routines.   I’m expecting the DOM or scenegraph to be validated, not the
JSON.   Whatever validates the DOM document or scenegraph will also
validate the encodings (JSON).   This reduces the number of
encodings/bindings to validate.   If someone wants to use a recent,
non-standardized JSON schema in an X3d JavaScript program, let me know.

My website supports php on the server, not node, java or python.   For that
reason, I provide JSON validation in the browser.   I provide validation as
a free service (hint: I didn’t write the validation routines).
https://coderextreme.net/X3DJSONLD/validator.html (not recently tested)

JavaScript SAI (es6x3d?) should proceed, but I’m not going to validate the
JavaScript objects if they extend beyond something like JSON!   If someone
wants to work on JavaScript SAI validation, speak up!

The reason we don’t need JSON schema validation in Java is 1) we expect X3D
to be written primarily in Java, and 2) There’s XML/DOM validation.  3)
There’s scenegraph validation.

I offer X3DJSONLD.java free as a converter from a JSON object to a DOM
document.

John

On Mon, Jan 23, 2023 at 5:25 PM John Carlson <yottzumm at gmail.com> wrote:

> I have not tested the X3DJSAIL build recently, it’s been over a week since
> this was reported.
>
> I was hoping we could get a buildable X3DJSAIL, sorry that I misused “it.”
>  I do that a lot and strive to improve upon.  At this time, I don’t know
> the status of X3DJSAIL.  I will assume I can rebuild safely.  I do know
> that issue tickets (ala github) can improve communication.
>
> To clarify:
>
> I use X3DJSAIL’s DOM+validation code to validate JSON files in a java app
> (Validat….java) would be more correct.   I cannot do that if the X3DJSAIL
> jar doesn’t build; my build breaks if X3DJSAIL build breaks.   There’s no
> JSON Schema involved.   I have moved my X3DJSAIL jar location in my
> subversion repository to something  that doesn’t get deleted.  That means
> my X3DJSAIL is disconnected from the standard build.  I know your goal is
> to have a “client-facing” X3DJSAIL, such that you don’t have to support
> X3DJSAIL builds by others.   I know I’m on the bleeding edge.   I will try
> to step back and proceed with tickets on sourceforge.net.
>
> As TextureProjector is new in X3D4, perhaps X3DJSAIL does not include it
> yet?
>
> Frankly, I’m hoping for something even better than JSON schema, I don’t
> hold your same hope for JSON schema standards as you do.   I hope that
> someone can come up with something like es6x3d to do validation of JSON
> files.   Since we already have a python validator and a Java validator, a
> JavaScript validator seems appropriate.   I apologize for taking us down
> the JSON Schema path.   I thought it would provide security that
> X3DJSONLD.js does not provide but Ajv does (don’t click ok).  I’ve even
> implemented a JSON validator on my website.
>
> As we’ve noted, Khronos has moved to standardize without a standard JSON
> schema. We already know of tools like JSON parsers get us much of the way.
>
> I believe full implementation of JavaScript SAI validation may be the
> future.   There are at least 4 starting points to choose from.
>
> John
>
> On Mon, Jan 23, 2023 at 2:12 PM Brutzman, Donald (Don) (CIV) <
> brutzman at nps.edu> wrote:
>
>> John, there is no JSON validation in X3D-Edit or X3DJSAIL because there
>> is not standardized JSON Schema.  When that occurs, we can
>> update/autogenerate X3D JSON Schema and begin testing tools.
>>
>>
>>
>> Given the expressive power of JSON Schema, am expecting that future tests
>> will match prior tests and detect encoding errors similar to expressive
>> power of X3D XML Schema.
>>
>>
>>
>> Not new news…  Until then I don’t want to keep repeating work that is not
>> completely correct.  Hope this helps.
>>
>>
>>
>> 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 https://
>> faculty.nps.edu/brutzman
>>
>>
>>
>> *From:* x3d-public <x3d-public-bounces at web3d.org> *On Behalf Of *John
>> Carlson
>> *Sent:* Wednesday, January 18, 2023 4:24 AM
>> *To:* X3D Graphics public mailing list <x3d-public at web3d.org>; Michalis
>> Kamburelis <michalis.kambi at gmail.com>
>> *Subject:* Re: [x3d-public] Weird java compilation problem building
>> X3DJSAIL. Waiting patiently. Zzz
>>
>>
>>
>> IFS.json passes X3DJSAIL validation, Ajv validation, and as we've seen,
>> it passes validation in X3D-Edit.
>>
>>
>>
>> So far, it only reports errors as XML in view3dscene. tested in
>> X3D-Edit.  I will pass this off to Michalis for now.
>>
>>
>> JSON and XML attached.
>>
>>
>>
>> On Wed, Jan 18, 2023 at 6:08 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>> Repeat by using:
>>
>>
>>
>> $ ant create.X3DJSAIL
>>
>>
>>
>> (update recently done...any other steps required?)
>>
>>
>>
>> I can't do JSON validation with Java/X3DJSAIL without a jar,  I will try
>> with an older jar with a similar name.
>>
>>
>>
>> John
>>
>>
>>
>> On Sun, Jan 15, 2023 at 12:21 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>> I’m hoping some X3DJSAIL/ant people could address this.  Patiently
>> waiting, I haven’t updated my copy today.
>>
>>
>>
>> On Sat, Jan 14, 2023 at 3:32 AM John Carlson <yottzumm at gmail.com> wrote:
>>
>> Error: "org.web3d.x3d.sai.TextureProjector does not exist"
>>
>>
>>
>> I will try to rebuild from source folder.
>>
>>
>>
>> John
>>
>>
>>
>> create.X3DUOM.JAXB.schema:
>>
>>      [echo] Netbeans 11+ (Java 12+) prerequisite is to include following
>> in your netbeans.conf file:
>>
>>      [echo]
>>  -J-Djavax.xml.bind.context.factory=com.sun.xml.bind.v2.ContextFactory
>>
>>      [echo] Ant xjc with classpath=C:\x3d-code\www.web3d.org
>> \x3d\stylesheets\java\lib\support\jaxb/*.jar
>>
>>       [xjc] Consider using <depends>/<produces> so that XJC won't do
>> unnecessary compilation
>>
>>       [xjc] Compiling file:/C:/x3d-code/
>> www.web3d.org/specifications/X3dUnifiedObjectModel.xsd
>>
>>       [xjc] Writing output to C:\x3d-code\www.web3d.org
>> \x3d\stylesheets\java\src
>>
>>      [echo] Compiling org.web3d.x3d.x3duom JAXB classes
>>
>>     [javac] Compiling 29 source files to C:\x3d-code\www.web3d.org
>> \x3d\stylesheets\java\classes
>>
>>     [javac] warning: [options] system modules path not set in conjunction
>> with -source 16
>>
>>     [javac] 1 warning
>>
>>      [echo] create autogenerated Java source code:
>>
>>      [java] source-code autogeneration assist: $insertSourceMarkers=false
>>
>>      [copy] Copying 1 file to C:\x3d-code\www.web3d.org
>> \x3d\stylesheets\java\src\org\web3d\x3d\sai
>>
>>      [copy] Copying C:\x3d-code\www.web3d.org\x3d\stylesheets\java\X3DJSAIL.html
>> to C:\x3d-code\www.web3d.org
>> \x3d\stylesheets\java\src\org\web3d\x3d\sai\overview.html
>>
>>      [echo] Compiling C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src/org/web3d/x3d/sai
>> interfaces
>>
>>     [javac] anomalous package-info.java path: package-info.java
>>
>>     [javac] Compiling 453 source files to C:\x3d-code\www.web3d.org
>> \x3d\stylesheets\java\classes
>>
>>     [javac] warning: [options] system modules path not set in conjunction
>> with -source 16
>>
>>     [javac] C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\org\web3d\x3d\sai\TextureProjection\TextureProjector.java:59:
>> error: package org.web3d.x3d.sai.TextureProjector does not exist
>>
>>     [javac] public interface TextureProjector extends
>> org.web3d.x3d.sai.TextureProjector.X3DTextureProjectorNode
>>
>>     [javac]
>>                 ^
>>
>>     [javac] C:\x3d-code\www.web3d.org\x3d\stylesheets\java\src\org\web3d\x3d\sai\TextureProjection\TextureProjectorParallel.java:59:
>> error: package org.web3d.x3d.sai.TextureProjector does not exist
>>
>>     [javac] public interface TextureProjectorParallel extends
>> org.web3d.x3d.sai.TextureProjector.X3DTextureProjectorNode
>>
>>     [javac]
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230123/b850c302/attachment-0001.html>


More information about the x3d-public mailing list