Type Safety with JSON Subschema

11/28/2019
by   Andrew Habib, et al.
0

JSON is a popular data format used pervasively in web APIs, cloud computing, NoSQL databases, and increasingly also machine learning. JSON Schema is a language for declaring the structure of valid JSON data. There are validators that can decide whether a JSON document is valid with respect to a schema. Unfortunately, like all instance-based testing, these validators can only show the presence and never the absence of a bug. This paper presents a complementary technique: JSON subschema checking, which can be used for static type checking with JSON Schema. Deciding whether one schema is a subschema of another is non-trivial because of the richness of the JSON Schema specification language. Given a pair of schemas, our approach first canonicalizes and simplifies both schemas, then decides the subschema question on the canonical forms, dispatching simpler subschema queries to type-specific checkers. We apply an implementation of our subschema checking algorithm to 8,548 pairs of real-world JSON schemas from different domains, demonstrating that it can decide the subschema question for most schema pairs and is always correct for schema pairs that it can decide. We hope that our work will bring more static guarantees to hard-to-debug domains, such as cloud computing and artificial intelligence.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/01/2018

Using Standard Typing Algorithms Incrementally

Modern languages are equipped with static type checking/inference that h...
research
04/11/2023

Static Analysis of Graph Database Transformations

We investigate graph transformations, defined using Datalog-like rules b...
research
04/30/2019

Learning Restricted Regular Expressions with Interleaving

The advantages for the presence of an XML schema for XML documents are n...
research
07/19/2023

Validation of Modern JSON Schema: Formalization and Complexity

JSON Schema is the de-facto standard schema language for JSON data. The ...
research
06/12/2023

Extracting JSON Schemas with Tagged Unions

With data lakes and schema-free NoSQL document stores, extracting a desc...
research
07/14/2018

ML-Schema: Exposing the Semantics of Machine Learning with Schemas and Ontologies

The ML-Schema, proposed by the W3C Machine Learning Schema Community Gro...
research
11/23/2022

Benchmarking JSON BinPack

In this paper, we present benchmark results for a pre-production impleme...

Please sign up or login with your details

Forgot password? Click here to reset