json-schema validation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 04:23 AM
Hi,
Has anyone ever worked on implementing one of the many JSON Schema validation modules/libraries that exist out there? It takes a little bit of work to adjust them to a script include (unless there is an easy solution to convert an AMD or CommonJS library into something usable in ServiceNow (have not found so far).
With scripted REST API ramping up, it would be very interesting for ServiceNow to add something like this out of the box anyhow.
Any thoughts?
Regards,
Jacques Clement
- Labels:
-
Integrations
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2017 06:41 AM
Hi Jacques,
I couldn't agree more than it would be great to have some validation built in - especially for incoming REST payloads. Outbound is pretty safe when you construct your object and use JSON.stringify(), but incoming would be very nice to validate before parsing it.
I invite you to open an enhancement request! Our product managers DO listen.
Enhancement requests: Tell us how you would improve the ServiceNow product
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2017 01:07 PM
Thanks for taking the time, will do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-02-2017 04:51 AM
So we finally managed to implement JSON schema validation by adapting the tv4 library to a script include. Now building a scripted API has become so much easier when it comes to verifying the incoming payload. Hope this will help others.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2018 07:27 AM
Hi Jacques.
Did you do much modification to the tv4.js library or was basically a drop in as a script include?
I tested adding the library without modification as a script include on my private instance at it seems to work fine but I'm wondering if using it unmodified could have some other consequences like in system performance.
Best regards,
Ingimar