[x3d-public] New feature of X3D JSON validator: URLs

John Carlson yottzumm at gmail.com
Tue Feb 15 21:15:48 PST 2022


TL;DR

It makes more sense if the JSON is invalid.  If the JSON is invalid, one is
given the choice of cancel vs ok.   If you click ok, then it takes you to
the alert you see when the document is valid.   The idea behind this shows
up in the main idea behind the main X3DJSONLD app—if the user discovers
some invalid JSON, they may want to either cancel—stop loading, or click
ok—continue to rendering and event processing.

I would like to change the validation software to change the HTML page
based on what the results are, for better automated processing;  but right
now, it’s more user-centered.  Obviously the invalid alert is too small,
and something on the web page would be more readable and processable.

You can easily change the JSON on the page to test scenarios.

I think the doValidate function variable may not currently be set properly.
  It may need work, but simple tests seem to work right now.

I hope this helps.

I hope to continue the approach where the user  is not required to submit
anything to the back end server—everything is done in the browser.   I
don’t want to be accused of storing information about the user.   I think
it may be understood that web page accesses are stored in access logs; no
surprise there, I hope.

I am wondering if I should continue this URL-JSON submittal into the main
X3DJSONLD app.   I’m a bit worried about cross-site request forgery,
cross-site scripting, etc.   Thus I have left all security settings on.   I
have not set more restrictive settings.   If the user wants to set a
different CORS policy on their submitted URLs, or turn off CORS in the
browser, that’s up to them.   I don’t want to be involved.  If someone
wants me to validate JSON, I will do my best not to record the JSON on a
server somewhere.   It would be nice to load JSON from a URL to demonstrate
any bugs in X_ITE or X3DOM, instead of doing a potentially buggy copy/paste.

More suggestions for enhancements are welcome, including forks and pull
requests on GitHub.

I do think that getting a more automated approach is desirable, and the
submitted URL is the first step.   Any automated client approach may
include a JavaScript interpreter in Java.   I’m not prepared to go there
yet, and if you don’t want to go that direction either, I won’t pursue it,
we’ll have to wait until Java has officially supported JSON draft schema
2020-12 support, or you jump on a python or JavaScript (or other language)
solution.   I can show you a couple of Python test programs if python
interests you.

I am trying to balance enhancements to old software with new requests.   I
wasn’t even aware of any validation users before this.

Anyway, I am glad to provide this important X3D JSON validator to the X3D
community.   I know one has a choice of JSON validators, maybe some are not
so easy to use and require  uploads to a remote server instead of loading
directly into the browser.  Or they cost hundreds of dollars.  If you would
like to fund this validator, please fund Ajv.   Thanks!

Enjoy!

John

On Tue, Feb 15, 2022 at 10:02 PM Brutzman, Donald (Don) (CIV) <
brutzman at nps.edu> wrote:

> Hi John.  Your application ran but provided an ambiguous result:
>
>
>
>    - “coderextreme.net says: Valid or user clicked OK”
>
>
>
> 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:* Monday, February 14, 2022 4:54 PM
> *To:* X3D Graphics public mailing list <x3d-public at web3d.org>
> *Subject:* [x3d-public] New feature of X3D JSON validator: URLs
>
>
>
>
> https://coderextreme.net/X3DJSONLD/src/main/html/validator.html?https://coderextreme.net/X3DJSONLD/src/main/data/rubik.json
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fcoderextreme.net%2FX3DJSONLD%2Fsrc%2Fmain%2Fhtml%2Fvalidator.html%3Fhttps%3A%2F%2Fcoderextreme.net%2FX3DJSONLD%2Fsrc%2Fmain%2Fdata%2Frubik.json&data=04%7C01%7Cbrutzman%40nps.edu%7C47e91961b51e4cbeed3408d9f01db93a%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637804833362618013%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=w9IwF30J4tsDKtJ3CzvdPNuF1JNDSqrTyCRFKFdXswM%3D&reserved=0>
>
>
>
> This will load the JSON into the web page without having to copy/paste.
> Note that the server following the ? will have to have the CORS setting
> (see CORS references on
> https://www.web3d.org/x3d/content/examples/X3dResources.html), or the
> origins should be the same.
>
>
>
> The validator.html source code can be downloaded from:
>
>
>
> https://github.com/coderextreme/X3DJSONLD
> <https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcoderextreme%2FX3DJSONLD&data=04%7C01%7Cbrutzman%40nps.edu%7C47e91961b51e4cbeed3408d9f01db93a%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637804833362618013%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=dGA3ehNw64WdSfpLT49MqwKISoUaaVLKc%2Beotz9E9Ng%3D&reserved=0>
>
>
>
> Note that validation will not begin immediately, and will require that you
> click the validation link. above the JSON.
>
>
>
> If anyone has good idea for enabling this link from a Java client, please
> let me know.  I want the errors from the alert to go back to the client.
>
>
>
> John
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220215/43de5f2d/attachment.html>


More information about the x3d-public mailing list