JSON Schema in production: how you can use it today

Avatar

At 2022’s API Specifications Conference (ASC), Postman JSON Schema Specification Lead Ben Hutton shared some stories about using JSON Schema in production from his many conversations with different organizations. Read on to learn how organizations of all sizes use JSON Schema in production, and be sure to check out the full presentation for more details.

The impact of JSON Schema

Although JSON Schema was created to validate JSON data, its widespread language support has led to a wide range of new applications, such as code and form generation and interoperable data validation. You’re probably already using JSON Schema, even if you don’t realize it. Ben pointed out that when you use features like auto-completion in the most popular code editors and IDEs, such as VS Code, you’re using JSON Schema. If you’re writing OpenAPI or AsyncAPI specification documents, those both have embedded JSON Schema.

According to the team’s observations, a common misconception is that JSON Schema isn’t ready for use in production. This perception is understandable—the JSON Schema specification was published by the Internet Engineering Task Force (IETF) as a draft, and the IETF does not usually recommend using drafts in production. According to Ben, who has been the project lead for quite some time and has worked extensively on the specification, the implications of every breaking change are taken into account and the document is not treated as a draft. In fact, a significant number of well-known, large organizations use JSON Schema in production, and its impact on them is huge. Organizations have seen benefits like being able to write validation code twice as fast without sacrificing quality, getting rid of duplicate validation code, and iterating faster without sacrificing consistency. Ben met with several of these organizations to learn more about how they use JSON Schema.

Using JSON Schema to speed up validation of dynamic forms

Cookpad is the largest recipe-sharing service in Japan. When they were looking to diversify, they launched Cookpad Mart, a fresh food ingredient marketplace. Every day, local producers register their goods, and individual customers can order them for pickup. Various quality assurance details about the product must be entered by the producers. Because this data is highly specific and constantly evolving, Cookpad Mart found that maintaining static forms with complex logic was not sustainable. They needed a common schema to contain their form requirements.

Cookpad Mart coded their dynamic, complex validation rules into JSON Schema. Before using JSON Schema, Cookpad Mart found that 10% of the submitted products had quality assurance data that was not complete. After using JSON Schema, that number decreased to zero. This made their manual review team’s job easier and cut in half the amount of time it took to build validation forms.

Using JSON Schema to empower clients with self-service solutions

Tyler Technologies offers software solutions for the public sector in the US. The public sector often lacks the budget to build its own software and also lacks the resources to collaborate across jurisdictions. Tyler Technologies provides a multi-tenant software solution that supports customization as one of its services.

Because requirements are set forth by law and vary by location, it was time-consuming but necessary to code variations in the forms for each client. While Tyler Technologies needed to reduce the amount of time spent on internal development, they also wanted to give their customers the freedom to customize their own forms and validation rules. They needed a no-code solution that was both simple and powerful.

Tyler Technologies made forms using Formly and JSON Schema, which allowed clients to provide their own custom schemas and validation rules. The process of making new forms, which previously required the client to get in touch with them, is now self-service. Clients saw the value they were getting from Tyler Technologies in minutes, not days or weeks.

Using JSON Schema to validate reliably and efficiently

Zapier offers no-code and low-code automation solutions for everyone. Currently, they’re integrated with over 5,000 apps, and two more are added every day. As more apps joined, Zapier found that manually reviewing submissions for integrations took a lot of time because each submission needed to go through a code review and output verification. Developers would upload their packaged integration and configure it through a web UI that wasn’t as powerful as they needed it to be.

Zapier needed a distributable, cross-platform validation system. They tested a few options, such as re-parsing the user code or copying the code to the server for testing, but they soon found flaws in each strategy. They now define the JSON Schema and push it to the platform’s web UI and CLI, which means developers can validate packages before submitting them on the CLI. After a package is validated on the CLI, the same validation runs on Zapier’s servers. This allows developers to write code once and validate it everywhere consistently. Not only does this improvement make external developers happy, but Zapier developers can also make large-scale data migrations with confidence.

Using JSON Schema to adapt quickly and sustain growth

6 River Systems, recently acquired by Shopify, provides solutions for warehouse automation. They fulfill millions of units each week and maintain over a hundred facilities, so they have a lot of telemetry data and data structures to maintain. Chuck, an autonomous warehouse robot, helps pickers locate, pack, and move products. When a picker takes an item off the shelf, they use Chuck to scan it. Chuck then connects to the control center and uses dynamic signing to make sure it is the right item.

6 River Systems recently went through rapid growth, which presented new challenges and technical debt. Deprecated tooling needed to be replaced, and various domain experts needed to work together effectively to define the data structures. They looked at common data definition formats like Protobuf and Avro, but their specific dependencies and integrations made them too restrictive. They found JSON Schema to be neutral and interoperable across a wide range of programming languages, as well as simple to learn and implement in small, manageable chunks. The robots and control center are able to communicate with one another despite using different programming languages thanks to JSON Schema.

Although 6 River Systems has a team that helps with communication between data analysts and engineers, JSON Schema lessens the burden on them. Teams can work together and publish new instrumentation without assistance from the bridging team, which frees up the bridging team to work on more challenging problems. Using JSON Schema allows 6 River Systems to deploy with confidence, knowing that things will work before the code reaches the robots.

How can JSON Schema help you?

These four companies have seen significant, measurable improvements since they started using JSON Schema. If you’ve been waiting to use JSON Schema because you were under the impression that it wasn’t production-ready, hopefully these stories inspire some confidence. You can use JSON Schema in production today, and you just might start to see results like these in your own organization.

Watch the full presentation

 

Learn more about using JSON Schema

Ready to learn more about using JSON Schema in production, or get involved in working on the schema? Check out the following links:

Technical review by Ben Hutton

What do you think about this topic? Tell us in a comment below.

Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.