Ecosystem fragmentation #169
Replies: 1 comment 1 reply
-
There have been other proposals to shift the granularity more towards individual keywords rather than the current vocabulary groupings.
That's not true. The value of
Anyway, the Let's look at the language from §8.1.2:
While I did have in mind that implementations would refuse to process schemas if they didn't support all of the required vocabularies, that isn't precisely the language used here, which is about whether the vocabulary is understood. Various implementations have felt free to simply document that certain keywords are understood but not supported. So, let's take our database implementation that can't support We could clarify this by defining "understood" to mean that the implementation knows which keywords are part of the vocabulary, regardless of whether all of those keywords are supported or not. §6.5 holds that unsupported keywords SHOULD be treated as annotations (and in the current text on main, MUST otherwise be ignored). We could update this language and that of §8.1.2 to cover the possible scenarios as follows:
Since folks often ask about the purpose of This approach preserves the predictable fail-fast goals of |
Beta Was this translation helpful? Give feedback.
-
Over at ietf-wg-httpapi/mediatypes#32 (comment), @jdesrosiers wrote:
I have a more positive outlook, could you please elaborate on how you figure this?
Based on the test suite, I would say the JSON Schema ecosystem is as unified as it's ever been. The reason that I and other authors picked up work on a 4-year-old draft was to iron out incompatibilities, differences between implementations, and create a forum for implementors. And we've largely accomplished that. As far as the test suite measures, we have more implementations at 100% compliance with the latest publications than we ever had for draft-04.
So if after all this, there's really still fragmentation, let's take a new look at that. Take for example "uniqueItems" — since this an O(n²) operation, maybe some implementations with limited memory legitimately need to "fragment" from the standard behavior.
If different implementations legitimately need to vary in behavior like this, let's make sure (1) there's a mechanism where they can declare they are varying from that behavior; and (2) work to make sure that significant dimensions of fragmentation are rolled back into the spec.
① For the sake of this first point, assume there should be a single specification that all implementations try their best to follow. Now from time to time, someone will use JSON Schema for something that we couldn't possibly have imagined. For example, a validator with a fixed amount of working memory, a UI generator, code generator, as a sub-language inside another (OpenAPI, or a new language for converting XML to JSON, etc).
Because of the implementation's features or constraints, it may need to extend or violate the spec (e.g. write new keywords, or omit some).
These implementations need a way to declare "I accept a variant that has extensions and/or is incomplete in some fashion". This declaration must be permissionless, so that people can write one-off proof-of-concepts. It needs to work in such that, if the idea takes off, any schemas written for these proof-of-concepts don't surprise other implementations, or vice-versa.
This will require some sort of extension indicator ($schema) and standardized handling of its values (when errors must be generated, and how to handle unknown values, or missing values). Currently, we don't specify error handling or forward compatibility for this case whatsoever.
② calls back to our goal as a forum for implementations to converge: If a variation becomes significantly popular, we may need to write support for these variations into the spec. There's also implementations whose "variation from the spec" is they cannot support extensions or variations at all, these implementations need to be supported too.
For example, suppose several databases cannot support "uniqueItems", so they each declare a variation that excludes this keyword (among other modifications). We should "factor this out" and work it into the spec in such a way it doesn't require any special declaration, but is satisfied with appropriate error handling.
In the case of "uniqueItems", this might look like:
(a) implementations don't have to support every keyword, but they must bail if an unsupported keyword is present. Now, the set of schemas supported by our database are not just those that declare a need for the variant—they are all of the schemas that don't use "uniqueItems". And implementations don't need any special knowledge of the database-specific dialect in order to be compatible with it.
And (b) If the array items are provided in sorting order, "uniqueItems" can be implemented with good memory guarantees. We could introduce a new keyword that requires a specific sorting order. Assume implementations can notice this keyword is an unsupported validation keyword, and so will bail.
This is the same outcome as implementations that don't support the database-specific dialect, so this is not a problem. The difference is now we have a standard keyword that can be used for multiple purposes by most implementations, whereas the database dialect was implementation-specific and unlikely to see wide adoption.
① is the scorched-earth, last-resort option where you can implement your extension right now, but only for your implementation, maybe a small number of implementations. But it's quick and cheap to deploy. ② is the option where we describe compatibility on a finer level, which means more implementations can support it (or decide how to support it in a way right for them), which maximizes cross-platform compatibility (but it needs to go through the standards process).
Perhaps first, let's make a list of the dimensions in which the ecosystem is currently fragmented. This list will illustrate where the biggest cross-platform compatibility problems are, and influence what parts of the spec to look at first.
I would like to see instances in the wild, but also, any theoretical examples that might be roadblocked because of compatibility problems.
Beta Was this translation helpful? Give feedback.
All reactions