Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 66c27b7

Browse files
committed
Add post on the future of JSON Schema
1 parent 5b37984 commit 66c27b7

File tree

2 files changed

+130
-0
lines changed

2 files changed

+130
-0
lines changed

pages/posts/future-of-json-schema.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
title: "Towards a stable JSON Schema"
3+
date: 2022-10-21
4+
type: Update
5+
tags:
6+
- Standardization
7+
cover: /img/posts/2022/stability/arches.webp
8+
authors:
9+
- name: Jason Desrosiers
10+
photo: /img/avatars/jasondesrosiers.jpeg
11+
link: https://twitter.com/jasondesrosiers
12+
byline: JSON Schema Specification Contributor
13+
---
14+
15+
About this time last year, I hosted a discussion at the API Specification
16+
Conference about the future of JSON Schema. The most popular topic of discussion
17+
was, when JSON Schema is going to be "done". Of course we've heard that question
18+
a lot. The question stems from the "draft" label we put on your releases. The
19+
term "draft" has led to quite a bit of confusion for our community over the
20+
years, so let's take a moment to understand where it comes from.
21+
22+
## Why is it a "draft"?
23+
24+
JSON Schema has been loosely following the IETF standards track RFC process.
25+
That means our releases are in the form of an Internet Draft (I-D). That's why
26+
we refer to them as drafts. However, because of JSON Schema's wide use in
27+
production systems, it's not really possible to treat the spec like a typical
28+
I-D. Therefore, our use of the term "draft" is a bit of legacy artifact from
29+
when the IETF process made more sense for JSON Schema.
30+
31+
This is has been a problem because when people hear "draft", they hear
32+
"unfinished" or "not production ready". That's not the way we treat our
33+
releases. Every release is expected and encouraged to be used in production.
34+
It's no different than OpenAPI releasing a new version. No one asks when OpenAPI
35+
is going to be "done". JSON Schema is just perceived differently because we call
36+
our releases "drafts".
37+
38+
## The real problem
39+
40+
But this isn't just a branding problem. When people ask when JSON Schema is
41+
going to be out of "draft", what they really mean is, when is JSON Schema going
42+
to be "stable". They want to be able to write a schema and be sure that it will
43+
continue to work the same way no matter how JSON Schema evolves in the future.
44+
They want to be able to update their dependencies and not have to update their
45+
schemas that were working just fine.
46+
47+
This effects library maintainers as well. Needing to support multiple versions
48+
of JSON Schema with no backward or forward compatibility guarantees gets
49+
cumbersome and has led many maintainers to
50+
[drop support](https://github.com/gregsdennis/json-everything/issues/310) for
51+
older releases. When this happens, it can leave users with a choice to have to
52+
update all of their existing schemas that weren't broken or pin to a
53+
no-longer-supported version of the JSON Schema library they are using.
54+
55+
## Our solution
56+
57+
Those are the problems we're aiming to solve in the next release. Instead of
58+
continuing to release a new immutable and incompatible version of JSON Schema
59+
with each release, our next release will be a long-lived version that is stable,
60+
but evolving. In this case, "stable" means that there will be strict backward
61+
and forward compatibility requirements that must be followed for any change. It
62+
will be much like JavaScript in that as it evolves you can always be sure that
63+
your existing schemas will continue to work with any JSON Schema library you're
64+
using, but you take a risk using newer features because not all libraries will
65+
have implemented those features yet.
66+
67+
That vision of a stable yet continuously evolving spec doesn't fit well with the
68+
IETF process. There are paths we considered, but nothing was proposed that we
69+
thought would allow us to continue to evolve the standard and get out of "draft"
70+
any time soon. Therefore, the first step to achieving our vision is to [decouple
71+
our main spec development from the IETF process](https://github.com/json-schema-org/json-schema-spec/pull/1277).
72+
This split allows us to pursue a new model for the main spec development that is
73+
more conducive to our vision.
74+
75+
Whether or not you're a fan of the direction the JavaScript language has
76+
evolved, it seems clear that they've come up with an
77+
[effective process](https://2ality.com/2015/11/tc39-process.html) for allowing
78+
for continuous evolution without sacrificing interoperability and longevity.
79+
That's why we've chosen to base our new process on the process that is used to
80+
evolve the JavaScript language. In our next release, most of the keywords and
81+
features you use today will be declared stable and they will never change in a
82+
backward incompatible way again. Features and keywords we aren't comfortable
83+
making stable yet will become part of a new staged release process that we are
84+
working on defining now. The goal of the staged release process is to ensure
85+
that the feature gets sufficient implementation, testing, and real world vetting
86+
for us to be confident in declaring it stable. The process should not only make
87+
us more confident, but also allow us to achieve that confidence much more
88+
quickly.
89+
90+
## Standards considerations
91+
92+
Starting with the next release, the JSON Schema specification will be
93+
self-published on our website.
94+
95+
One of the concerns about self-publishing is about other standards being able to
96+
reference the JSON Schema specification. We have received
97+
[feedback](https://github.com/json-schema-org/json-schema-spec/pull/1277#issuecomment-1228734352)
98+
from people involved in standards development that our approach would be
99+
acceptable for them to reference our specification in their standards based on
100+
our membership with the OpenJS Foundation. We don't know if _all_ standards
101+
bodies will come to the same conclusion, but this feedback gives us confidence
102+
that it isn't going to be a significant problem.
103+
104+
Although the main specification will be self published, we are continuing to
105+
work through the IETF process where it makes sense. For example, we are in the
106+
process of registering our media types such as `application/schema+json` through
107+
the HTTPAPIs WG. We are also looking into standardizing reusable components such
108+
as Relative JSON Pointer through IETF.
109+
110+
## The bottom line
111+
112+
Details about the new process will be shared in a separate post when they are
113+
finalized, but here are some outcomes users can expect.
114+
115+
* If you use only stable features, you are guaranteed interoperability between
116+
JSON Schema libraries and you will never need to update your schemas just for
117+
the sake of keeping up with new releases.
118+
* You can safely use new features before they are stable, as long as the
119+
libraries consuming your schemas support the feature.
120+
* Compatibility/Interoperability guarantees will only apply to the next release
121+
and beyond. You will need to update your schemas to the stable version, but
122+
you won't have to continue to update them as JSON Schema evolves.
123+
* Custom dialects and vocabularies will continue to be central concepts for
124+
customizing and extending JSON Schema.
125+
* Implementations only need to support the latest stable release. For example, a
126+
library that supports the 2025 release will automatically support the 2023 and
127+
2024 releases. The older releases will no longer need to be maintained as
128+
distinct versions. However, implementations that continue to support the
129+
"draft" releases would still need to maintain those as distinct versions from
130+
the current stable release.
219 KB
Binary file not shown.

0 commit comments

Comments
 (0)