How to validate against a definition within a schema?

333 Views Asked by At

I want to have a single schema file with many definitions.

I then want to validate messages against different definitions within that schema.

Is there a way of doing this with a JSON Schema?

I'm trying two NodeJS validators to see which works best: https://github.com/geraintluff/tv4 and https://github.com/tdegrunt/jsonschema

Apologies if this is not logically possible - I'm new to JSON Schema.

Cross-posted to https://github.com/geraintluff/tv4/issues/170 and https://github.com/tdegrunt/jsonschema/issues/94

1

There are 1 best solutions below

0
On BEST ANSWER

I found what I needed in the API section.

tv4.addSchema() and tv4.getSchema(...#subschema_id')