JSON Node - Schema validation

Is it possible to validate JSON object schema without converting it to string?
I just want to validate it, not convert.

Yes, the node has the option to ensure the output is a particular type ... I can't remember the exact words we used in the option, but it's there.

Actually, having had a quick look at the code, it appears it only validates when doing the conversion. If the payload is already the required type, it doesn't validate.

If you wanted to raise an issue so we do not forget, I think it would be sensible for the node to support validation without conversion.

Not the right repo for a core node (https://github.com/node-red/node-red) but thanks anyway.

Now I know why I couldn't find code... :slightly_smiling_face:

Hello I am not seeing how to reference a JSON Schema file or paste in the JSON Schema text in the JSON node. Am I missing something?

Or should I be using this node?
npm install node-red-contrib-full-msg-json-schema-validation

Hi - you need to pass it in with the message to check. msg.schema should contain the schema and msg.payload the message to check.

Of my 35+ years of integration work and 20+ years of data exchange standards work, I can confidently state that to send the schema with a payload is far from being normal and customary. Endpoints MUST enforce the defined contract, therefore this capability should in the JSON node. Perhaps the full-msg-json-schema-validation contribution could be incorporated in the core JSON node. I have the other mentioned node working just fine, validating the payload to a standard OAGIS PurchaseOrder JSON Schema.

Yes we agree.

We added support for passing in the schema in with the message as a pragmatic enhancement that didn't require any changes to the UI. I would be great to get the UI updated - just needs someone to offer up their time to do it, otherwise it sits on the backlog along with everything else that 'must' be done until I, or another regular contributor, picks it off the list to do.

Of my 39+ years of integration and 10+ years of working on open source, I can confidentiy state that nothing gets fixed unless someone steps up to help. We look forward to your contribution.


Is the JSON node is in the node-red or node-red-nodes repo?

Has this existing code based on JSON Schema Draft 4 (seems to be the lowest common denominator)?
Are you organizing branches as 'feature' branches? Guidelines for this?

I should have time to take a look after we get the OAGi Express Pack out this week. We have a number of pre-defined MVP JSON Schemas, and hope to create a PoC on Node-RED to showcase them. The JSON schema validation support will be good. Maybe in future expand to OpenAPI schema object validation.

I’m entertained Dave :smiley: