Has anyone heard of a JSON schema that generates a Json schema? - json

I'm looking for a Json Schema that generates a Json schema. that sounds a little confusing but if I can try to simplify it I'm looking for a Json schema that out lines the rules to make a Json schema and outputs them.

You're looking for the meta-schemas. From JSONSchema:
Meta-schemas
The meta-schemas are the schemas which define the JSON Schema and Hyper-> Schema formats.
Core/Validation Meta-Schema: Used for schemas written for pure validation.
Hyper Meta-Schema: Used for schemas written for validation and hyper-linking.
Taken from: http://json-schema.org/documentation.html

Related

How can I query JSON of an XML parsing in a client only app?

Sorry for the inappropriate question. But what do you recommend me to use to structure a library that can put a query arrangement on json formats generated by an XML parsing based on TEI p5? I tried to use GraphQL by converting the interfaces of my Angular application related to parsing information from XML to JSON in type to define a GraphQL schema but I don't think that's the way.
What I have to do is query, client only, some data encoded in XML (also wanting already parsed in JSON) and, for example, search for all occurrences of a specific data.
Do you have any roadmaps to recommend or some JSON query system that might be right for me?
You might take a look at https://www.npmjs.com/package/saxon-js. With SaxonJS you're able to run XPath expression against XML using JavaScript.

JSON Schema Validation for PL/SQL or SQL, similar to XSLT for XML Schema Validation

I am looking for the schema validation for JSON structure received during the API Invocation from ORDS. Lets say I have 10 different json tags constructing the JSON and I want to validate this JSON against pre-defined validation to check if any required parameters are missing or to validate the datatype.
I am looking for the functionality similar to XLST which is used for XML schema validation.
Please note this schema validation is required for the JSON using PL/SQL and ORDS(Oracle Rest Database Services).
Technical Components: SQL, PL/SQL, ORDS. We want something which is compatible with the mentioned components.

How do I validate JSON against XML Schema (XSD) or RelaxNG?

I'm defining the structure of JSON documents. I'd like to know if how to validate the JSON documents against existing XSD, RelaxNG schemas or another standard schema language schema. I know of Jsonix, but I don't see that it uses the regular expressions from XSD or RelaxNG for validation against JSON schema (and I don't think that JSON schema is standardized).
Clarification: We already have existing XML and XSD. We can always go back to XML for validation, but it would be cool if we could validate the JSON directly, and would give us more confidence when we want to use the JSON and not XML.
Update: Here is the specification in question: http://www.web3d.org/specifications/x3d-3.4.xsd note that it doesn't have text nodes in the XML documents.
Preliminary answer (still a work in progress, but you can contribute):
If you want to convert XML schema to JSON schema, try downloading: XSD2OWL stylesheet which converts XML Schema to OWL. I converted my schema to owl like this:
$ xmlsh
$ xslt -f xsd2owl.xsl -cf file.xsd > file.owl
$ exit
Then download owl2jsonschema.js ** NO LICENSE ** and modify it until it until the demo works. The output will be in demo/OUTPUT/schema folder/*.json as separate JSON files.
XSD and RelaxNG are defined against XML, not JSON.
For JSON, see JSON Schema, but realize that it has nowhere near the adoption of XSD, and the latest draft of the specification expired August 3, 2013, casting doubts on the future of the effort.
Update
How do I validate JSON against XML Schema (XSD) or RelaxNG?
You don't.
The question is not "Can I?" but "How?" Say I have total control over
the JSON document.
When the answer to "Can I?" is "No" the question of how does not apply.
Clarification: We already have existing XML and XSD. We can always go
back to XML for validation, but it would be cool if we could validate
the JSON directly, and would give us more confidence when we want to
use the JSON and not XML.
You can validate the JSON directly against a JSON Schema, but not against an XSD. There are no tools that can do that; the standards are substantially different. The need to define standard vocabularies and grammars that is served by XSD and RelaxNG against XML was intended to be met by JSON Schema against JSON.
You're looking for "confidence when we want to use the JSON and not XML" in the wrong place. See reasons for choosing XML vs JSON instead.
As you're probably already aware of the information I'm about to post, this is just for reference.
Jsonix Schema Compiler supports generation of JSON Schema based on the XML Schema.
So with this you can convert you XML Schema into JSON Schema and validate your JSON against this JSON Schema using AJV.
This is still an experimental feature but that's the direction.

Is there json schema of json schema?

Is there JSON Schema of JSON Schema? In my app user can upload his JSON schema and I would like to validate it if it's a valid JSON Schema.
Yes. This is the meta-schema of JSON Schema draft-04. You can use it to validate whether a JSON is a valid JSON schema.
Yes - it is recommended that schemas reference the schema that they are implementing by declaring a "$schema" property. At the time of writing, this is most commonly "http://json-schema.org/draft-04/schema#"
See https://spacetelescope.github.io/understanding-json-schema/reference/schema.html for some discussion about the $schema keyword.

How to validate against a definition within a schema?

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
I found what I needed in the API section.
tv4.addSchema() and tv4.getSchema(...#subschema_id')