-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Are you still working on / with this? #2
Comments
Jan, you're the second person to ask this here in a very short time. I suppose Google indexed this page or something :-) Unfortunately the answer is "not really" - I haven't really been working on this much at all lately. However, clearly now there is more demand than I had anticipated. What part of RELAX JSON would you want to have the most? A validation checker? Or a formal definition? Converter to something? |
Hi Egbert, On 04 May 2014, at 09:06, Egbert Teeselink [email protected] wrote:
James Snell and I agreed to work on an I-D along the lines of his blog post[1]. While his approach is more in ‘sync’ with RelaxNG compact syntax (which I think makes sense) I will still consider how your ideas fit in. If we make use of your more concise approach, I’ll make sure you are involved. Ok? Jan [1] https://www.ibm.com/developerworks/community/blogs/jasnell/entry/relax_ng_compact_for_json29?lang=en
|
Ah, I hadn't seen that blog post. Nice that someone else has been looking into it as well! That said, keeping (almost) backward compatibility with RELAX NG is not currently a goal of RELAX JSON. It makes the schema more verbose and, well, if I wanted verbose, JSON Schema is already there for me. :-) IMHO, the big advantage of this approach (and of RELAX NG Compact over XML Schema likewise) is conciseness and readability. RELAX NG can't really be any more concise than it is because XML is so flexible. JSON is way less flexible, so a schema language can be much simpler. But, I might be missing a core use case. Can you explain to me why (almost-)compatibility with RELAX NG is important for you? Maybe we can keep our languages in sync by adding some optional syntax (like ps. What's an "I-D"? |
On 05 May 2014, at 09:37, Egbert Teeselink [email protected] wrote:
suppose { I might like to do FooBar { Foo { Bar { ab =
Purely for given people one new thing less. But I guess it is not a gib win in the end.
Yes, thought about that, too. However, one would be nicer. I’ll talk to James.
I-D : Internet-Draft (the pre-RFC thing) Jan
|
Hey! Cool that you're open to my ideas. Maybe if we get James involved, we can come to a single vision with the three of us! That would be nice. I'm not much of the spec-authoring-type though, but I've started to reboot my validator tryout again - for version zero, I intend to write a converter to JSON Schema (kind of like Trang for RELAX NG) so people can use the plethora of JSON Schema tooling out there but write schemas in RELAX JSON (or whatever language we end up coming up with). Good point about the substitutions. It's not in there right now indeed, but an obvious extension. I'm a bit torn as to what's the best way, however. The way you propose is essentially analogous to how it works in RELAX NG. It's flexible and powerful, I like it. However, the big appeal of JSON is that it meshes really well with how most popular programming languages work: classes and collections. In most OO languages, you reuse code through inheritance or composition, not macro-like substitution. Composition is already supported in the current version, but inheritance is not. We could also realise what you propose with inheritance. It's only a small difference, I think. JSON object properties are not ordered (they are, of course, in a JSON text stream but coders should not depend on their order because they're often loaded in some hashmap type of structure). Because of this, as far as I can see right now, the difference between substitutions as in your example and, say, some (multiple) inheritance construct, is really nothing but syntax. E.g. In place of your example, I could also write
In RELAX NG, this makes little sense, because (using your syntax)
is a different thing than
But in JSON, these ought to be the same, because ordering does not matter and keys can't be duplicate, so we don't need RELAX NG's expressiveness. Multiple substitutions, then, can be accomplished with multiple inheritance (or traits, or mixins, or whatever you'd like to call them). A syntax like
is probably good enough. We'd need a rule for name clashes (last parent wins? invalid schema? invalid schema unless the key has the same value type?), but that's about it. The big question is then what's most useful for authoring and for documentation. The |
@eteeselink got a link to that ID? I've been avoiding the cat-herding of the IETF for a while, but this is something I've wanted long enough I might make an exception. |
Hey Joseph, progress is slow because we are both just too busy, but the draft is here: https://github.com/jasnell/jsondoc and I am using it with great satisfaction to specify a bunch JSON-based media types (in a client project) Jan |
Hi Jan, No worries about slow progress! I'm just happy someone's tackling this. I'll take a look later today. |
got a link to that ID? @josephholsten I'm not sure what you mean here. What, in this context, is "an ID"? |
"ID" is ietf speak for internet draft. I totally pointed that at the wrong person, I meant to ask @algermissen. All's well, and thanks for the nice work! |
I am looking for a way to validate JSON against XSD or RelaxNG and landed here. Any ideas? |
Hmm, not really. XML has a fundamentally different data model than JSON so you can't one-on-one convert a schema language for XML into a schema language for JSON. I think your safest bet is converting the input JSON to XML according to some simple rule and then applying your XSD. If such a simple rule exists, of course. |
Well, certainly Jsonix has made an effort to convert XML XSD to JSON Schema. As to the success of that, that’s up to me to figure out. Jsonix has enabled me to convert X3D to JSON and back to X3D. And it allows for validation of your JSON objects with JSON schema derived from XML Schema. John
|
Hi,
I was shocked today that a search did not immediately turn up an official RelaxNG variant for JSON. Just your README file :-)
Are you still working on this?
Jan
The text was updated successfully, but these errors were encountered: