significantly simplified the validator and work continues on query

This commit is contained in:
2026-03-03 17:58:31 -05:00
parent 3898c43742
commit e7f20e2cb6
58 changed files with 5446 additions and 5693 deletions

View File

@ -67,30 +67,41 @@ Returns a debug dump of the currently cached schemas (for development/debugging)
## ✨ Custom Features & Deviations
JSPG implements specific extensions to the Draft 2020-12 standard to support the Punc architecture's object-oriented needs.
JSPG implements specific extensions to the Draft 2020-12 standard to support the Punc architecture's object-oriented needs while heavily optimizing for zero-runtime lookups.
### 1. The Unified Semantic Graph & Native Inheritance
JSPG goes beyond Draft 2020-12 to natively understand Object-Oriented inheritance and polymorphism. During the `cache_json_schemas()` phase, JSPG builds a single Directed Acyclic Graph (DAG) using **only** the `$ref` keyword. Every schema that uses `$ref` establishes a parent-to-child relationship.
### 1. Polymorphism & Referencing (`$ref`, `$family`, and Native Types)
Furthermore, `jspg` knows which schemas belong directly to database tables (Entities) versus which are ad-hoc API shapes.
* **Native `type` Discrimination**: For any schema that traces its ancestry back to the base `entity`, JSPG securely and implicitly manages the `type` property. You do **not** need to explicitly override `"type": {"const": "person"}` in entity subclasses. If a schema `$ref`s `organization`, JSPG automatically allows the incoming `type` to be anything in the `organization` family tree (e.g., `person`, `bot`), but rigidly truncates/masks the data structure to the requested `organization` shape.
* **Ad-Hoc Objects**: If an ad-hoc schema `$ref`s a base object but does not trace back to `entity`, standard JSON Schema rules apply (no magical `type` tracking).
JSPG replaces the complex, dynamic reference resolution logic of standard JSON Schema (e.g., `$defs`, relative URIs, `$dynamicRef`, `$dynamicAnchor`, `if/then/else`) with a strict, explicitly structured global `$id` system. This powers predictable code generation and blazing-fast runtime validation.
> [!NOTE]
> **`$ref` never creates a Union.** When you use `$ref`, you are asking for a single, concrete struct/shape. The schema's strict fields will be rigidly enforced, but the `type` property is permitted to match any valid descendant via the native discrimination.
#### A. Global `$id` Conventions & Schema Buckets
Every schema is part of a flat, globally addressable namespace. However, where a schema is defined in the database determines its physical boundaries:
* **Types (Entities)**: Schemas defined within a Postgres `type` represent entities. The `$id` must be exactly the type name (`person`) or suffixed (`full.person`). All schemas in this bucket receive strict Native Type Discrimination based on the physical table hierarchy.
* **Puncs (APIs)**: Schemas defined within a `punc` are ad-hoc containers. The `$id` must be exactly `[punc_name].request` or `[punc_name].response`. They are never entities themselves.
* **Enums (Domains)**: Schemas defined within an `enum` represent enum definitions. The `$id` must be exactly the enum name (`job_status`) or suffixed (`short.job_status`).
### 2. Shape Polymorphism & Virtual Unions (`$family`)
To support polymorphic API contracts and deeply nested UI Unions without manually writing massive `oneOf` blocks, JSPG provides the `$family` macro. While `$ref` guarantees a single shape, `$family` asks the code generators for a true Polymorphic Union class.
#### B. Native Type Discrimination (The `variations` Property)
Because `jspg` knows which schemas are Entities based on their origin bucket (Types), it securely and implicitly manages the `"type"` property by attaching `compiled_variations`.
If a schema originates in the `user` bucket, the validator does *not* rigidly require `{"type": "user"}`. Instead, it queries the physical Postgres type inheritance graph (e.g. `[entity, organization, user]`) and allows the JSON to be `{"type": "person"}` or `{"type": "bot"}` automatically, enabling seamless API polymorphism.
When `{"$family": "organization.light"}` is encountered, JSPG:
1. Locates the base `organization` node in the Semantic Graph.
2. Recursively walks down to find all descendants via `$ref`.
3. **Strictly Filters** the descendants using the exact dot-notation suffix requested. It will only include descendants whose `$id` matches the shape modifier (e.g., `person.light`, `user.light`). If `bot` has no `.light` shape defined, it is securely omitted from the union.
4. Generates a virtual `oneOf` array containing those precise `$ref`s.
#### C. Structural Inheritance & Viral Infection (`$ref`)
`$ref` is used exclusively for structural inheritance.
* **Viral Infection**: If an anonymous schema or an ad-hoc schema (like a Punc Request) `$ref`s a strict Entity schema (like `person.light`), it *virally inherits* the `compiled_variations` of that target. This means a Punc request instantly gains the exact polymorphic security boundaries of the Entity it points to.
* **`$ref` never creates a Union.** When you use `$ref`, you are asking for a single, concrete struct/shape.
This cleanly separates **Database Ancestry** (managed entirely and implicitly by `$ref` for single shapes) from **Shape Variations** (managed explicitly by `$family` to build `oneOf` unions).
#### D. Shape Polymorphism & Virtual Unions (`$family`)
To support polymorphic API contracts (e.g., heterogeneous arrays of generic widgets) without manually writing massive `oneOf` blocks, JSPG provides the `$family` macro.
While `$ref` defines rigid structure, `$family` relies on an abstract **Descendants Graph**.
### 3. Strict by Default & Extensibility
During compilation, `jspg` temporarily tracks every `$ref` pointer globally to build a reverse-lookup graph of "Descendants".
When `{"$family": "widget"}` is encountered, JSPG:
1. Locates the `widget` schema in the Descendants graph.
2. Expands the macro by finding *every* schema in the entire database that structurally `$ref`s `widget`, directly or indirectly (e.g., `stock.widget`, an anonymous object, etc.).
3. Replaces the `$family` keyword with a standard `one_of` array containing `$ref`s to those discovered descendants.
If you request `{"$family": "light.widget"}`, it simply expands to all schemas that `$ref` the generic abstract `light.widget` interface.
This cleanly separates **Database Physics** (derived from the Postgres `Types` bucket and viral `$ref` inheritance) from **Structural Polymorphism** (derived purely from the abstract `$ref` tree).
### 2. Strict by Default & Extensibility
JSPG enforces a "Secure by Default" philosophy. All schemas are treated as if `unevaluatedProperties: false` (and `unevaluatedItems: false`) is set, unless explicitly overridden.
* **Strictness**: By default, any property or array item in the instance data that is not explicitly defined in the schema causes a validation error. This prevents clients from sending undeclared fields or extra array elements.
@ -99,19 +110,17 @@ JSPG enforces a "Secure by Default" philosophy. All schemas are treated as if `u
* **Ref Boundaries**: Strictness is reset when crossing `$ref` boundaries. The referenced schema's strictness is determined by its own definition (strict by default unless `extensible: true`), ignoring the caller's state.
* **Inheritance**: Strictness is inherited. A schema extending a strict parent will also be strict unless it declares itself `extensible: true`. Conversely, a schema extending a loose parent will also be loose unless it declares itself `extensible: false`.
### 3. Implicit Keyword Shadowing
Standard JSON Schema composition (`allOf`) is additive (Intersection), meaning constraints can only be tightened, not replaced. However, JSPG treats `$ref` differently when it appears alongside other properties to support object-oriented inheritance.
* **Inheritance (`$ref` + properties)**: When a schema uses `$ref` and defines its own properties, JSPG implements Smart Merge (or Shadowing). If a property is defined in the current schema, its constraints take precedence over the inherited constraints for that specific keyword.
* **Example**: If Entity defines `type: { const: "entity" }` and Person (which refs Entity) defines `type: { const: "person" }`, validation passes for "person". The local const shadows the inherited const.
* **Granularity**: Shadowing is per-keyword. If Entity defined `type: { const: "entity", minLength: 5 }`, Person would shadow `const` but still inherit `minLength: 5`.
* **Composition (`allOf`)**: When using `allOf`, standard intersection rules apply. No shadowing occurs; all constraints from all branches must pass. This is used for mixins or interfaces.
### 4. Format Leniency for Empty Strings
To simplify frontend form logic, the format validators for `uuid`, `date-time`, and `email` explicitly allow empty strings (`""`). This treats an empty string as "present but unset" rather than "invalid format".
### 5. Masking (Constructive Validation)
JSPG supports a "Constructive Validation" mode via `mask_json_schema`. This is designed for high-performance API responses where the schema dictates the exact shape of the returned data.
* **Mechanism**: The validator traverses the instance against the schema.
* **Valid Fields**: Kept in the output.
* **Unknown/Extra Fields**: Silently removed (pruned) if `extensible: false` (default).
* **Invalid Fields**: Still trigger standard validation errors.
This allows the database to return "raw" joined rows (e.g. `SELECT * FROM person JOIN organization ...`) and have JSPG automatically shape the result into the expected API response, removing any internal or unrelated columns not defined in the schema.
## 🏗️ Architecture
The extension is written in Rust using `pgrx` and structures its schema parser to mirror the Punc Generator's design:

View File

@ -49,7 +49,41 @@ fn main() {
let val: serde_json::Value = serde_json::from_reader(file).unwrap();
if let Some(arr) = val.as_array() {
for (i, _item) in arr.iter().enumerate() {
for (i, item) in arr.iter().enumerate() {
// Enforce test suite structure
let group = item.as_object().expect("Test suite must be an object");
// Validate required suite fields
if !group.contains_key("description")
|| !group.contains_key("database")
|| !group.contains_key("tests")
{
panic!(
"File {} index {} is missing required suite fields (description, database, tests)",
file_name, i
);
}
// Validate required test case fields
let tests = group
.get("tests")
.unwrap()
.as_array()
.expect("Tests must be an array");
for (t_idx, test) in tests.iter().enumerate() {
let t_obj = test.as_object().expect("Test case must be an object");
if !t_obj.contains_key("description")
|| !t_obj.contains_key("data")
|| !t_obj.contains_key("valid")
|| !t_obj.contains_key("schema_id")
{
panic!(
"File {} suite {} test {} is missing required case fields (description, data, valid, schema_id)",
file_name, i, t_idx
);
}
}
// Use deterministic names: test_{filename}_{index}
let safe_filename = to_safe_identifier(file_name);
let fn_name = format!("test_{}_{}", safe_filename, i);

View File

@ -379,7 +379,8 @@ fn check_hostname(s: &str) -> Result<(), Box<dyn Error + Send + Sync>> {
if let Err(_) = errors {
Err("invalid punycode")?;
}
check_unicode_idn_constraints(&unicode).map_err(|e| format!("invalid punycode/IDN: {e}"))?;
check_unicode_idn_constraints(&unicode)
.map_err(|e| format!("invalid punycode/IDN: {e}"))?;
}
}
}
@ -799,7 +800,11 @@ fn validate_uri(v: &Value) -> Result<(), Box<dyn Error + Send + Sync>> {
let Value::String(s) = v else {
return Ok(());
};
if fluent_uri::UriRef::parse(s.as_str()).map_err(|e| e.to_string())?.scheme().is_none() {
if fluent_uri::UriRef::parse(s.as_str())
.map_err(|e| e.to_string())?
.scheme()
.is_none()
{
Err("relative url")?;
};
Ok(())

View File

@ -16,7 +16,6 @@ pub struct Database {
pub types: HashMap<String, Type>,
pub puncs: HashMap<String, Punc>,
pub schemas: HashMap<String, Schema>,
pub descendants: HashMap<String, Vec<String>>,
}
impl Database {
@ -26,7 +25,6 @@ impl Database {
types: HashMap::new(),
puncs: HashMap::new(),
schemas: HashMap::new(),
descendants: HashMap::new(),
};
if let Some(arr) = val.get("enums").and_then(|v| v.as_array()) {
@ -75,146 +73,137 @@ impl Database {
fn compile(&mut self) -> Result<(), String> {
self.collect_schemas();
// 1. Compile regex and formats sequentially
for schema in self.schemas.values_mut() {
schema.compile();
// 1. Build a structural descendant graph for $family macro expansion
let mut direct_refs: std::collections::HashMap<String, Vec<String>> =
std::collections::HashMap::new();
for (id, schema) in &self.schemas {
if let Some(ref_str) = &schema.obj.ref_string {
direct_refs
.entry(ref_str.clone())
.or_default()
.push(id.clone());
}
}
// 2. Compute the Unified Semantic Graph (descendants)
self.collect_descendents();
let schema_ids: Vec<String> = self.schemas.keys().cloned().collect();
// 3. For any schema representing a Postgres table, cache its allowed subclasses
self.compile_allowed_types();
// 2. Expand $family macros into oneOf blocks
for id in &schema_ids {
if let Some(schema) = self.schemas.get_mut(id) {
schema.map_children(|mut child| {
Self::expand_family(&mut child, &direct_refs);
});
Self::expand_family(schema, &direct_refs);
}
}
// 4. Finally, securely link all string $refs into memory pointers (Arc)
self.compile_pointers();
let schemas_snap = self.schemas.clone();
// 3. Compile internals and link memory pointers
for id in schema_ids {
if let Some(schema) = self.schemas.get_mut(&id) {
schema.compile_internals();
schema.link_refs(&schemas_snap);
}
}
Ok(())
}
fn collect_schemas(&mut self) {
let mut to_insert = Vec::new();
// Pass A: Entities - Compute Variations from hierarchies
// `hierarchy` is an array of ancestors. E.g. `person` -> `['entity', 'user', 'person']`.
// We map this backward so that `user`'s allowed variations = `['user', 'person']`.
let mut variations_by_entity = std::collections::HashMap::new();
for type_def in self.types.values() {
for ancestor in &type_def.hierarchy {
variations_by_entity
.entry(ancestor.clone())
.or_insert_with(std::collections::HashSet::new)
.insert(type_def.name.clone());
}
}
// Now stamp all exported entity schemas with their precise physical variations
for (_, type_def) in &self.types {
for schema in &type_def.schemas {
if let Some(id) = &schema.obj.id {
to_insert.push((id.clone(), schema.clone()));
}
let allowed_strings = variations_by_entity
.get(&type_def.name)
.cloned()
.unwrap_or_default();
for mut schema in type_def.schemas.clone() {
schema.stamp_variations(Some(allowed_strings.clone()));
schema.harvest(&mut to_insert);
}
}
// Pass B: APIs and Enums (No initial variations stamped)
for (_, punc_def) in &self.puncs {
for schema in &punc_def.schemas {
if let Some(id) = &schema.obj.id {
to_insert.push((id.clone(), schema.clone()));
}
for mut schema in punc_def.schemas.clone() {
schema.harvest(&mut to_insert);
}
}
for (_, enum_def) in &self.enums {
for schema in &enum_def.schemas {
if let Some(id) = &schema.obj.id {
to_insert.push((id.clone(), schema.clone()));
}
for mut schema in enum_def.schemas.clone() {
schema.harvest(&mut to_insert);
}
}
for (id, schema) in to_insert {
self.schemas.insert(id, schema);
}
}
fn collect_descendents(&mut self) {
let mut direct_children: HashMap<String, Vec<String>> = HashMap::new();
fn expand_family(
schema: &mut crate::database::schema::Schema,
direct_refs: &std::collections::HashMap<String, Vec<String>>,
) {
if let Some(family_target) = &schema.obj.family {
let mut descendants = std::collections::HashSet::new();
Self::collect_descendants(family_target, direct_refs, &mut descendants);
// First pass: Find all schemas that have a $ref to another schema
let schema_ids: Vec<String> = self.schemas.keys().cloned().collect();
for id in schema_ids {
if let Some(ref_str) = self.schemas.get(&id).and_then(|s| s.obj.ref_string.clone()) {
if self.schemas.contains_key(&ref_str) {
direct_children.entry(ref_str).or_default().push(id.clone());
// the "$family" macro is logically replaced by an anyOf of its descendants + itself
let mut derived_any_of = Vec::new();
// Include the target base itself if valid (which it always is structurally)
let mut base_ref = crate::database::schema::SchemaObject::default();
base_ref.ref_string = Some(family_target.clone());
derived_any_of.push(std::sync::Arc::new(crate::database::schema::Schema {
obj: base_ref,
always_fail: false,
}));
// Sort descendants for determinism during testing
let mut desc_vec: Vec<String> = descendants.into_iter().collect();
desc_vec.sort();
for child_id in desc_vec {
let mut child_ref = crate::database::schema::SchemaObject::default();
child_ref.ref_string = Some(child_id);
derived_any_of.push(std::sync::Arc::new(crate::database::schema::Schema {
obj: child_ref,
always_fail: false,
}));
}
schema.obj.any_of = Some(derived_any_of);
// Remove family so it doesn't cause conflicts or fail the simple validation
schema.obj.family = None;
}
}
// Now compute descendants for all schemas
let mut descendants_map: HashMap<String, Vec<String>> = HashMap::new();
for key in self.schemas.keys() {
let mut descendants = Vec::new();
let mut queue = Vec::new();
if let Some(children) = direct_children.get(key) {
queue.extend(children.iter().cloned());
}
let mut visited = std::collections::HashSet::new();
while let Some(child) = queue.pop() {
if visited.insert(child.clone()) {
descendants.push(child.clone());
if let Some(grandchildren) = direct_children.get(&child) {
queue.extend(grandchildren.iter().cloned());
}
}
}
descendants_map.insert(key.clone(), descendants);
}
self.descendants = descendants_map;
}
fn compile_allowed_types(&mut self) {
// 1. Identify which types act as bases (table-backed schemas)
let mut entity_bases = HashMap::new();
for type_def in self.types.values() {
for type_schema in &type_def.schemas {
if let Some(id) = &type_schema.obj.id {
entity_bases.insert(id.clone(), type_def.name.clone());
}
}
}
// 2. Compute compiled_allowed_types for all descendants of entity bases
let mut allowed_types_map: HashMap<String, std::collections::HashSet<String>> = HashMap::new();
for base_id in entity_bases.keys() {
allowed_types_map.insert(
base_id.clone(),
self
.descendants
.get(base_id)
.unwrap_or(&vec![])
.iter()
.cloned()
.collect(),
);
if let Some(descendants) = self.descendants.get(base_id) {
let set: std::collections::HashSet<String> = descendants.iter().cloned().collect();
for desc_id in descendants {
allowed_types_map.insert(desc_id.clone(), set.clone());
}
}
}
// 3. Inject types into the schemas
let schema_ids: Vec<String> = self.schemas.keys().cloned().collect();
for id in schema_ids {
if let Some(set) = allowed_types_map.get(&id) {
if let Some(schema) = self.schemas.get_mut(&id) {
schema.obj.compiled_allowed_types = Some(set.clone());
fn collect_descendants(
target: &str,
direct_refs: &std::collections::HashMap<String, Vec<String>>,
descendants: &mut std::collections::HashSet<String>,
) {
if let Some(children) = direct_refs.get(target) {
for child in children {
if descendants.insert(child.clone()) {
Self::collect_descendants(child, direct_refs, descendants);
}
}
}
}
fn compile_pointers(&mut self) {
let schema_ids: Vec<String> = self.schemas.keys().cloned().collect();
for id in schema_ids {
let mut compiled_ref = None;
if let Some(schema) = self.schemas.get(&id) {
if let Some(ref_str) = &schema.obj.ref_string {
if let Some(target) = self.schemas.get(ref_str) {
compiled_ref = Some(std::sync::Arc::new(target.clone()));
}
}
}
if let Some(schema) = self.schemas.get_mut(&id) {
schema.obj.compiled_ref = compiled_ref;
}
}
}
}

View File

@ -124,7 +124,7 @@ pub struct SchemaObject {
#[serde(skip)]
pub compiled_ref: Option<Arc<Schema>>,
#[serde(skip)]
pub compiled_allowed_types: Option<std::collections::HashSet<String>>,
pub compiled_variations: Option<std::collections::HashSet<String>>,
#[serde(skip)]
pub compiled_format: Option<CompiledFormat>,
#[serde(skip)]
@ -133,11 +133,6 @@ pub struct SchemaObject {
pub compiled_pattern_properties: Option<Vec<(CompiledRegex, Arc<Schema>)>>,
}
pub enum ResolvedRef<'a> {
Local(&'a Schema),
Global(&'a Schema, &'a Schema),
}
/// Represents a compiled format validator
#[derive(Clone)]
pub enum CompiledFormat {
@ -188,12 +183,9 @@ impl std::ops::DerefMut for Schema {
}
impl Schema {
pub fn resolve_ref(&self, _ref_string: &str) -> Option<&Arc<Schema>> {
// This is vestigial for now. References are global pointers. We will remove this shortly.
None
}
pub fn compile_internals(&mut self) {
self.map_children(|child| child.compile_internals());
pub fn compile(&mut self) {
if let Some(format_str) = &self.obj.format {
if let Some(fmt) = crate::database::formats::FORMATS.get(format_str.as_str()) {
self.obj.compiled_format = Some(crate::database::schema::CompiledFormat::Func(fmt.func));
@ -217,96 +209,112 @@ impl Schema {
self.obj.compiled_pattern_properties = Some(compiled);
}
}
}
// Crawl children recursively to compile their internals
pub fn link_refs(&mut self, schemas: &std::collections::HashMap<String, Schema>) {
if let Some(ref_str) = &self.obj.ref_string {
if let Some(target) = schemas.get(ref_str) {
self.obj.compiled_ref = Some(Arc::new(target.clone()));
// Viral Infection: Inherit physical entity boundaries across the $ref pointer recursively
if self.obj.compiled_variations.is_none() {
let mut visited = std::collections::HashSet::new();
self.obj.compiled_variations = Self::resolve_variations(ref_str, schemas, &mut visited);
}
}
}
self.map_children(|child| child.link_refs(schemas));
}
fn resolve_variations(
ref_str: &str,
schemas: &std::collections::HashMap<String, Schema>,
visited: &mut std::collections::HashSet<String>,
) -> Option<std::collections::HashSet<String>> {
if !visited.insert(ref_str.to_string()) {
return None; // Cycle detected
}
if let Some(target) = schemas.get(ref_str) {
if let Some(vars) = &target.obj.compiled_variations {
return Some(vars.clone());
}
if let Some(next_ref) = &target.obj.ref_string {
return Self::resolve_variations(next_ref, schemas, visited);
}
}
None
}
pub fn stamp_variations(&mut self, variations: Option<std::collections::HashSet<String>>) {
self.obj.compiled_variations = variations.clone();
self.map_children(|child| child.stamp_variations(variations.clone()));
}
pub fn harvest(&mut self, to_insert: &mut Vec<(String, Schema)>) {
if let Some(id) = &self.obj.id {
to_insert.push((id.clone(), self.clone()));
}
self.map_children(|child| child.harvest(to_insert));
}
pub fn map_children<F>(&mut self, mut f: F)
where
F: FnMut(&mut Schema),
{
if let Some(props) = &mut self.obj.properties {
for (_, v) in props {
// Safe deep mutation workaround without unsafe Arc unwrap
let mut inner = (**v).clone();
inner.compile();
f(&mut inner);
*v = Arc::new(inner);
}
}
if let Some(pattern_props) = &mut self.obj.pattern_properties {
for (_, v) in pattern_props {
let mut inner = (**v).clone();
f(&mut inner);
*v = Arc::new(inner);
}
}
let mut map_arr = |arr: &mut Vec<Arc<Schema>>| {
for v in arr.iter_mut() {
let mut inner = (**v).clone();
f(&mut inner);
*v = Arc::new(inner);
}
};
if let Some(arr) = &mut self.obj.prefix_items {
for v in arr.iter_mut() {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
map_arr(arr);
}
}
if let Some(arr) = &mut self.obj.all_of {
for v in arr.iter_mut() {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
map_arr(arr);
}
}
if let Some(arr) = &mut self.obj.any_of {
for v in arr.iter_mut() {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
map_arr(arr);
}
}
if let Some(arr) = &mut self.obj.one_of {
for v in arr.iter_mut() {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
map_arr(arr);
}
if let Some(v) = &mut self.obj.additional_properties {
let mut map_opt = |opt: &mut Option<Arc<Schema>>| {
if let Some(v) = opt {
let mut inner = (**v).clone();
inner.compile();
f(&mut inner);
*v = Arc::new(inner);
}
};
if let Some(v) = &mut self.obj.items {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
if let Some(v) = &mut self.obj.contains {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
if let Some(v) = &mut self.obj.property_names {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
if let Some(v) = &mut self.obj.not {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
if let Some(v) = &mut self.obj.if_ {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
if let Some(v) = &mut self.obj.then_ {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
if let Some(v) = &mut self.obj.else_ {
let mut inner = (**v).clone();
inner.compile();
*v = Arc::new(inner);
}
map_opt(&mut self.obj.additional_properties);
map_opt(&mut self.obj.items);
map_opt(&mut self.obj.contains);
map_opt(&mut self.obj.property_names);
map_opt(&mut self.obj.not);
map_opt(&mut self.obj.if_);
map_opt(&mut self.obj.then_);
map_opt(&mut self.obj.else_);
}
}
@ -327,7 +335,37 @@ impl<'de> Deserialize<'de> for Schema {
always_fail: !b,
});
}
let obj: SchemaObject = serde_json::from_value(v.clone()).map_err(serde::de::Error::custom)?;
let mut obj: SchemaObject =
serde_json::from_value(v.clone()).map_err(serde::de::Error::custom)?;
// If a schema is effectively empty (except for potentially carrying an ID),
// it functions as a boolean `true` schema in Draft2020 which means it should not
// restrict additional properties natively
let is_empty = obj.type_.is_none()
&& obj.properties.is_none()
&& obj.pattern_properties.is_none()
&& obj.additional_properties.is_none()
&& obj.required.is_none()
&& obj.dependencies.is_none()
&& obj.items.is_none()
&& obj.prefix_items.is_none()
&& obj.contains.is_none()
&& obj.format.is_none()
&& obj.enum_.is_none()
&& obj.const_.is_none()
&& obj.all_of.is_none()
&& obj.any_of.is_none()
&& obj.one_of.is_none()
&& obj.not.is_none()
&& obj.if_.is_none()
&& obj.then_.is_none()
&& obj.else_.is_none()
&& obj.ref_string.is_none()
&& obj.family.is_none();
if is_empty && obj.extensible.is_none() {
obj.extensible = Some(true);
}
Ok(Schema {
obj,

View File

@ -101,6 +101,72 @@ fn test_additional_properties_2() {
crate::validator::util::run_test_file_at_index(&path, 2).unwrap();
}
#[pg_test]
fn test_dependencies_0() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 0).unwrap();
}
#[pg_test]
fn test_dependencies_1() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_dependencies_2() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 2).unwrap();
}
#[pg_test]
fn test_dependencies_3() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 3).unwrap();
}
#[pg_test]
fn test_dependencies_4() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 4).unwrap();
}
#[pg_test]
fn test_dependencies_5() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 5).unwrap();
}
#[pg_test]
fn test_dependencies_6() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 6).unwrap();
}
#[pg_test]
fn test_dependencies_7() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 7).unwrap();
}
#[pg_test]
fn test_dependencies_8() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 8).unwrap();
}
#[pg_test]
fn test_dependencies_9() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 9).unwrap();
}
#[pg_test]
fn test_dependencies_10() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 10).unwrap();
}
#[pg_test]
fn test_exclusive_minimum_0() {
let path = format!("{}/tests/fixtures/exclusiveMinimum.json", env!("CARGO_MANIFEST_DIR"));
@ -497,30 +563,6 @@ fn test_items_15() {
crate::validator::util::run_test_file_at_index(&path, 15).unwrap();
}
#[pg_test]
fn test_typed_refs_0() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 0).unwrap();
}
#[pg_test]
fn test_typed_refs_1() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_typed_refs_2() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 2).unwrap();
}
#[pg_test]
fn test_typed_refs_3() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 3).unwrap();
}
#[pg_test]
fn test_enum_0() {
let path = format!("{}/tests/fixtures/enum.json", env!("CARGO_MANIFEST_DIR"));
@ -803,42 +845,6 @@ fn test_max_length_1() {
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_dependent_schemas_0() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 0).unwrap();
}
#[pg_test]
fn test_dependent_schemas_1() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_dependent_schemas_2() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 2).unwrap();
}
#[pg_test]
fn test_dependent_schemas_3() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 3).unwrap();
}
#[pg_test]
fn test_dependent_schemas_4() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 4).unwrap();
}
#[pg_test]
fn test_dependent_schemas_5() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 5).unwrap();
}
#[pg_test]
fn test_exclusive_maximum_0() {
let path = format!("{}/tests/fixtures/exclusiveMaximum.json", env!("CARGO_MANIFEST_DIR"));
@ -1079,30 +1085,6 @@ fn test_pattern_1() {
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_masking_0() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 0).unwrap();
}
#[pg_test]
fn test_masking_1() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_masking_2() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 2).unwrap();
}
#[pg_test]
fn test_masking_3() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 3).unwrap();
}
#[pg_test]
fn test_max_properties_0() {
let path = format!("{}/tests/fixtures/maxProperties.json", env!("CARGO_MANIFEST_DIR"));
@ -1127,36 +1109,6 @@ fn test_max_properties_3() {
crate::validator::util::run_test_file_at_index(&path, 3).unwrap();
}
#[pg_test]
fn test_dependent_required_0() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 0).unwrap();
}
#[pg_test]
fn test_dependent_required_1() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 1).unwrap();
}
#[pg_test]
fn test_dependent_required_2() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 2).unwrap();
}
#[pg_test]
fn test_dependent_required_3() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 3).unwrap();
}
#[pg_test]
fn test_dependent_required_4() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 4).unwrap();
}
#[pg_test]
fn test_required_0() {
let path = format!("{}/tests/fixtures/required.json", env!("CARGO_MANIFEST_DIR"));
@ -1685,150 +1637,6 @@ fn test_ref_15() {
crate::validator::util::run_test_file_at_index(&path, 15).unwrap();
}
#[pg_test]
fn test_ref_16() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 16).unwrap();
}
#[pg_test]
fn test_ref_17() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 17).unwrap();
}
#[pg_test]
fn test_ref_18() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 18).unwrap();
}
#[pg_test]
fn test_ref_19() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 19).unwrap();
}
#[pg_test]
fn test_ref_20() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 20).unwrap();
}
#[pg_test]
fn test_ref_21() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 21).unwrap();
}
#[pg_test]
fn test_ref_22() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 22).unwrap();
}
#[pg_test]
fn test_ref_23() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 23).unwrap();
}
#[pg_test]
fn test_ref_24() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 24).unwrap();
}
#[pg_test]
fn test_ref_25() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 25).unwrap();
}
#[pg_test]
fn test_ref_26() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 26).unwrap();
}
#[pg_test]
fn test_ref_27() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 27).unwrap();
}
#[pg_test]
fn test_ref_28() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 28).unwrap();
}
#[pg_test]
fn test_ref_29() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 29).unwrap();
}
#[pg_test]
fn test_ref_30() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 30).unwrap();
}
#[pg_test]
fn test_ref_31() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 31).unwrap();
}
#[pg_test]
fn test_ref_32() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 32).unwrap();
}
#[pg_test]
fn test_ref_33() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 33).unwrap();
}
#[pg_test]
fn test_ref_34() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 34).unwrap();
}
#[pg_test]
fn test_ref_35() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 35).unwrap();
}
#[pg_test]
fn test_ref_36() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 36).unwrap();
}
#[pg_test]
fn test_ref_37() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 37).unwrap();
}
#[pg_test]
fn test_ref_38() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 38).unwrap();
}
#[pg_test]
fn test_ref_39() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
crate::validator::util::run_test_file_at_index(&path, 39).unwrap();
}
#[pg_test]
fn test_maximum_0() {
let path = format!("{}/tests/fixtures/maximum.json", env!("CARGO_MANIFEST_DIR"));

View File

@ -11,39 +11,16 @@ pub struct ValidationContext<'a> {
pub depth: usize,
pub extensible: bool,
pub reporter: bool,
pub overrides: std::collections::HashSet<String>,
}
impl<'a> ValidationContext<'a> {
pub fn resolve_ref(
&self,
ref_string: &str,
) -> Option<(crate::database::schema::ResolvedRef<'a>, String)> {
if let Some(local_schema_arc) = self.root.resolve_ref(ref_string) {
if ref_string.starts_with('#') {
return Some((
crate::database::schema::ResolvedRef::Local(local_schema_arc.as_ref()),
ref_string.to_string(),
));
}
}
// We will replace all of this with `self.schema.compiled_ref` heavily shortly.
// For now, doing a basic map lookup to pass compilation.
if let Some(s) = self.schemas.get(ref_string) {
return Some((
crate::database::schema::ResolvedRef::Global(s, s),
ref_string.to_string(),
));
}
None
}
pub fn new(
schemas: &'a std::collections::HashMap<String, Schema>,
root: &'a Schema,
schema: &'a Schema,
instance: &'a serde_json::Value,
overrides: std::collections::HashSet<String>,
extensible: bool,
reporter: bool,
) -> Self {
@ -57,6 +34,7 @@ impl<'a> ValidationContext<'a> {
depth: 0,
extensible: effective_extensible,
reporter,
overrides,
}
}
@ -65,6 +43,7 @@ impl<'a> ValidationContext<'a> {
schema: &'a Schema,
instance: &'a serde_json::Value,
path: &str,
overrides: std::collections::HashSet<String>,
extensible: bool,
reporter: bool,
) -> Self {
@ -79,11 +58,19 @@ impl<'a> ValidationContext<'a> {
depth: self.depth + 1,
extensible: effective_extensible,
reporter,
overrides,
}
}
pub fn derive_for_schema(&self, schema: &'a Schema, reporter: bool) -> Self {
self.derive(schema, self.instance, &self.path, self.extensible, reporter)
self.derive(
schema,
self.instance,
&self.path,
std::collections::HashSet::new(),
self.extensible,
reporter,
)
}
pub fn validate(&self) -> Result<ValidationResult, ValidationError> {

View File

@ -8,17 +8,16 @@ pub use context::ValidationContext;
pub use error::ValidationError;
pub use result::ValidationResult;
use crate::database::schema::Schema;
use serde_json::Value;
use std::collections::HashSet;
use std::collections::HashMap;
use std::sync::Arc;
pub struct Validator {
pub schemas: std::sync::Arc<std::collections::HashMap<String, crate::database::schema::Schema>>,
pub schemas: Arc<HashMap<String, Schema>>,
}
impl Validator {
pub fn new(
schemas: std::sync::Arc<std::collections::HashMap<String, crate::database::schema::Schema>>,
) -> Self {
pub fn new(schemas: Arc<HashMap<String, Schema>>) -> Self {
Self { schemas }
}
@ -50,7 +49,15 @@ impl Validator {
instance: &Value,
) -> Result<ValidationResult, ValidationError> {
if let Some(schema) = self.schemas.get(schema_id) {
let ctx = ValidationContext::new(&self.schemas, schema, schema, instance, false, false);
let ctx = ValidationContext::new(
&self.schemas,
schema,
schema,
instance,
std::collections::HashSet::new(),
false,
false,
);
ctx.validate_scoped()
} else {
Err(ValidationError {

View File

@ -1,5 +1,4 @@
use serde_json::Value;
use std::collections::HashSet;
use crate::validator::context::ValidationContext;
use crate::validator::error::ValidationError;
@ -53,6 +52,7 @@ impl<'a> ValidationContext<'a> {
contains_schema,
child_instance,
&self.path,
std::collections::HashSet::new(),
self.extensible,
false,
);
@ -91,7 +91,14 @@ impl<'a> ValidationContext<'a> {
if i < len {
let path = format!("{}/{}", self.path, i);
if let Some(child_instance) = arr.get(i) {
let derived = self.derive(sub_schema, child_instance, &path, self.extensible, false);
let derived = self.derive(
sub_schema,
child_instance,
&path,
std::collections::HashSet::new(),
self.extensible,
false,
);
let item_res = derived.validate()?;
result.merge(item_res);
result.evaluated_indices.insert(i);
@ -105,7 +112,14 @@ impl<'a> ValidationContext<'a> {
for i in validation_index..len {
let path = format!("{}/{}", self.path, i);
if let Some(child_instance) = arr.get(i) {
let derived = self.derive(items_schema, child_instance, &path, self.extensible, false);
let derived = self.derive(
items_schema,
child_instance,
&path,
std::collections::HashSet::new(),
self.extensible,
false,
);
let item_res = derived.validate()?;
result.merge(item_res);
result.evaluated_indices.insert(i);

View File

@ -42,7 +42,7 @@ impl<'a> ValidationContext<'a> {
if let Some(obj) = self.instance.as_object() {
for key in obj.keys() {
if !result.evaluated_keys.contains(key) {
if !result.evaluated_keys.contains(key) && !self.overrides.contains(key) {
result.errors.push(ValidationError {
code: "STRICT_PROPERTY_VIOLATION".to_string(),
message: format!("Unexpected property '{}'", key),

View File

@ -1,5 +1,3 @@
use serde_json::Value;
use std::collections::HashSet;
use crate::validator::context::ValidationContext;
use crate::validator::error::ValidationError;

View File

@ -1,5 +1,4 @@
use serde_json::Value;
use std::collections::HashSet;
use crate::validator::context::ValidationContext;
use crate::validator::error::ValidationError;
@ -13,7 +12,7 @@ impl<'a> ValidationContext<'a> {
let current = self.instance;
if let Some(obj) = current.as_object() {
// Entity Bound Implicit Type Validation
if let Some(allowed_types) = &self.schema.obj.compiled_allowed_types {
if let Some(allowed_types) = &self.schema.obj.compiled_variations {
if let Some(type_val) = obj.get("type") {
if let Some(type_str) = type_val.as_str() {
if allowed_types.contains(type_str) {
@ -62,8 +61,38 @@ impl<'a> ValidationContext<'a> {
}
}
if let Some(ref deps) = self.schema.dependencies {
for (prop, dep) in deps {
if obj.contains_key(prop) {
match dep {
crate::database::schema::Dependency::Props(required_props) => {
for req_prop in required_props {
if !obj.contains_key(req_prop) {
result.errors.push(ValidationError {
code: "DEPENDENCY_MISSING".to_string(),
message: format!("Property '{}' requires property '{}'", prop, req_prop),
path: self.path.to_string(),
});
}
}
}
crate::database::schema::Dependency::Schema(dep_schema) => {
let derived = self.derive_for_schema(dep_schema, false);
let dep_res = derived.validate()?;
result.evaluated_keys.extend(dep_res.evaluated_keys.clone());
result.merge(dep_res);
}
}
}
}
}
if let Some(props) = &self.schema.properties {
for (key, sub_schema) in props {
if self.overrides.contains(key) {
continue; // Skip validation if exactly this property was overridden by a child
}
if let Some(child_instance) = obj.get(key) {
let new_path = format!("{}/{}", self.path, key);
let is_ref = sub_schema.ref_string.is_some() || sub_schema.obj.compiled_ref.is_some();
@ -73,6 +102,7 @@ impl<'a> ValidationContext<'a> {
sub_schema,
child_instance,
&new_path,
std::collections::HashSet::new(),
next_extensible,
false,
);
@ -80,7 +110,7 @@ impl<'a> ValidationContext<'a> {
// Entity Bound Implicit Type Interception
if key == "type" {
if let Some(allowed_types) = &self.schema.obj.compiled_allowed_types {
if let Some(allowed_types) = &self.schema.obj.compiled_variations {
if let Some(instance_type) = child_instance.as_str() {
if allowed_types.contains(instance_type) {
item_res
@ -109,6 +139,7 @@ impl<'a> ValidationContext<'a> {
sub_schema,
child_instance,
&new_path,
std::collections::HashSet::new(),
next_extensible,
false,
);
@ -149,6 +180,7 @@ impl<'a> ValidationContext<'a> {
additional_schema,
child_instance,
&new_path,
std::collections::HashSet::new(),
next_extensible,
false,
);
@ -169,6 +201,7 @@ impl<'a> ValidationContext<'a> {
self.root,
property_names,
&val_str,
std::collections::HashSet::new(),
self.extensible,
self.reporter,
);

View File

@ -39,22 +39,31 @@ impl<'a> ValidationContext<'a> {
&self,
result: &mut ValidationResult,
) -> Result<bool, ValidationError> {
// 1. Core $ref logic fully transitioned to memory pointer resolutions.
if let Some(_ref_str) = &self.schema.ref_string {
if let Some(global_schema) = &self.schema.compiled_ref {
// 1. Core $ref logic relies on the fast O(1) map to allow cycles and proper nesting
if let Some(ref_str) = &self.schema.ref_string {
if let Some(global_schema) = self.schemas.get(ref_str) {
let mut new_overrides = self.overrides.clone();
if let Some(props) = &self.schema.properties {
new_overrides.extend(props.keys().map(|k| k.to_string()));
}
let mut shadow = self.derive(
global_schema,
self.instance,
&self.path,
new_overrides,
self.extensible,
false,
true,
);
shadow.root = global_schema;
result.merge(shadow.validate()?);
} else {
result.errors.push(ValidationError {
code: "REF_RESOLUTION_FAILED".to_string(),
message: format!("Reference pointer was not compiled inside Database graph"),
message: format!(
"Reference pointer to '{}' was not found in schema registry",
ref_str
),
path: self.path.to_string(),
});
}

View File

@ -15,7 +15,7 @@ struct TestCase {
data: serde_json::Value,
valid: bool,
// Support explicit schema ID target for test case
schema_id: Option<String>,
schema_id: String,
}
// use crate::validator::registry::REGISTRY; // No longer used directly for tests!
@ -49,37 +49,17 @@ pub fn run_test_file_at_index(path: &str, index: usize) -> Result<(), String> {
// 4. Run Tests
for (_test_index, test) in group.tests.iter().enumerate() {
let mut schema_id = test.schema_id.clone();
let schema_id = &test.schema_id;
// If no explicit schema_id, infer from the database structure
if schema_id.is_none() {
if let Some(schemas) = db_json.get("schemas").and_then(|v| v.as_array()) {
if let Some(first) = schemas.first() {
if let Some(id) = first.get("$id").and_then(|v| v.as_str()) {
schema_id = Some(id.to_string());
} else {
schema_id = Some("schema_0".to_string());
}
}
if validator.schemas.get(schema_id).is_none() {
failures.push(format!(
"[{}] Missing Schema: Cannot find schema ID '{}'",
group.description, schema_id
));
continue;
}
if schema_id.is_none() {
if let Some(puncs) = db_json.get("puncs").and_then(|v| v.as_array()) {
if let Some(first_punc) = puncs.first() {
if let Some(schemas) = first_punc.get("schemas").and_then(|v| v.as_array()) {
if let Some(first) = schemas.first() {
if let Some(id) = first.get("$id").and_then(|v| v.as_str()) {
schema_id = Some(id.to_string());
}
}
}
}
}
}
}
if let Some(sid) = schema_id {
let result = validator.validate(&sid, &test.data);
let result = validator.validate(schema_id, &test.data);
let (got_valid, _errors) = match &result {
Ok(res) => (res.is_valid(), &res.errors),
@ -101,12 +81,6 @@ pub fn run_test_file_at_index(path: &str, index: usize) -> Result<(), String> {
group.description, test.description, test.valid, got_valid, error_msg
));
}
} else {
failures.push(format!(
"[{}] Test '{}' skipped: No schema ID found.",
group.description, test.description
));
}
}
if !failures.is_empty() {

View File

@ -102,6 +102,72 @@ fn test_additional_properties_2() {
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_dependencies_0() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 0).unwrap();
}
#[test]
fn test_dependencies_1() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_dependencies_2() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_dependencies_3() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_dependencies_4() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 4).unwrap();
}
#[test]
fn test_dependencies_5() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 5).unwrap();
}
#[test]
fn test_dependencies_6() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 6).unwrap();
}
#[test]
fn test_dependencies_7() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 7).unwrap();
}
#[test]
fn test_dependencies_8() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 8).unwrap();
}
#[test]
fn test_dependencies_9() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 9).unwrap();
}
#[test]
fn test_dependencies_10() {
let path = format!("{}/tests/fixtures/dependencies.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 10).unwrap();
}
#[test]
fn test_exclusive_minimum_0() {
let path = format!("{}/tests/fixtures/exclusiveMinimum.json", env!("CARGO_MANIFEST_DIR"));
@ -498,30 +564,6 @@ fn test_items_15() {
util::run_test_file_at_index(&path, 15).unwrap();
}
#[test]
fn test_typed_refs_0() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 0).unwrap();
}
#[test]
fn test_typed_refs_1() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_typed_refs_2() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_typed_refs_3() {
let path = format!("{}/tests/fixtures/typedRefs.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_enum_0() {
let path = format!("{}/tests/fixtures/enum.json", env!("CARGO_MANIFEST_DIR"));
@ -804,42 +846,6 @@ fn test_max_length_1() {
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_dependent_schemas_0() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 0).unwrap();
}
#[test]
fn test_dependent_schemas_1() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_dependent_schemas_2() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_dependent_schemas_3() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_dependent_schemas_4() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 4).unwrap();
}
#[test]
fn test_dependent_schemas_5() {
let path = format!("{}/tests/fixtures/dependentSchemas.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 5).unwrap();
}
#[test]
fn test_exclusive_maximum_0() {
let path = format!("{}/tests/fixtures/exclusiveMaximum.json", env!("CARGO_MANIFEST_DIR"));
@ -1080,30 +1086,6 @@ fn test_pattern_1() {
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_masking_0() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 0).unwrap();
}
#[test]
fn test_masking_1() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_masking_2() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_masking_3() {
let path = format!("{}/tests/fixtures/masking.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_max_properties_0() {
let path = format!("{}/tests/fixtures/maxProperties.json", env!("CARGO_MANIFEST_DIR"));
@ -1128,36 +1110,6 @@ fn test_max_properties_3() {
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_dependent_required_0() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 0).unwrap();
}
#[test]
fn test_dependent_required_1() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 1).unwrap();
}
#[test]
fn test_dependent_required_2() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 2).unwrap();
}
#[test]
fn test_dependent_required_3() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 3).unwrap();
}
#[test]
fn test_dependent_required_4() {
let path = format!("{}/tests/fixtures/dependentRequired.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 4).unwrap();
}
#[test]
fn test_required_0() {
let path = format!("{}/tests/fixtures/required.json", env!("CARGO_MANIFEST_DIR"));
@ -1686,150 +1638,6 @@ fn test_ref_15() {
util::run_test_file_at_index(&path, 15).unwrap();
}
#[test]
fn test_ref_16() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 16).unwrap();
}
#[test]
fn test_ref_17() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 17).unwrap();
}
#[test]
fn test_ref_18() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 18).unwrap();
}
#[test]
fn test_ref_19() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 19).unwrap();
}
#[test]
fn test_ref_20() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 20).unwrap();
}
#[test]
fn test_ref_21() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 21).unwrap();
}
#[test]
fn test_ref_22() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 22).unwrap();
}
#[test]
fn test_ref_23() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 23).unwrap();
}
#[test]
fn test_ref_24() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 24).unwrap();
}
#[test]
fn test_ref_25() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 25).unwrap();
}
#[test]
fn test_ref_26() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 26).unwrap();
}
#[test]
fn test_ref_27() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 27).unwrap();
}
#[test]
fn test_ref_28() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 28).unwrap();
}
#[test]
fn test_ref_29() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 29).unwrap();
}
#[test]
fn test_ref_30() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 30).unwrap();
}
#[test]
fn test_ref_31() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 31).unwrap();
}
#[test]
fn test_ref_32() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 32).unwrap();
}
#[test]
fn test_ref_33() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 33).unwrap();
}
#[test]
fn test_ref_34() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 34).unwrap();
}
#[test]
fn test_ref_35() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 35).unwrap();
}
#[test]
fn test_ref_36() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 36).unwrap();
}
#[test]
fn test_ref_37() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 37).unwrap();
}
#[test]
fn test_ref_38() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 38).unwrap();
}
#[test]
fn test_ref_39() {
let path = format!("{}/tests/fixtures/ref.json", env!("CARGO_MANIFEST_DIR"));
util::run_test_file_at_index(&path, 39).unwrap();
}
#[test]
fn test_maximum_0() {
let path = format!("{}/tests/fixtures/maximum.json", env!("CARGO_MANIFEST_DIR"));

View File

@ -4,7 +4,7 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema1",
"properties": {
"foo": {
"type": "string"
@ -26,7 +26,8 @@
"foo": "value",
"bar": 123
},
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "additional property matching schema is valid",
@ -35,7 +36,8 @@
"is_active": true,
"hidden": false
},
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "additional property not matching schema is invalid",
@ -43,7 +45,8 @@
"foo": "value",
"is_active": 1
},
"valid": false
"valid": false,
"schema_id": "schema1"
}
]
},
@ -52,7 +55,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {
"type": "string"
@ -61,7 +63,8 @@
"extensible": true,
"additionalProperties": {
"type": "integer"
}
},
"$id": "additionalProperties_1_0"
}
]
},
@ -73,7 +76,8 @@
"count": 5,
"age": 42
},
"valid": true
"valid": true,
"schema_id": "additionalProperties_1_0"
},
{
"description": "additional property not matching schema is invalid despite extensible: true",
@ -81,7 +85,8 @@
"foo": "hello",
"count": "five"
},
"valid": false
"valid": false,
"schema_id": "additionalProperties_1_0"
}
]
},
@ -90,7 +95,7 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "schema3",
"properties": {
"type": {
"type": "string"
@ -118,7 +123,8 @@
"field3"
]
},
"valid": true
"valid": true,
"schema_id": "schema3"
},
{
"description": "invalid array of integers",
@ -129,7 +135,8 @@
2
]
},
"valid": false
"valid": false,
"schema_id": "schema3"
},
{
"description": "invalid non-array type",
@ -137,7 +144,8 @@
"type": "my_type",
"group_a": "field1"
},
"valid": false
"valid": false,
"schema_id": "schema3"
}
]
}

View File

@ -4,7 +4,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"properties": {
@ -26,7 +25,8 @@
"foo"
]
}
]
],
"$id": "allOf_0_0"
}
]
},
@ -37,21 +37,24 @@
"foo": "baz",
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "allOf_0_0"
},
{
"description": "mismatch second",
"data": {
"foo": "baz"
},
"valid": false
"valid": false,
"schema_id": "allOf_0_0"
},
{
"description": "mismatch first",
"data": {
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "allOf_0_0"
},
{
"description": "wrong type",
@ -59,7 +62,8 @@
"foo": "baz",
"bar": "quux"
},
"valid": false
"valid": false,
"schema_id": "allOf_0_0"
}
]
},
@ -68,7 +72,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"bar": {
"type": "integer"
@ -102,7 +105,8 @@
"baz"
]
}
]
],
"$id": "allOf_1_0"
}
]
},
@ -114,7 +118,8 @@
"bar": 2,
"baz": null
},
"valid": true
"valid": true,
"schema_id": "allOf_1_0"
},
{
"description": "mismatch base schema",
@ -122,7 +127,8 @@
"foo": "quux",
"baz": null
},
"valid": false
"valid": false,
"schema_id": "allOf_1_0"
},
{
"description": "mismatch first allOf",
@ -130,7 +136,8 @@
"bar": 2,
"baz": null
},
"valid": false
"valid": false,
"schema_id": "allOf_1_0"
},
{
"description": "mismatch second allOf",
@ -138,14 +145,16 @@
"foo": "quux",
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "allOf_1_0"
},
{
"description": "mismatch both",
"data": {
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "allOf_1_0"
}
]
},
@ -154,7 +163,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"maximum": 30
@ -162,7 +170,8 @@
{
"minimum": 20
}
]
],
"$id": "allOf_2_0"
}
]
},
@ -170,12 +179,14 @@
{
"description": "valid",
"data": 25,
"valid": true
"valid": true,
"schema_id": "allOf_2_0"
},
{
"description": "mismatch one",
"data": 35,
"valid": false
"valid": false,
"schema_id": "allOf_2_0"
}
]
},
@ -184,11 +195,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
true,
true
]
],
"$id": "allOf_3_0"
}
]
},
@ -196,7 +207,8 @@
{
"description": "any value is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "allOf_3_0"
}
]
},
@ -205,11 +217,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
true,
false
]
],
"$id": "allOf_4_0"
}
]
},
@ -217,7 +229,8 @@
{
"description": "any value is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "allOf_4_0"
}
]
},
@ -226,11 +239,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
false,
false
]
],
"$id": "allOf_5_0"
}
]
},
@ -238,7 +251,8 @@
{
"description": "any value is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "allOf_5_0"
}
]
},
@ -247,10 +261,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{}
]
],
"$id": "allOf_6_0"
}
]
},
@ -258,7 +272,8 @@
{
"description": "any data is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "allOf_6_0"
}
]
},
@ -267,11 +282,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{},
{}
]
],
"$id": "allOf_7_0"
}
]
},
@ -279,7 +294,8 @@
{
"description": "any data is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "allOf_7_0"
}
]
},
@ -288,13 +304,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{},
{
"type": "number"
}
]
],
"$id": "allOf_8_0"
}
]
},
@ -302,12 +318,14 @@
{
"description": "number is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "allOf_8_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "allOf_8_0"
}
]
},
@ -316,13 +334,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"type": "number"
},
{}
]
],
"$id": "allOf_9_0"
}
]
},
@ -330,12 +348,14 @@
{
"description": "number is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "allOf_9_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "allOf_9_0"
}
]
},
@ -344,7 +364,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"allOf": [
@ -353,7 +372,8 @@
}
]
}
]
],
"$id": "allOf_10_0"
}
]
},
@ -361,12 +381,14 @@
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "allOf_10_0"
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false
"valid": false,
"schema_id": "allOf_10_0"
}
]
},
@ -375,7 +397,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"multipleOf": 2
@ -390,7 +411,8 @@
{
"multipleOf": 5
}
]
],
"$id": "allOf_11_0"
}
]
},
@ -398,42 +420,50 @@
{
"description": "allOf: false, anyOf: false, oneOf: false",
"data": 1,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: false, anyOf: false, oneOf: true",
"data": 5,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: false, anyOf: true, oneOf: false",
"data": 3,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: false, anyOf: true, oneOf: true",
"data": 15,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: true, anyOf: false, oneOf: false",
"data": 2,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: true, anyOf: false, oneOf: true",
"data": 10,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: true, anyOf: true, oneOf: false",
"data": 6,
"valid": false
"valid": false,
"schema_id": "allOf_11_0"
},
{
"description": "allOf: true, anyOf: true, oneOf: true",
"data": 30,
"valid": true
"valid": true,
"schema_id": "allOf_11_0"
}
]
},
@ -442,7 +472,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"properties": {
@ -465,7 +494,8 @@
]
}
],
"extensible": true
"extensible": true,
"$id": "allOf_12_0"
}
]
},
@ -477,7 +507,8 @@
"bar": 2,
"qux": 3
},
"valid": true
"valid": true,
"schema_id": "allOf_12_0"
}
]
},
@ -486,7 +517,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"properties": {
@ -502,7 +532,8 @@
}
}
}
]
],
"$id": "allOf_13_0"
}
]
},
@ -513,7 +544,8 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "allOf_13_0"
},
{
"description": "fails on extra property z explicitly",
@ -522,7 +554,8 @@
"bar": 2,
"z": 3
},
"valid": false
"valid": false,
"schema_id": "allOf_13_0"
}
]
},
@ -531,7 +564,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"properties": {
@ -548,7 +580,8 @@
}
}
}
]
],
"$id": "allOf_14_0"
}
]
},
@ -560,7 +593,8 @@
"bar": 2,
"z": 3
},
"valid": true
"valid": true,
"schema_id": "allOf_14_0"
}
]
},
@ -571,29 +605,30 @@
{
"allOf": [
{
"$ref": "#/$defs/partA"
"$ref": "partA"
},
{
"$ref": "#/$defs/partB"
"$ref": "partB"
}
],
"$defs": {
"partA": {
"$id": "allOf_15_0"
},
{
"$id": "partA",
"properties": {
"id": {
"type": "string"
}
}
},
"partB": {
{
"$id": "partB",
"properties": {
"name": {
"type": "string"
}
}
}
}
}
]
},
"tests": [
@ -603,7 +638,8 @@
"id": "1",
"name": "Me"
},
"valid": true
"valid": true,
"schema_id": "allOf_15_0"
},
{
"description": "extra property is invalid (root is strict)",
@ -612,7 +648,8 @@
"name": "Me",
"extra": 1
},
"valid": false
"valid": false,
"schema_id": "allOf_15_0"
},
{
"description": "partA mismatch is invalid",
@ -620,7 +657,8 @@
"id": 1,
"name": "Me"
},
"valid": false
"valid": false,
"schema_id": "allOf_15_0"
}
]
}

View File

@ -4,7 +4,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "integer"
@ -12,7 +11,8 @@
{
"minimum": 2
}
]
],
"$id": "anyOf_0_0"
}
]
},
@ -20,22 +20,26 @@
{
"description": "first anyOf valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "anyOf_0_0"
},
{
"description": "second anyOf valid",
"data": 2.5,
"valid": true
"valid": true,
"schema_id": "anyOf_0_0"
},
{
"description": "both anyOf valid",
"data": 3,
"valid": true
"valid": true,
"schema_id": "anyOf_0_0"
},
{
"description": "neither anyOf valid",
"data": 1.5,
"valid": false
"valid": false,
"schema_id": "anyOf_0_0"
}
]
},
@ -44,7 +48,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
"anyOf": [
{
@ -53,7 +56,8 @@
{
"minLength": 4
}
]
],
"$id": "anyOf_1_0"
}
]
},
@ -61,17 +65,20 @@
{
"description": "mismatch base schema",
"data": 3,
"valid": false
"valid": false,
"schema_id": "anyOf_1_0"
},
{
"description": "one anyOf valid",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "anyOf_1_0"
},
{
"description": "both anyOf invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "anyOf_1_0"
}
]
},
@ -80,11 +87,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
true,
true
]
],
"$id": "anyOf_2_0"
}
]
},
@ -92,7 +99,8 @@
{
"description": "any value is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "anyOf_2_0"
}
]
},
@ -101,11 +109,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
true,
false
]
],
"$id": "anyOf_3_0"
}
]
},
@ -113,7 +121,8 @@
{
"description": "any value is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "anyOf_3_0"
}
]
},
@ -122,11 +131,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
false,
false
]
],
"$id": "anyOf_4_0"
}
]
},
@ -134,7 +143,8 @@
{
"description": "any value is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "anyOf_4_0"
}
]
},
@ -143,7 +153,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"properties": {
@ -165,7 +174,8 @@
"foo"
]
}
]
],
"$id": "anyOf_5_0"
}
]
},
@ -175,14 +185,16 @@
"data": {
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "anyOf_5_0"
},
{
"description": "second anyOf valid (complex)",
"data": {
"foo": "baz"
},
"valid": true
"valid": true,
"schema_id": "anyOf_5_0"
},
{
"description": "both anyOf valid (complex)",
@ -190,7 +202,8 @@
"foo": "baz",
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "anyOf_5_0"
},
{
"description": "neither anyOf valid (complex)",
@ -198,7 +211,8 @@
"foo": 2,
"bar": "quux"
},
"valid": false
"valid": false,
"schema_id": "anyOf_5_0"
}
]
},
@ -207,13 +221,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "number"
},
{}
]
],
"$id": "anyOf_6_0"
}
]
},
@ -221,12 +235,14 @@
{
"description": "string is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "anyOf_6_0"
},
{
"description": "number is valid",
"data": 123,
"valid": true
"valid": true,
"schema_id": "anyOf_6_0"
}
]
},
@ -235,7 +251,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"anyOf": [
@ -244,7 +259,8 @@
}
]
}
]
],
"$id": "anyOf_7_0"
}
]
},
@ -252,12 +268,14 @@
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "anyOf_7_0"
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false
"valid": false,
"schema_id": "anyOf_7_0"
}
]
},
@ -266,7 +284,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"type": "integer"
@ -275,7 +292,8 @@
"minimum": 2
}
],
"extensible": true
"extensible": true,
"$id": "anyOf_8_0"
}
]
},
@ -285,7 +303,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "anyOf_8_0"
}
]
},
@ -294,7 +313,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"anyOf": [
{
"properties": {
@ -310,7 +328,8 @@
}
}
}
]
],
"$id": "anyOf_9_0"
}
]
},
@ -320,7 +339,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "anyOf_9_0"
},
{
"description": "fails on extra property z explicitly",
@ -328,7 +348,8 @@
"foo": 1,
"z": 3
},
"valid": false
"valid": false,
"schema_id": "anyOf_9_0"
}
]
}

View File

@ -3,58 +3,69 @@
"description": "boolean schema 'true'",
"database": {
"schemas": [
true
{
"$id": "booleanSchema_0_0"
}
]
},
"tests": [
{
"description": "number is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "string is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "boolean true is valid",
"data": true,
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "boolean false is valid",
"data": false,
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "object is valid",
"data": {
"foo": "bar"
},
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "array is valid",
"data": [
"foo"
],
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
},
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "booleanSchema_0_0"
}
]
},
@ -62,58 +73,70 @@
"description": "boolean schema 'false'",
"database": {
"schemas": [
false
{
"not": {},
"$id": "booleanSchema_1_0"
}
]
},
"tests": [
{
"description": "number is invalid",
"data": 1,
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "boolean true is invalid",
"data": true,
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "boolean false is invalid",
"data": false,
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "null is invalid",
"data": null,
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "object is invalid",
"data": {
"foo": "bar"
},
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "array is invalid",
"data": [
"foo"
],
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "booleanSchema_1_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": 2
"const": 2,
"$id": "const_0_0"
}
]
},
@ -13,17 +13,20 @@
{
"description": "same value is valid",
"data": 2,
"valid": true
"valid": true,
"schema_id": "const_0_0"
},
{
"description": "another value is invalid",
"data": 5,
"valid": false
"valid": false,
"schema_id": "const_0_0"
},
{
"description": "another type is invalid",
"data": "a",
"valid": false
"valid": false,
"schema_id": "const_0_0"
}
]
},
@ -32,7 +35,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": {
"foo": "bar",
"baz": "bax"
@ -40,7 +42,8 @@
"properties": {
"foo": {},
"baz": {}
}
},
"$id": "const_1_0"
}
]
},
@ -51,7 +54,8 @@
"foo": "bar",
"baz": "bax"
},
"valid": true
"valid": true,
"schema_id": "const_1_0"
},
{
"description": "same object with different property order is valid",
@ -59,14 +63,16 @@
"baz": "bax",
"foo": "bar"
},
"valid": true
"valid": true,
"schema_id": "const_1_0"
},
{
"description": "another object is invalid",
"data": {
"foo": "bar"
},
"valid": false
"valid": false,
"schema_id": "const_1_0"
},
{
"description": "another type is invalid",
@ -74,7 +80,8 @@
1,
2
],
"valid": false
"valid": false,
"schema_id": "const_1_0"
}
]
},
@ -83,12 +90,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": [
{
"foo": "bar"
}
]
],
"$id": "const_2_0"
}
]
},
@ -100,14 +107,16 @@
"foo": "bar"
}
],
"valid": true
"valid": true,
"schema_id": "const_2_0"
},
{
"description": "another array item is invalid",
"data": [
2
],
"valid": false
"valid": false,
"schema_id": "const_2_0"
},
{
"description": "array with additional items is invalid",
@ -116,7 +125,8 @@
2,
3
],
"valid": false
"valid": false,
"schema_id": "const_2_0"
}
]
},
@ -125,8 +135,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": null
"const": null,
"$id": "const_3_0"
}
]
},
@ -134,12 +144,14 @@
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "const_3_0"
},
{
"description": "not null is invalid",
"data": 0,
"valid": false
"valid": false,
"schema_id": "const_3_0"
}
]
},
@ -148,8 +160,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": false
"const": false,
"$id": "const_4_0"
}
]
},
@ -157,17 +169,20 @@
{
"description": "false is valid",
"data": false,
"valid": true
"valid": true,
"schema_id": "const_4_0"
},
{
"description": "integer zero is invalid",
"data": 0,
"valid": false
"valid": false,
"schema_id": "const_4_0"
},
{
"description": "float zero is invalid",
"data": 0.0,
"valid": false
"data": 0,
"valid": false,
"schema_id": "const_4_0"
}
]
},
@ -176,8 +191,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": true
"const": true,
"$id": "const_5_0"
}
]
},
@ -185,17 +200,20 @@
{
"description": "true is valid",
"data": true,
"valid": true
"valid": true,
"schema_id": "const_5_0"
},
{
"description": "integer one is invalid",
"data": 1,
"valid": false
"valid": false,
"schema_id": "const_5_0"
},
{
"description": "float one is invalid",
"data": 1.0,
"valid": false
"data": 1,
"valid": false,
"schema_id": "const_5_0"
}
]
},
@ -204,10 +222,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": [
false
]
],
"$id": "const_6_0"
}
]
},
@ -217,21 +235,24 @@
"data": [
false
],
"valid": true
"valid": true,
"schema_id": "const_6_0"
},
{
"description": "[0] is invalid",
"data": [
0
],
"valid": false
"valid": false,
"schema_id": "const_6_0"
},
{
"description": "[0.0] is invalid",
"data": [
0.0
0
],
"valid": false
"valid": false,
"schema_id": "const_6_0"
}
]
},
@ -240,10 +261,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": [
true
]
],
"$id": "const_7_0"
}
]
},
@ -253,21 +274,24 @@
"data": [
true
],
"valid": true
"valid": true,
"schema_id": "const_7_0"
},
{
"description": "[1] is invalid",
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "const_7_0"
},
{
"description": "[1.0] is invalid",
"data": [
1.0
1
],
"valid": false
"valid": false,
"schema_id": "const_7_0"
}
]
},
@ -276,10 +300,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": {
"a": false
}
},
"$id": "const_8_0"
}
]
},
@ -289,21 +313,24 @@
"data": {
"a": false
},
"valid": true
"valid": true,
"schema_id": "const_8_0"
},
{
"description": "{\"a\": 0} is invalid",
"data": {
"a": 0
},
"valid": false
"valid": false,
"schema_id": "const_8_0"
},
{
"description": "{\"a\": 0.0} is invalid",
"data": {
"a": 0.0
"a": 0
},
"valid": false
"valid": false,
"schema_id": "const_8_0"
}
]
},
@ -312,10 +339,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": {
"a": true
}
},
"$id": "const_9_0"
}
]
},
@ -325,21 +352,24 @@
"data": {
"a": true
},
"valid": true
"valid": true,
"schema_id": "const_9_0"
},
{
"description": "{\"a\": 1} is invalid",
"data": {
"a": 1
},
"valid": false
"valid": false,
"schema_id": "const_9_0"
},
{
"description": "{\"a\": 1.0} is invalid",
"data": {
"a": 1.0
"a": 1
},
"valid": false
"valid": false,
"schema_id": "const_9_0"
}
]
},
@ -348,8 +378,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": 0
"const": 0,
"$id": "const_10_0"
}
]
},
@ -357,32 +387,38 @@
{
"description": "false is invalid",
"data": false,
"valid": false
"valid": false,
"schema_id": "const_10_0"
},
{
"description": "integer zero is valid",
"data": 0,
"valid": true
"valid": true,
"schema_id": "const_10_0"
},
{
"description": "float zero is valid",
"data": 0.0,
"valid": true
"data": 0,
"valid": true,
"schema_id": "const_10_0"
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "const_10_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "const_10_0"
},
{
"description": "empty string is invalid",
"data": "",
"valid": false
"valid": false,
"schema_id": "const_10_0"
}
]
},
@ -391,8 +427,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": 1
"const": 1,
"$id": "const_11_0"
}
]
},
@ -400,17 +436,20 @@
{
"description": "true is invalid",
"data": true,
"valid": false
"valid": false,
"schema_id": "const_11_0"
},
{
"description": "integer one is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "const_11_0"
},
{
"description": "float one is valid",
"data": 1.0,
"valid": true
"data": 1,
"valid": true,
"schema_id": "const_11_0"
}
]
},
@ -419,8 +458,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": -2.0
"const": -2,
"$id": "const_12_0"
}
]
},
@ -428,27 +467,32 @@
{
"description": "integer -2 is valid",
"data": -2,
"valid": true
"valid": true,
"schema_id": "const_12_0"
},
{
"description": "integer 2 is invalid",
"data": 2,
"valid": false
"valid": false,
"schema_id": "const_12_0"
},
{
"description": "float -2.0 is valid",
"data": -2.0,
"valid": true
"data": -2,
"valid": true,
"schema_id": "const_12_0"
},
{
"description": "float 2.0 is invalid",
"data": 2.0,
"valid": false
"data": 2,
"valid": false,
"schema_id": "const_12_0"
},
{
"description": "float -2.00001 is invalid",
"data": -2.00001,
"valid": false
"valid": false,
"schema_id": "const_12_0"
}
]
},
@ -457,8 +501,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": 9007199254740992
"const": 9007199254740992,
"$id": "const_13_0"
}
]
},
@ -466,22 +510,26 @@
{
"description": "integer is valid",
"data": 9007199254740992,
"valid": true
"valid": true,
"schema_id": "const_13_0"
},
{
"description": "integer minus one is invalid",
"data": 9007199254740991,
"valid": false
"valid": false,
"schema_id": "const_13_0"
},
{
"description": "float is valid",
"data": 9007199254740992.0,
"valid": true
"data": 9007199254740992,
"valid": true,
"schema_id": "const_13_0"
},
{
"description": "float minus one is invalid",
"data": 9007199254740991.0,
"valid": false
"data": 9007199254740991,
"valid": false,
"schema_id": "const_13_0"
}
]
},
@ -490,8 +538,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": "hello\u0000there"
"const": "hello\u0000there",
"$id": "const_14_0"
}
]
},
@ -499,12 +547,14 @@
{
"description": "match string with nul",
"data": "hello\u0000there",
"valid": true
"valid": true,
"schema_id": "const_14_0"
},
{
"description": "do not match string lacking nul",
"data": "hellothere",
"valid": false
"valid": false,
"schema_id": "const_14_0"
}
]
},
@ -513,9 +563,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": "μ",
"$comment": "U+03BC"
"$comment": "U+03BC",
"$id": "const_15_0"
}
]
},
@ -524,13 +574,15 @@
"description": "character uses the same codepoint",
"data": "μ",
"comment": "U+03BC",
"valid": true
"valid": true,
"schema_id": "const_15_0"
},
{
"description": "character looks the same but uses a different codepoint",
"data": "µ",
"comment": "U+00B5",
"valid": false
"valid": false,
"schema_id": "const_15_0"
}
]
},
@ -539,9 +591,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": "ä",
"$comment": "U+00E4"
"$comment": "U+00E4",
"$id": "const_16_0"
}
]
},
@ -550,13 +602,15 @@
"description": "character uses the same codepoint",
"data": "ä",
"comment": "U+00E4",
"valid": true
"valid": true,
"schema_id": "const_16_0"
},
{
"description": "character looks the same but uses combining marks",
"data": "ä",
"comment": "a, U+0308",
"valid": false
"valid": false,
"schema_id": "const_16_0"
}
]
},
@ -565,11 +619,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"const": {
"a": 1
},
"extensible": true
"extensible": true,
"$id": "const_17_0"
}
]
},
@ -580,14 +634,16 @@
"a": 1,
"b": 2
},
"valid": false
"valid": false,
"schema_id": "const_17_0"
},
{
"description": "extra property match in const (this is effectively impossible if data has extra props not in const, it implicitly fails const check unless we assume const check ignored extra props? No, const check is strict. So this test is just to show strictness passes.)",
"data": {
"a": 1
},
"valid": true
"valid": true,
"schema_id": "const_17_0"
}
]
}

View File

@ -4,11 +4,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"minimum": 5
},
"items": true
"items": true,
"$id": "contains_0_0"
}
]
},
@ -20,7 +20,8 @@
4,
5
],
"valid": true
"valid": true,
"schema_id": "contains_0_0"
},
{
"description": "array with item matching schema (6) is valid (items: true)",
@ -29,7 +30,8 @@
4,
6
],
"valid": true
"valid": true,
"schema_id": "contains_0_0"
},
{
"description": "array with two items matching schema (5, 6) is valid (items: true)",
@ -39,7 +41,8 @@
5,
6
],
"valid": true
"valid": true,
"schema_id": "contains_0_0"
},
{
"description": "array without items matching schema is invalid",
@ -48,17 +51,20 @@
3,
4
],
"valid": false
"valid": false,
"schema_id": "contains_0_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "contains_0_0"
},
{
"description": "not array is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "contains_0_0"
}
]
},
@ -67,11 +73,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 5
},
"items": true
"items": true,
"$id": "contains_1_0"
}
]
},
@ -83,7 +89,8 @@
4,
5
],
"valid": true
"valid": true,
"schema_id": "contains_1_0"
},
{
"description": "array with two items 5 is valid (items: true)",
@ -93,7 +100,8 @@
5,
5
],
"valid": true
"valid": true,
"schema_id": "contains_1_0"
},
{
"description": "array without item 5 is invalid",
@ -103,7 +111,8 @@
3,
4
],
"valid": false
"valid": false,
"schema_id": "contains_1_0"
}
]
},
@ -112,8 +121,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": true
"contains": true,
"$id": "contains_2_0"
}
]
},
@ -123,12 +132,14 @@
"data": [
"foo"
],
"valid": true
"valid": true,
"schema_id": "contains_2_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "contains_2_0"
}
]
},
@ -137,8 +148,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": false
"contains": false,
"$id": "contains_3_0"
}
]
},
@ -148,17 +159,20 @@
"data": [
"foo"
],
"valid": false
"valid": false,
"schema_id": "contains_3_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "contains_3_0"
},
{
"description": "non-arrays are valid",
"data": "contains does not apply to strings",
"valid": true
"valid": true,
"schema_id": "contains_3_0"
}
]
},
@ -167,13 +181,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {
"multipleOf": 2
},
"contains": {
"multipleOf": 3
}
},
"$id": "contains_4_0"
}
]
},
@ -185,7 +199,8 @@
4,
8
],
"valid": false
"valid": false,
"schema_id": "contains_4_0"
},
{
"description": "does not match items, matches contains",
@ -194,7 +209,8 @@
6,
9
],
"valid": false
"valid": false,
"schema_id": "contains_4_0"
},
{
"description": "matches both items and contains",
@ -202,7 +218,8 @@
6,
12
],
"valid": true
"valid": true,
"schema_id": "contains_4_0"
},
{
"description": "matches neither items nor contains",
@ -210,7 +227,8 @@
1,
5
],
"valid": false
"valid": false,
"schema_id": "contains_4_0"
}
]
},
@ -219,11 +237,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"if": false,
"else": true
}
},
"$id": "contains_5_0"
}
]
},
@ -233,12 +251,14 @@
"data": [
"foo"
],
"valid": true
"valid": true,
"schema_id": "contains_5_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "contains_5_0"
}
]
},
@ -247,10 +267,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"type": "null"
}
},
"$id": "contains_6_0"
}
]
},
@ -260,7 +280,8 @@
"data": [
null
],
"valid": true
"valid": true,
"schema_id": "contains_6_0"
}
]
},
@ -269,11 +290,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"extensible": true
"extensible": true,
"$id": "contains_7_0"
}
]
},
@ -284,7 +305,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "contains_7_0"
}
]
},
@ -293,10 +315,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
}
},
"$id": "contains_8_0"
}
]
},
@ -307,7 +329,8 @@
1,
2
],
"valid": false
"valid": false,
"schema_id": "contains_8_0"
},
{
"description": "only matching items is valid",
@ -315,7 +338,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "contains_8_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentMediaType": "application/json"
"contentMediaType": "application/json",
"$id": "content_0_0"
}
]
},
@ -13,17 +13,20 @@
{
"description": "a valid JSON document",
"data": "{\"foo\": \"bar\"}",
"valid": true
"valid": true,
"schema_id": "content_0_0"
},
{
"description": "an invalid JSON document; validates true",
"data": "{:}",
"valid": true
"valid": true,
"schema_id": "content_0_0"
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
"valid": true,
"schema_id": "content_0_0"
}
]
},
@ -32,8 +35,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentEncoding": "base64"
"contentEncoding": "base64",
"$id": "content_1_0"
}
]
},
@ -41,17 +44,20 @@
{
"description": "a valid base64 string",
"data": "eyJmb28iOiAiYmFyIn0K",
"valid": true
"valid": true,
"schema_id": "content_1_0"
},
{
"description": "an invalid base64 string (% is not a valid character); validates true",
"data": "eyJmb28iOi%iYmFyIn0K",
"valid": true
"valid": true,
"schema_id": "content_1_0"
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
"valid": true,
"schema_id": "content_1_0"
}
]
},
@ -60,9 +66,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentMediaType": "application/json",
"contentEncoding": "base64"
"contentEncoding": "base64",
"$id": "content_2_0"
}
]
},
@ -70,22 +76,26 @@
{
"description": "a valid base64-encoded JSON document",
"data": "eyJmb28iOiAiYmFyIn0K",
"valid": true
"valid": true,
"schema_id": "content_2_0"
},
{
"description": "a validly-encoded invalid JSON document; validates true",
"data": "ezp9Cg==",
"valid": true
"valid": true,
"schema_id": "content_2_0"
},
{
"description": "an invalid base64 string that is valid JSON; validates true",
"data": "{}",
"valid": true
"valid": true,
"schema_id": "content_2_0"
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
"valid": true,
"schema_id": "content_2_0"
}
]
},
@ -94,7 +104,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contentMediaType": "application/json",
"contentEncoding": "base64",
"contentSchema": {
@ -110,7 +119,8 @@
"type": "integer"
}
}
}
},
"$id": "content_3_0"
}
]
},
@ -118,42 +128,50 @@
{
"description": "a valid base64-encoded JSON document",
"data": "eyJmb28iOiAiYmFyIn0K",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "another valid base64-encoded JSON document",
"data": "eyJib28iOiAyMCwgImZvbyI6ICJiYXoifQ==",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "an invalid base64-encoded JSON document; validates true",
"data": "eyJib28iOiAyMH0=",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "an empty object as a base64-encoded JSON document; validates true",
"data": "e30=",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "an empty array as a base64-encoded JSON document",
"data": "W10=",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "a validly-encoded invalid JSON document; validates true",
"data": "ezp9Cg==",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "an invalid base64 string that is valid JSON; validates true",
"data": "{}",
"valid": true
"valid": true,
"schema_id": "content_3_0"
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
"valid": true,
"schema_id": "content_3_0"
}
]
}

View File

@ -19,14 +19,16 @@
{
"description": "neither",
"data": {},
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "nondependant",
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "with dependency",
@ -34,31 +36,36 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "missing dependency",
"data": {
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "schema1"
},
{
"description": "ignores arrays",
"data": [
"bar"
],
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "schema1"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "schema1"
}
]
},
@ -80,19 +87,22 @@
{
"description": "empty object",
"data": {},
"valid": true
"valid": true,
"schema_id": "schema2"
},
{
"description": "object with one property",
"data": {
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "schema2"
},
{
"description": "non-object is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "schema2"
}
]
},
@ -117,7 +127,8 @@
{
"description": "neither",
"data": {},
"valid": true
"valid": true,
"schema_id": "schema3"
},
{
"description": "nondependants",
@ -125,7 +136,8 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "schema3"
},
{
"description": "with dependencies",
@ -134,7 +146,8 @@
"bar": 2,
"quux": 3
},
"valid": true
"valid": true,
"schema_id": "schema3"
},
{
"description": "missing dependency",
@ -142,7 +155,8 @@
"foo": 1,
"quux": 2
},
"valid": false
"valid": false,
"schema_id": "schema3"
},
{
"description": "missing other dependency",
@ -150,14 +164,16 @@
"bar": 1,
"quux": 2
},
"valid": false
"valid": false,
"schema_id": "schema3"
},
{
"description": "missing both dependencies",
"data": {
"quux": 1
},
"valid": false
"valid": false,
"schema_id": "schema3"
}
]
},
@ -187,7 +203,8 @@
"foo\nbar": 1,
"foo\rbar": 2
},
"valid": true
"valid": true,
"schema_id": "schema4"
},
{
"description": "quoted quotes",
@ -195,7 +212,8 @@
"foo'bar": 1,
"foo\"bar": 2
},
"valid": true
"valid": true,
"schema_id": "schema4"
},
{
"description": "CRLF missing dependent",
@ -203,14 +221,16 @@
"foo\nbar": 1,
"foo": 2
},
"valid": false
"valid": false,
"schema_id": "schema4"
},
{
"description": "quoted quotes missing dependent",
"data": {
"foo\"bar": 2
},
"valid": false
"valid": false,
"schema_id": "schema4"
}
]
},
@ -238,7 +258,8 @@
"bar": 2,
"baz": 3
},
"valid": true
"valid": true,
"schema_id": "schema5"
}
]
},
@ -275,14 +296,16 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "schema_schema1"
},
{
"description": "no dependency",
"data": {
"foo": "quux"
},
"valid": true
"valid": true,
"schema_id": "schema_schema1"
},
{
"description": "wrong type",
@ -290,7 +313,8 @@
"foo": "quux",
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "schema_schema1"
},
{
"description": "wrong type other",
@ -298,7 +322,8 @@
"foo": 2,
"bar": "quux"
},
"valid": false
"valid": false,
"schema_id": "schema_schema1"
},
{
"description": "wrong type both",
@ -306,7 +331,8 @@
"foo": "quux",
"bar": "quux"
},
"valid": false
"valid": false,
"schema_id": "schema_schema1"
},
{
"description": "ignores arrays (invalid in strict mode)",
@ -318,17 +344,20 @@
{
"code": "STRICT_ITEM_VIOLATION"
}
]
],
"schema_id": "schema_schema1"
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "schema_schema1"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "schema_schema1"
}
]
},
@ -365,7 +394,8 @@
"data": [
"bar"
],
"valid": true
"valid": true,
"schema_id": "schema_schema2"
}
]
},
@ -393,14 +423,16 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "schema_schema3"
},
{
"description": "object with property having schema false is invalid",
"data": {
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "schema_schema3"
},
{
"description": "object with both properties is invalid",
@ -408,12 +440,14 @@
"foo": 1,
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "schema_schema3"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "schema_schema3"
}
]
},
@ -454,7 +488,8 @@
"b": 3,
"c": 4
},
"valid": true
"valid": true,
"schema_id": "schema_schema4"
},
{
"description": "quoted quote",
@ -463,7 +498,8 @@
"foo\"bar": 1
}
},
"valid": false
"valid": false,
"schema_id": "schema_schema4"
},
{
"description": "quoted tab invalid under dependent schema",
@ -471,14 +507,16 @@
"foo\tbar": 1,
"a": 2
},
"valid": false
"valid": false,
"schema_id": "schema_schema4"
},
{
"description": "quoted quote invalid under dependent schema",
"data": {
"foo'bar": 1
},
"valid": false
"valid": false,
"schema_id": "schema_schema4"
}
]
},
@ -509,7 +547,8 @@
"data": {
"foo": 1
},
"valid": false
"valid": false,
"schema_id": "schema_schema5"
},
{
"description": "matches dependency (invalid in strict mode - bar not allowed if foo missing)",
@ -521,7 +560,8 @@
{
"code": "STRICT_PROPERTY_VIOLATION"
}
]
],
"schema_id": "schema_schema5"
},
{
"description": "matches both",
@ -529,14 +569,16 @@
"foo": 1,
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "schema_schema5"
},
{
"description": "no dependency",
"data": {
"baz": 1
},
"valid": true
"valid": true,
"schema_id": "schema_schema5"
}
]
},
@ -569,7 +611,8 @@
"data": {
"bar": 1
},
"valid": true
"valid": true,
"schema_id": "schema_schema6"
}
]
}

View File

@ -4,7 +4,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"obj": {
"type": "object"
@ -37,7 +36,8 @@
"con_empty": {
"const": ""
}
}
},
"$id": "emptyString_0_0"
}
]
},
@ -47,56 +47,64 @@
"data": {
"obj": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for array",
"data": {
"arr": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for string",
"data": {
"str": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for integer",
"data": {
"int": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for number",
"data": {
"num": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for boolean",
"data": {
"bool": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for null",
"data": {
"nul": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string valid for format",
"data": {
"fmt": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
},
{
"description": "empty string INVALID for const (unless const is empty string)",
@ -109,14 +117,16 @@
"code": "CONST_VIOLATED",
"path": "/con"
}
]
],
"schema_id": "emptyString_0_0"
},
{
"description": "empty string VALID for const if const IS empty string",
"data": {
"con_empty": ""
},
"valid": true
"valid": true,
"schema_id": "emptyString_0_0"
}
]
}

View File

@ -4,12 +4,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
1,
2,
3
]
],
"$id": "enum_0_0"
}
]
},
@ -17,12 +17,14 @@
{
"description": "one of the enum is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "enum_0_0"
},
{
"description": "something else is invalid",
"data": 4,
"valid": false
"valid": false,
"schema_id": "enum_0_0"
}
]
},
@ -31,7 +33,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
6,
"foo",
@ -43,7 +44,8 @@
],
"properties": {
"foo": {}
}
},
"$id": "enum_1_0"
}
]
},
@ -51,26 +53,30 @@
{
"description": "one of the enum is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "enum_1_0"
},
{
"description": "something else is invalid",
"data": null,
"valid": false
"valid": false,
"schema_id": "enum_1_0"
},
{
"description": "objects are deep compared",
"data": {
"foo": false
},
"valid": false
"valid": false,
"schema_id": "enum_1_0"
},
{
"description": "valid object matches",
"data": {
"foo": 12
},
"valid": true
"valid": true,
"schema_id": "enum_1_0"
},
{
"description": "extra properties in object is invalid",
@ -78,7 +84,8 @@
"foo": 12,
"boo": 42
},
"valid": false
"valid": false,
"schema_id": "enum_1_0"
}
]
},
@ -87,11 +94,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
6,
null
]
],
"$id": "enum_2_0"
}
]
},
@ -99,17 +106,20 @@
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "enum_2_0"
},
{
"description": "number is valid",
"data": 6,
"valid": true
"valid": true,
"schema_id": "enum_2_0"
},
{
"description": "something else is invalid",
"data": "test",
"valid": false
"valid": false,
"schema_id": "enum_2_0"
}
]
},
@ -118,7 +128,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": {
@ -134,7 +143,8 @@
},
"required": [
"bar"
]
],
"$id": "enum_3_0"
}
]
},
@ -145,7 +155,8 @@
"foo": "foo",
"bar": "bar"
},
"valid": true
"valid": true,
"schema_id": "enum_3_0"
},
{
"description": "wrong foo value",
@ -153,7 +164,8 @@
"foo": "foot",
"bar": "bar"
},
"valid": false
"valid": false,
"schema_id": "enum_3_0"
},
{
"description": "wrong bar value",
@ -161,26 +173,30 @@
"foo": "foo",
"bar": "bart"
},
"valid": false
"valid": false,
"schema_id": "enum_3_0"
},
{
"description": "missing optional property is valid",
"data": {
"bar": "bar"
},
"valid": true
"valid": true,
"schema_id": "enum_3_0"
},
{
"description": "missing required property is invalid",
"data": {
"foo": "foo"
},
"valid": false
"valid": false,
"schema_id": "enum_3_0"
},
{
"description": "missing all properties is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "enum_3_0"
}
]
},
@ -189,11 +205,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
"foo\nbar",
"foo\rbar"
]
],
"$id": "enum_4_0"
}
]
},
@ -201,17 +217,20 @@
{
"description": "member 1 is valid",
"data": "foo\nbar",
"valid": true
"valid": true,
"schema_id": "enum_4_0"
},
{
"description": "member 2 is valid",
"data": "foo\rbar",
"valid": true
"valid": true,
"schema_id": "enum_4_0"
},
{
"description": "another string is invalid",
"data": "abc",
"valid": false
"valid": false,
"schema_id": "enum_4_0"
}
]
},
@ -220,10 +239,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
false
]
],
"$id": "enum_5_0"
}
]
},
@ -231,17 +250,20 @@
{
"description": "false is valid",
"data": false,
"valid": true
"valid": true,
"schema_id": "enum_5_0"
},
{
"description": "integer zero is invalid",
"data": 0,
"valid": false
"valid": false,
"schema_id": "enum_5_0"
},
{
"description": "float zero is invalid",
"data": 0.0,
"valid": false
"data": 0,
"valid": false,
"schema_id": "enum_5_0"
}
]
},
@ -250,12 +272,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
[
false
]
]
],
"$id": "enum_6_0"
}
]
},
@ -265,21 +287,24 @@
"data": [
false
],
"valid": true
"valid": true,
"schema_id": "enum_6_0"
},
{
"description": "[0] is invalid",
"data": [
0
],
"valid": false
"valid": false,
"schema_id": "enum_6_0"
},
{
"description": "[0.0] is invalid",
"data": [
0.0
0
],
"valid": false
"valid": false,
"schema_id": "enum_6_0"
}
]
},
@ -288,10 +313,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
true
]
],
"$id": "enum_7_0"
}
]
},
@ -299,17 +324,20 @@
{
"description": "true is valid",
"data": true,
"valid": true
"valid": true,
"schema_id": "enum_7_0"
},
{
"description": "integer one is invalid",
"data": 1,
"valid": false
"valid": false,
"schema_id": "enum_7_0"
},
{
"description": "float one is invalid",
"data": 1.0,
"valid": false
"data": 1,
"valid": false,
"schema_id": "enum_7_0"
}
]
},
@ -318,12 +346,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
[
true
]
]
],
"$id": "enum_8_0"
}
]
},
@ -333,21 +361,24 @@
"data": [
true
],
"valid": true
"valid": true,
"schema_id": "enum_8_0"
},
{
"description": "[1] is invalid",
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "enum_8_0"
},
{
"description": "[1.0] is invalid",
"data": [
1.0
1
],
"valid": false
"valid": false,
"schema_id": "enum_8_0"
}
]
},
@ -356,10 +387,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
0
]
],
"$id": "enum_9_0"
}
]
},
@ -367,17 +398,20 @@
{
"description": "false is invalid",
"data": false,
"valid": false
"valid": false,
"schema_id": "enum_9_0"
},
{
"description": "integer zero is valid",
"data": 0,
"valid": true
"valid": true,
"schema_id": "enum_9_0"
},
{
"description": "float zero is valid",
"data": 0.0,
"valid": true
"data": 0,
"valid": true,
"schema_id": "enum_9_0"
}
]
},
@ -386,12 +420,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
[
0
]
]
],
"$id": "enum_10_0"
}
]
},
@ -401,21 +435,24 @@
"data": [
false
],
"valid": false
"valid": false,
"schema_id": "enum_10_0"
},
{
"description": "[0] is valid",
"data": [
0
],
"valid": true
"valid": true,
"schema_id": "enum_10_0"
},
{
"description": "[0.0] is valid",
"data": [
0.0
0
],
"valid": true
"valid": true,
"schema_id": "enum_10_0"
}
]
},
@ -424,10 +461,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
1
]
],
"$id": "enum_11_0"
}
]
},
@ -435,17 +472,20 @@
{
"description": "true is invalid",
"data": true,
"valid": false
"valid": false,
"schema_id": "enum_11_0"
},
{
"description": "integer one is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "enum_11_0"
},
{
"description": "float one is valid",
"data": 1.0,
"valid": true
"data": 1,
"valid": true,
"schema_id": "enum_11_0"
}
]
},
@ -454,12 +494,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
[
1
]
]
],
"$id": "enum_12_0"
}
]
},
@ -469,21 +509,24 @@
"data": [
true
],
"valid": false
"valid": false,
"schema_id": "enum_12_0"
},
{
"description": "[1] is valid",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "enum_12_0"
},
{
"description": "[1.0] is valid",
"data": [
1.0
1
],
"valid": true
"valid": true,
"schema_id": "enum_12_0"
}
]
},
@ -492,10 +535,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
"hello\u0000there"
]
],
"$id": "enum_13_0"
}
]
},
@ -503,12 +546,14 @@
{
"description": "match string with nul",
"data": "hello\u0000there",
"valid": true
"valid": true,
"schema_id": "enum_13_0"
},
{
"description": "do not match string lacking nul",
"data": "hellothere",
"valid": false
"valid": false,
"schema_id": "enum_13_0"
}
]
},
@ -517,13 +562,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"enum": [
{
"foo": 1
}
],
"extensible": true
"extensible": true,
"$id": "enum_14_0"
}
]
},
@ -534,14 +579,16 @@
"foo": 1,
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "enum_14_0"
},
{
"description": "extra property ignored during strict check, enum match succeeds",
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "enum_14_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"exclusiveMaximum": 3.0
"exclusiveMaximum": 3,
"$id": "exclusiveMaximum_0_0"
}
]
},
@ -13,22 +13,26 @@
{
"description": "below the exclusiveMaximum is valid",
"data": 2.2,
"valid": true
"valid": true,
"schema_id": "exclusiveMaximum_0_0"
},
{
"description": "boundary point is invalid",
"data": 3.0,
"valid": false
"data": 3,
"valid": false,
"schema_id": "exclusiveMaximum_0_0"
},
{
"description": "above the exclusiveMaximum is invalid",
"data": 3.5,
"valid": false
"valid": false,
"schema_id": "exclusiveMaximum_0_0"
},
{
"description": "ignores non-numbers",
"data": "x",
"valid": true
"valid": true,
"schema_id": "exclusiveMaximum_0_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"exclusiveMinimum": 1.1
"exclusiveMinimum": 1.1,
"$id": "exclusiveMinimum_0_0"
}
]
},
@ -13,22 +13,26 @@
{
"description": "above the exclusiveMinimum is valid",
"data": 1.2,
"valid": true
"valid": true,
"schema_id": "exclusiveMinimum_0_0"
},
{
"description": "boundary point is invalid",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "exclusiveMinimum_0_0"
},
{
"description": "below the exclusiveMinimum is invalid",
"data": 0.6,
"valid": false
"valid": false,
"schema_id": "exclusiveMinimum_0_0"
},
{
"description": "ignores non-numbers",
"data": "x",
"valid": true
"valid": true,
"schema_id": "exclusiveMinimum_0_0"
}
]
}

View File

@ -1,6 +1,6 @@
[
{
"description": "Entity families with dot patterns",
"description": "Entity families via pure $ref graph",
"database": {
"types": [
{
@ -17,8 +17,7 @@
"type": "string"
},
"type": {
"type": "string",
"const": "entity"
"type": "string"
}
}
},
@ -65,7 +64,7 @@
},
{
"$id": "person.light",
"$ref": "person"
"$ref": "entity.light"
}
]
}
@ -113,7 +112,7 @@
"valid": true
},
{
"description": "Dot pattern family matches entity.light",
"description": "Graph family matches entity.light",
"schema_id": "get_light_entities.response",
"data": {
"id": "3",
@ -122,25 +121,29 @@
"valid": true
},
{
"description": "Dot pattern family matches person.light",
"description": "Graph family matches person.light (because it $refs entity.light)",
"schema_id": "get_light_entities.response",
"data": {
"id": "4",
"type": "person",
"name": "ACME",
"first_name": "John"
"type": "person"
},
"valid": true
},
{
"description": "Dot pattern family excludes organization (missing .light schema, constraint violation)",
"description": "Graph family excludes organization (missing .light schema that $refs entity.light)",
"schema_id": "get_light_entities.response",
"data": {
"id": "5",
"type": "organization",
"name": "ACME"
},
"valid": false
"valid": false,
"expect_errors": [
{
"code": "FAMILY_MISMATCH",
"path": ""
}
]
}
]
},
@ -182,20 +185,14 @@
},
"tests": [
{
"description": "Ad-hoc family does not implicitly match descendants (no magical implicit hierarchy on normal ad-hoc schemas)",
"description": "Ad-hoc family matches strictly by shape (no magic variations for base schemas)",
"schema_id": "get_widgets.response",
"data": {
"id": "1",
"widget_type": "special",
"special_feature": "yes"
},
"valid": false,
"expect_errors": [
{
"code": "FAMILY_MISMATCH",
"path": ""
}
]
"valid": true
}
]
}

File diff suppressed because it is too large Load Diff

View File

@ -4,10 +4,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": {
"const": 0
}
},
"$id": "if-then-else_0_0"
}
]
},
@ -15,12 +15,14 @@
{
"description": "valid when valid against lone if",
"data": 0,
"valid": true
"valid": true,
"schema_id": "if-then-else_0_0"
},
{
"description": "valid when invalid against lone if",
"data": "hello",
"valid": true
"valid": true,
"schema_id": "if-then-else_0_0"
}
]
},
@ -29,10 +31,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"then": {
"const": 0
}
},
"$id": "if-then-else_1_0"
}
]
},
@ -40,12 +42,14 @@
{
"description": "valid when valid against lone then",
"data": 0,
"valid": true
"valid": true,
"schema_id": "if-then-else_1_0"
},
{
"description": "valid when invalid against lone then",
"data": "hello",
"valid": true
"valid": true,
"schema_id": "if-then-else_1_0"
}
]
},
@ -54,10 +58,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"else": {
"const": 0
}
},
"$id": "if-then-else_2_0"
}
]
},
@ -65,12 +69,14 @@
{
"description": "valid when valid against lone else",
"data": 0,
"valid": true
"valid": true,
"schema_id": "if-then-else_2_0"
},
{
"description": "valid when invalid against lone else",
"data": "hello",
"valid": true
"valid": true,
"schema_id": "if-then-else_2_0"
}
]
},
@ -79,13 +85,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": {
"exclusiveMaximum": 0
},
"then": {
"minimum": -10
}
},
"$id": "if-then-else_3_0"
}
]
},
@ -93,17 +99,20 @@
{
"description": "valid through then",
"data": -1,
"valid": true
"valid": true,
"schema_id": "if-then-else_3_0"
},
{
"description": "invalid through then",
"data": -100,
"valid": false
"valid": false,
"schema_id": "if-then-else_3_0"
},
{
"description": "valid when if test fails",
"data": 3,
"valid": true
"valid": true,
"schema_id": "if-then-else_3_0"
}
]
},
@ -112,13 +121,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": {
"exclusiveMaximum": 0
},
"else": {
"multipleOf": 2
}
},
"$id": "if-then-else_4_0"
}
]
},
@ -126,17 +135,20 @@
{
"description": "valid when if test passes",
"data": -1,
"valid": true
"valid": true,
"schema_id": "if-then-else_4_0"
},
{
"description": "valid through else",
"data": 4,
"valid": true
"valid": true,
"schema_id": "if-then-else_4_0"
},
{
"description": "invalid through else",
"data": 3,
"valid": false
"valid": false,
"schema_id": "if-then-else_4_0"
}
]
},
@ -145,7 +157,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": {
"exclusiveMaximum": 0
},
@ -154,7 +165,8 @@
},
"else": {
"multipleOf": 2
}
},
"$id": "if-then-else_5_0"
}
]
},
@ -162,22 +174,26 @@
{
"description": "valid through then",
"data": -1,
"valid": true
"valid": true,
"schema_id": "if-then-else_5_0"
},
{
"description": "invalid through then",
"data": -100,
"valid": false
"valid": false,
"schema_id": "if-then-else_5_0"
},
{
"description": "valid through else",
"data": 4,
"valid": true
"valid": true,
"schema_id": "if-then-else_5_0"
},
{
"description": "invalid through else",
"data": 3,
"valid": false
"valid": false,
"schema_id": "if-then-else_5_0"
}
]
},
@ -186,7 +202,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"if": {
@ -203,7 +218,8 @@
"multipleOf": 2
}
}
]
],
"$id": "if-then-else_6_0"
}
]
},
@ -211,12 +227,14 @@
{
"description": "valid, but would have been invalid through then",
"data": -100,
"valid": true
"valid": true,
"schema_id": "if-then-else_6_0"
},
{
"description": "valid, but would have been invalid through else",
"data": 3,
"valid": true
"valid": true,
"schema_id": "if-then-else_6_0"
}
]
},
@ -225,14 +243,14 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": true,
"then": {
"const": "then"
},
"else": {
"const": "else"
}
},
"$id": "if-then-else_7_0"
}
]
},
@ -240,12 +258,14 @@
{
"description": "boolean schema true in if always chooses the then path (valid)",
"data": "then",
"valid": true
"valid": true,
"schema_id": "if-then-else_7_0"
},
{
"description": "boolean schema true in if always chooses the then path (invalid)",
"data": "else",
"valid": false
"valid": false,
"schema_id": "if-then-else_7_0"
}
]
},
@ -254,14 +274,14 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": false,
"then": {
"const": "then"
},
"else": {
"const": "else"
}
},
"$id": "if-then-else_8_0"
}
]
},
@ -269,12 +289,14 @@
{
"description": "boolean schema false in if always chooses the else path (invalid)",
"data": "then",
"valid": false
"valid": false,
"schema_id": "if-then-else_8_0"
},
{
"description": "boolean schema false in if always chooses the else path (valid)",
"data": "else",
"valid": true
"valid": true,
"schema_id": "if-then-else_8_0"
}
]
},
@ -283,7 +305,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"then": {
"const": "yes"
},
@ -292,7 +313,8 @@
},
"if": {
"maxLength": 4
}
},
"$id": "if-then-else_9_0"
}
]
},
@ -300,22 +322,26 @@
{
"description": "yes redirects to then and passes",
"data": "yes",
"valid": true
"valid": true,
"schema_id": "if-then-else_9_0"
},
{
"description": "other redirects to else and passes",
"data": "other",
"valid": true
"valid": true,
"schema_id": "if-then-else_9_0"
},
{
"description": "no redirects to then and fails",
"data": "no",
"valid": false
"valid": false,
"schema_id": "if-then-else_9_0"
},
{
"description": "invalid redirects to else and fails",
"data": "invalid",
"valid": false
"valid": false,
"schema_id": "if-then-else_9_0"
}
]
},
@ -327,7 +353,8 @@
"if": {
"const": 1
},
"then": false
"then": false,
"$id": "if-then-else_10_0"
}
]
},
@ -335,12 +362,14 @@
{
"description": "matches if → then=false → invalid",
"data": 1,
"valid": false
"valid": false,
"schema_id": "if-then-else_10_0"
},
{
"description": "does not match if → then ignored → valid",
"data": 2,
"valid": true
"valid": true,
"schema_id": "if-then-else_10_0"
}
]
},
@ -352,7 +381,8 @@
"if": {
"const": 1
},
"else": false
"else": false,
"$id": "if-then-else_11_0"
}
]
},
@ -360,12 +390,14 @@
{
"description": "matches if → else ignored → valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "if-then-else_11_0"
},
{
"description": "does not match if → else executes → invalid",
"data": 2,
"valid": false
"valid": false,
"schema_id": "if-then-else_11_0"
}
]
},
@ -374,7 +406,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": {
"properties": {
"foo": {
@ -395,7 +426,8 @@
"bar"
]
},
"extensible": true
"extensible": true,
"$id": "if-then-else_12_0"
}
]
},
@ -407,7 +439,8 @@
"bar": 2,
"extra": "prop"
},
"valid": true
"valid": true,
"schema_id": "if-then-else_12_0"
}
]
},
@ -416,7 +449,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"if": {
"properties": {
"foo": {
@ -433,7 +465,8 @@
"const": 2
}
}
}
},
"$id": "if-then-else_13_0"
}
]
},
@ -444,7 +477,8 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "if-then-else_13_0"
},
{
"description": "fails on extra property z explicitly",
@ -453,7 +487,8 @@
"bar": 2,
"z": 3
},
"valid": false
"valid": false,
"schema_id": "if-then-else_13_0"
}
]
}

View File

@ -4,10 +4,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {
"type": "integer"
}
},
"$id": "items_0_0"
}
]
},
@ -19,7 +19,8 @@
2,
3
],
"valid": true
"valid": true,
"schema_id": "items_0_0"
},
{
"description": "wrong type of items",
@ -27,14 +28,16 @@
1,
"x"
],
"valid": false
"valid": false,
"schema_id": "items_0_0"
},
{
"description": "non-arrays are invalid",
"data": {
"foo": "bar"
},
"valid": false
"valid": false,
"schema_id": "items_0_0"
},
{
"description": "JavaScript pseudo-arrays are invalid",
@ -42,7 +45,8 @@
"0": "invalid",
"length": 1
},
"valid": false
"valid": false,
"schema_id": "items_0_0"
}
]
},
@ -51,8 +55,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": true
"items": true,
"$id": "items_1_0"
}
]
},
@ -64,12 +68,14 @@
"foo",
true
],
"valid": true
"valid": true,
"schema_id": "items_1_0"
},
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "items_1_0"
}
]
},
@ -78,8 +84,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": false
"items": false,
"$id": "items_2_0"
}
]
},
@ -91,12 +97,14 @@
"foo",
true
],
"valid": false
"valid": false,
"schema_id": "items_2_0"
},
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "items_2_0"
}
]
},
@ -105,41 +113,41 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"item": {
"type": "array",
"items": false,
"prefixItems": [
{
"$ref": "#/$defs/sub-item"
"$ref": "item"
},
{
"$ref": "#/$defs/sub-item"
"$ref": "item"
},
{
"$ref": "item"
}
],
"$id": "items_3_0"
},
{
"$id": "item",
"type": "array",
"items": false,
"prefixItems": [
{
"$ref": "sub-item"
},
{
"$ref": "sub-item"
}
]
},
"sub-item": {
{
"$id": "sub-item",
"type": "object",
"required": [
"foo"
]
}
},
"type": "array",
"items": false,
"prefixItems": [
{
"$ref": "#/$defs/item"
},
{
"$ref": "#/$defs/item"
},
{
"$ref": "#/$defs/item"
}
]
}
]
},
"tests": [
@ -171,7 +179,8 @@
}
]
],
"valid": false
"valid": false,
"schema_id": "items_3_0"
},
{
"description": "too many items",
@ -209,7 +218,8 @@
}
]
],
"valid": false
"valid": false,
"schema_id": "items_3_0"
},
{
"description": "too many sub-items",
@ -242,7 +252,8 @@
}
]
],
"valid": false
"valid": false,
"schema_id": "items_3_0"
},
{
"description": "wrong item",
@ -267,7 +278,8 @@
}
]
],
"valid": false
"valid": false,
"schema_id": "items_3_0"
},
{
"description": "wrong sub-item",
@ -295,7 +307,8 @@
}
]
],
"valid": false
"valid": false,
"schema_id": "items_3_0"
},
{
"description": "fewer items is invalid",
@ -311,7 +324,8 @@
}
]
],
"valid": false
"valid": false,
"schema_id": "items_3_0"
}
]
},
@ -320,7 +334,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"type": "array",
@ -333,7 +346,8 @@
}
}
}
}
},
"$id": "items_4_0"
}
]
},
@ -370,7 +384,8 @@
]
]
],
"valid": true
"valid": true,
"schema_id": "items_4_0"
},
{
"description": "nested array with invalid type",
@ -404,7 +419,8 @@
]
]
],
"valid": false
"valid": false,
"schema_id": "items_4_0"
},
{
"description": "not deep enough",
@ -432,7 +448,8 @@
]
]
],
"valid": false
"valid": false,
"schema_id": "items_4_0"
}
]
},
@ -441,13 +458,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{},
{},
{}
],
"items": false
"items": false,
"$id": "items_5_0"
}
]
},
@ -455,14 +472,16 @@
{
"description": "empty array",
"data": [],
"valid": true
"valid": true,
"schema_id": "items_5_0"
},
{
"description": "fewer number of items present (1)",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "items_5_0"
},
{
"description": "fewer number of items present (2)",
@ -470,7 +489,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "items_5_0"
},
{
"description": "equal number of items present",
@ -479,7 +499,8 @@
2,
3
],
"valid": true
"valid": true,
"schema_id": "items_5_0"
},
{
"description": "additional items are not permitted",
@ -489,7 +510,8 @@
3,
4
],
"valid": false
"valid": false,
"schema_id": "items_5_0"
}
]
},
@ -498,7 +520,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"allOf": [
{
"prefixItems": [
@ -510,7 +531,8 @@
],
"items": {
"minimum": 5
}
},
"$id": "items_6_0"
}
]
},
@ -521,7 +543,8 @@
3,
5
],
"valid": false
"valid": false,
"schema_id": "items_6_0"
},
{
"description": "prefixItems in allOf does not constrain items, valid case",
@ -529,7 +552,8 @@
5,
5
],
"valid": true
"valid": true,
"schema_id": "items_6_0"
}
]
},
@ -538,7 +562,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "string"
@ -546,7 +569,8 @@
],
"items": {
"type": "integer"
}
},
"$id": "items_7_0"
}
]
},
@ -558,7 +582,8 @@
2,
3
],
"valid": true
"valid": true,
"schema_id": "items_7_0"
},
{
"description": "wrong type of second item",
@ -566,7 +591,8 @@
"x",
"y"
],
"valid": false
"valid": false,
"schema_id": "items_7_0"
}
]
},
@ -575,11 +601,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{}
],
"items": false
"items": false,
"$id": "items_8_0"
}
]
},
@ -591,14 +617,16 @@
"bar",
37
],
"valid": false
"valid": false,
"schema_id": "items_8_0"
},
{
"description": "valid instance",
"data": [
null
],
"valid": true
"valid": true,
"schema_id": "items_8_0"
}
]
},
@ -607,10 +635,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {
"type": "null"
}
},
"$id": "items_9_0"
}
]
},
@ -620,7 +648,8 @@
"data": [
null
],
"valid": true
"valid": true,
"schema_id": "items_9_0"
}
]
},
@ -629,9 +658,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": false,
"extensible": true
"extensible": true,
"$id": "items_10_0"
}
]
},
@ -641,7 +670,8 @@
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "items_10_0"
}
]
},
@ -650,11 +680,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"items": {
"minimum": 5
},
"extensible": true
"extensible": true,
"$id": "items_11_0"
}
]
},
@ -665,14 +695,16 @@
5,
6
],
"valid": true
"valid": true,
"schema_id": "items_11_0"
},
{
"description": "invalid item (less than min) is invalid even with extensible: true",
"data": [
4
],
"valid": false
"valid": false,
"schema_id": "items_11_0"
}
]
},
@ -681,9 +713,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"extensible": true
"extensible": true,
"$id": "items_12_0"
}
]
},
@ -691,7 +723,8 @@
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "items_12_0"
},
{
"description": "array with items is valid (extensible)",
@ -699,7 +732,8 @@
1,
"foo"
],
"valid": true
"valid": true,
"schema_id": "items_12_0"
}
]
},
@ -708,9 +742,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"extensible": false
"extensible": false,
"$id": "items_13_0"
}
]
},
@ -718,14 +752,16 @@
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "items_13_0"
},
{
"description": "array with items is invalid (strict)",
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "items_13_0"
}
]
},
@ -734,11 +770,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"extensible": true
}
},
"$id": "items_14_0"
}
]
},
@ -746,7 +782,8 @@
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "items_14_0"
},
{
"description": "array with items is valid (items explicitly allowed to be anything extensible)",
@ -755,7 +792,8 @@
"foo",
{}
],
"valid": true
"valid": true,
"schema_id": "items_14_0"
}
]
},
@ -764,12 +802,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array",
"items": {
"type": "object",
"extensible": false
}
},
"$id": "items_15_0"
}
]
},
@ -779,14 +817,16 @@
"data": [
{}
],
"valid": true
"valid": true,
"schema_id": "items_15_0"
},
{
"description": "array with strict object items is valid",
"data": [
{}
],
"valid": true
"valid": true,
"schema_id": "items_15_0"
},
{
"description": "array with invalid strict object items (extra property)",
@ -795,7 +835,8 @@
"extra": 1
}
],
"valid": false
"valid": false,
"schema_id": "items_15_0"
}
]
}

View File

@ -1,187 +0,0 @@
[
{
"description": "Masking Properties",
"database": {
"schemas": [
{
"$id": "mask_properties",
"type": "object",
"properties": {
"foo": {
"type": "string"
},
"bar": {
"type": "integer"
}
},
"required": [
"foo"
],
"extensible": false
}
]
},
"tests": [
{
"description": "Keep valid properties",
"data": {
"foo": "a",
"bar": 1
},
"valid": true,
"expected": {
"foo": "a",
"bar": 1
}
},
{
"description": "Remove unknown properties",
"data": {
"foo": "a",
"baz": true
},
"valid": true,
"expected": {
"foo": "a"
}
},
{
"description": "Keep valid properties with unknown",
"data": {
"foo": "a",
"bar": 1,
"baz": true
},
"valid": true,
"expected": {
"foo": "a",
"bar": 1
}
}
]
},
{
"description": "Masking Nested Objects",
"database": {
"schemas": [
{
"$id": "mask_nested",
"type": "object",
"properties": {
"meta": {
"type": "object",
"properties": {
"id": {
"type": "integer"
}
},
"extensible": false
}
},
"extensible": false
}
]
},
"tests": [
{
"description": "Mask nested object",
"data": {
"meta": {
"id": 1,
"extra": "x"
},
"top_extra": "y"
},
"valid": true,
"expected": {
"meta": {
"id": 1
}
}
}
]
},
{
"description": "Masking Arrays",
"database": {
"schemas": [
{
"$id": "mask_arrays",
"type": "object",
"properties": {
"tags": {
"type": "array",
"items": {
"type": "string"
}
}
},
"extensible": false
}
]
},
"tests": [
{
"description": "Arrays are kept (items are valid)",
"data": {
"tags": [
"a",
"b"
]
},
"valid": true,
"expected": {
"tags": [
"a",
"b"
]
}
}
]
},
{
"description": "Masking Tuple Arrays (prefixItems)",
"database": {
"schemas": [
{
"$id": "mask_tuple",
"type": "object",
"properties": {
"coord": {
"type": "array",
"prefixItems": [
{
"type": "number"
},
{
"type": "number"
}
]
}
},
"extensible": false
}
]
},
"tests": [
{
"description": "Extra tuple items removed",
"data": {
"coord": [
1,
2,
3,
"extra"
]
},
"valid": true,
"expected": {
"coord": [
1,
2
]
}
}
]
}
]

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxContains": 1,
"extensible": true
"extensible": true,
"$id": "maxContains_0_0"
}
]
},
@ -16,7 +16,8 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "maxContains_0_0"
},
{
"description": "two items still valid against lone maxContains",
@ -24,7 +25,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "maxContains_0_0"
}
]
},
@ -33,12 +35,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"maxContains": 1,
"extensible": true
"extensible": true,
"$id": "maxContains_1_0"
}
]
},
@ -46,14 +48,16 @@
{
"description": "empty data",
"data": [],
"valid": false
"valid": false,
"schema_id": "maxContains_1_0"
},
{
"description": "all elements match, valid maxContains",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "maxContains_1_0"
},
{
"description": "all elements match, invalid maxContains",
@ -61,7 +65,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "maxContains_1_0"
},
{
"description": "some elements match, valid maxContains",
@ -69,7 +74,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "maxContains_1_0"
},
{
"description": "some elements match, invalid maxContains",
@ -78,7 +84,8 @@
2,
1
],
"valid": false
"valid": false,
"schema_id": "maxContains_1_0"
}
]
},
@ -87,12 +94,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"maxContains": 1.0,
"extensible": true
"maxContains": 1,
"extensible": true,
"$id": "maxContains_2_0"
}
]
},
@ -102,7 +109,8 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "maxContains_2_0"
},
{
"description": "too many elements match, invalid maxContains",
@ -110,7 +118,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "maxContains_2_0"
}
]
},
@ -119,13 +128,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 1,
"maxContains": 3,
"extensible": true
"extensible": true,
"$id": "maxContains_3_0"
}
]
},
@ -133,7 +142,8 @@
{
"description": "actual < minContains < maxContains",
"data": [],
"valid": false
"valid": false,
"schema_id": "maxContains_3_0"
},
{
"description": "minContains < actual < maxContains",
@ -141,7 +151,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "maxContains_3_0"
},
{
"description": "minContains < maxContains < actual",
@ -151,7 +162,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "maxContains_3_0"
}
]
},
@ -160,12 +172,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"maxContains": 1,
"extensible": true
"extensible": true,
"$id": "maxContains_4_0"
}
]
},
@ -176,7 +188,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "maxContains_4_0"
}
]
}

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxItems": 2,
"extensible": true
"extensible": true,
"$id": "maxItems_0_0"
}
]
},
@ -16,7 +16,8 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "maxItems_0_0"
},
{
"description": "exact length is valid",
@ -24,7 +25,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "maxItems_0_0"
},
{
"description": "too long is invalid",
@ -33,12 +35,14 @@
2,
3
],
"valid": false
"valid": false,
"schema_id": "maxItems_0_0"
},
{
"description": "ignores non-arrays",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "maxItems_0_0"
}
]
},
@ -47,9 +51,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxItems": 2.0,
"extensible": true
"maxItems": 2,
"extensible": true,
"$id": "maxItems_1_0"
}
]
},
@ -59,7 +63,8 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "maxItems_1_0"
},
{
"description": "too long is invalid",
@ -68,7 +73,8 @@
2,
3
],
"valid": false
"valid": false,
"schema_id": "maxItems_1_0"
}
]
},
@ -77,9 +83,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxItems": 2,
"extensible": true
"extensible": true,
"$id": "maxItems_2_0"
}
]
},
@ -91,7 +97,8 @@
2,
3
],
"valid": false
"valid": false,
"schema_id": "maxItems_2_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxLength": 2
"maxLength": 2,
"$id": "maxLength_0_0"
}
]
},
@ -13,27 +13,32 @@
{
"description": "shorter is valid",
"data": "f",
"valid": true
"valid": true,
"schema_id": "maxLength_0_0"
},
{
"description": "exact length is valid",
"data": "fo",
"valid": true
"valid": true,
"schema_id": "maxLength_0_0"
},
{
"description": "too long is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "maxLength_0_0"
},
{
"description": "ignores non-strings",
"data": 100,
"valid": true
"valid": true,
"schema_id": "maxLength_0_0"
},
{
"description": "two graphemes is long enough",
"data": "\uD83D\uDCA9\uD83D\uDCA9",
"valid": true
"data": "💩💩",
"valid": true,
"schema_id": "maxLength_0_0"
}
]
},
@ -42,8 +47,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxLength": 2.0
"maxLength": 2,
"$id": "maxLength_1_0"
}
]
},
@ -51,12 +56,14 @@
{
"description": "shorter is valid",
"data": "f",
"valid": true
"valid": true,
"schema_id": "maxLength_1_0"
},
{
"description": "too long is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "maxLength_1_0"
}
]
}

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxProperties": 2,
"extensible": true
"extensible": true,
"$id": "maxProperties_0_0"
}
]
},
@ -16,7 +16,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "maxProperties_0_0"
},
{
"description": "exact length is valid",
@ -24,7 +25,8 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "maxProperties_0_0"
},
{
"description": "too long is invalid",
@ -33,7 +35,8 @@
"bar": 2,
"baz": 3
},
"valid": false
"valid": false,
"schema_id": "maxProperties_0_0"
},
{
"description": "ignores arrays",
@ -42,17 +45,20 @@
2,
3
],
"valid": true
"valid": true,
"schema_id": "maxProperties_0_0"
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "maxProperties_0_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "maxProperties_0_0"
}
]
},
@ -61,9 +67,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxProperties": 2.0,
"extensible": true
"maxProperties": 2,
"extensible": true,
"$id": "maxProperties_1_0"
}
]
},
@ -73,7 +79,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "maxProperties_1_0"
},
{
"description": "too long is invalid",
@ -82,7 +89,8 @@
"bar": 2,
"baz": 3
},
"valid": false
"valid": false,
"schema_id": "maxProperties_1_0"
}
]
},
@ -91,9 +99,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxProperties": 0,
"extensible": true
"extensible": true,
"$id": "maxProperties_2_0"
}
]
},
@ -101,14 +109,16 @@
{
"description": "no properties is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "maxProperties_2_0"
},
{
"description": "one property is invalid",
"data": {
"foo": 1
},
"valid": false
"valid": false,
"schema_id": "maxProperties_2_0"
}
]
},
@ -117,9 +127,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maxProperties": 2,
"extensible": true
"extensible": true,
"$id": "maxProperties_3_0"
}
]
},
@ -131,14 +141,16 @@
"bar": 2,
"baz": 3
},
"valid": false
"valid": false,
"schema_id": "maxProperties_3_0"
},
{
"description": "extra property is valid if below maxProperties",
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "maxProperties_3_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maximum": 3.0
"maximum": 3,
"$id": "maximum_0_0"
}
]
},
@ -13,22 +13,26 @@
{
"description": "below the maximum is valid",
"data": 2.6,
"valid": true
"valid": true,
"schema_id": "maximum_0_0"
},
{
"description": "boundary point is valid",
"data": 3.0,
"valid": true
"data": 3,
"valid": true,
"schema_id": "maximum_0_0"
},
{
"description": "above the maximum is invalid",
"data": 3.5,
"valid": false
"valid": false,
"schema_id": "maximum_0_0"
},
{
"description": "ignores non-numbers",
"data": "x",
"valid": true
"valid": true,
"schema_id": "maximum_0_0"
}
]
},
@ -37,8 +41,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"maximum": 300
"maximum": 300,
"$id": "maximum_1_0"
}
]
},
@ -46,22 +50,26 @@
{
"description": "below the maximum is invalid",
"data": 299.97,
"valid": true
"valid": true,
"schema_id": "maximum_1_0"
},
{
"description": "boundary point integer is valid",
"data": 300,
"valid": true
"valid": true,
"schema_id": "maximum_1_0"
},
{
"description": "boundary point float is valid",
"data": 300.00,
"valid": true
"data": 300,
"valid": true,
"schema_id": "maximum_1_0"
},
{
"description": "above the maximum is invalid",
"data": 300.5,
"valid": false
"valid": false,
"schema_id": "maximum_1_0"
}
]
}

View File

@ -4,22 +4,21 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"base": {
"$id": "base_0",
"properties": {
"base_prop": {
"type": "string"
}
}
}
},
"$ref": "#/$defs/base",
{
"$ref": "base_0",
"properties": {
"child_prop": {
"type": "string"
}
}
},
"$id": "merge_0_0"
}
]
},
@ -30,7 +29,8 @@
"base_prop": "a",
"child_prop": "b"
},
"valid": true
"valid": true,
"schema_id": "merge_0_0"
},
{
"description": "invalid when base property has wrong type",
@ -44,7 +44,8 @@
"code": "TYPE_MISMATCH",
"path": "/base_prop"
}
]
],
"schema_id": "merge_0_0"
}
]
},
@ -53,9 +54,7 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"base": {
"$id": "base_1",
"properties": {
"a": {
"type": "string"
@ -64,9 +63,9 @@
"required": [
"a"
]
}
},
"$ref": "#/$defs/base",
{
"$ref": "base_1",
"properties": {
"b": {
"type": "string"
@ -74,7 +73,8 @@
},
"required": [
"b"
]
],
"$id": "merge_1_0"
}
]
},
@ -85,7 +85,8 @@
"a": "ok",
"b": "ok"
},
"valid": true
"valid": true,
"schema_id": "merge_1_0"
},
{
"description": "invalid when base required missing",
@ -98,7 +99,8 @@
"code": "REQUIRED_FIELD_MISSING",
"path": "/a"
}
]
],
"schema_id": "merge_1_0"
},
{
"description": "invalid when child required missing",
@ -111,7 +113,8 @@
"code": "REQUIRED_FIELD_MISSING",
"path": "/b"
}
]
],
"schema_id": "merge_1_0"
}
]
},
@ -120,9 +123,7 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"base": {
"$id": "base_2",
"properties": {
"trigger": {
"type": "string"
@ -136,9 +137,9 @@
"base_dep"
]
}
}
},
"$ref": "#/$defs/base",
{
"$ref": "base_2",
"properties": {
"child_dep": {
"type": "string"
@ -148,7 +149,8 @@
"trigger": [
"child_dep"
]
}
},
"$id": "merge_2_0"
}
]
},
@ -160,7 +162,8 @@
"base_dep": "ok",
"child_dep": "ok"
},
"valid": true
"valid": true,
"schema_id": "merge_2_0"
},
{
"description": "invalid missing base dep",
@ -174,7 +177,8 @@
"code": "DEPENDENCY_FAILED",
"path": "/base_dep"
}
]
],
"schema_id": "merge_2_0"
},
{
"description": "invalid missing child dep",
@ -188,7 +192,8 @@
"code": "DEPENDENCY_FAILED",
"path": "/child_dep"
}
]
],
"schema_id": "merge_2_0"
}
]
},
@ -197,9 +202,7 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$defs": {
"base": {
"$id": "base_3",
"properties": {
"a": {
"type": "string"
@ -212,9 +215,9 @@
"a",
"b"
]
}
},
"$ref": "#/$defs/base",
{
"$ref": "base_3",
"properties": {
"c": {
"type": "string"
@ -222,7 +225,8 @@
},
"form": [
"c"
]
],
"$id": "merge_3_0"
}
]
},
@ -235,7 +239,8 @@
"c": "ok"
},
"valid": true,
"comment": "Verifies validator handles the unmerged metadata correctly (ignores it or handles replacement)"
"comment": "Verifies validator handles the unmerged metadata correctly (ignores it or handles replacement)",
"schema_id": "merge_3_0"
}
]
}

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minContains": 1,
"extensible": true
"extensible": true,
"$id": "minContains_0_0"
}
]
},
@ -16,12 +16,14 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "minContains_0_0"
},
{
"description": "zero items still valid against lone minContains",
"data": [],
"valid": true
"valid": true,
"schema_id": "minContains_0_0"
}
]
},
@ -30,12 +32,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 1,
"extensible": true
"extensible": true,
"$id": "minContains_1_0"
}
]
},
@ -43,21 +45,24 @@
{
"description": "empty data",
"data": [],
"valid": false
"valid": false,
"schema_id": "minContains_1_0"
},
{
"description": "no elements match",
"data": [
2
],
"valid": false
"valid": false,
"schema_id": "minContains_1_0"
},
{
"description": "single element matches, valid minContains",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "minContains_1_0"
},
{
"description": "some elements match, valid minContains",
@ -65,7 +70,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "minContains_1_0"
},
{
"description": "all elements match, valid minContains",
@ -73,7 +79,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "minContains_1_0"
}
]
},
@ -82,12 +89,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 2,
"extensible": true
"extensible": true,
"$id": "minContains_2_0"
}
]
},
@ -95,14 +102,16 @@
{
"description": "empty data",
"data": [],
"valid": false
"valid": false,
"schema_id": "minContains_2_0"
},
{
"description": "all elements match, invalid minContains",
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "minContains_2_0"
},
{
"description": "some elements match, invalid minContains",
@ -110,7 +119,8 @@
1,
2
],
"valid": false
"valid": false,
"schema_id": "minContains_2_0"
},
{
"description": "all elements match, valid minContains (exactly as needed)",
@ -118,7 +128,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "minContains_2_0"
},
{
"description": "all elements match, valid minContains (more than needed)",
@ -127,7 +138,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "minContains_2_0"
},
{
"description": "some elements match, valid minContains",
@ -136,7 +148,8 @@
2,
1
],
"valid": true
"valid": true,
"schema_id": "minContains_2_0"
}
]
},
@ -145,12 +158,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 2.0,
"extensible": true
"minContains": 2,
"extensible": true,
"$id": "minContains_3_0"
}
]
},
@ -160,7 +173,8 @@
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "minContains_3_0"
},
{
"description": "both elements match, valid minContains",
@ -168,7 +182,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "minContains_3_0"
}
]
},
@ -177,13 +192,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"maxContains": 2,
"minContains": 2,
"extensible": true
"extensible": true,
"$id": "minContains_4_0"
}
]
},
@ -191,14 +206,16 @@
{
"description": "empty data",
"data": [],
"valid": false
"valid": false,
"schema_id": "minContains_4_0"
},
{
"description": "all elements match, invalid minContains",
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "minContains_4_0"
},
{
"description": "all elements match, invalid maxContains",
@ -207,7 +224,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "minContains_4_0"
},
{
"description": "all elements match, valid maxContains and minContains",
@ -215,7 +233,8 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "minContains_4_0"
}
]
},
@ -224,13 +243,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"maxContains": 1,
"minContains": 3,
"extensible": true
"extensible": true,
"$id": "minContains_5_0"
}
]
},
@ -238,14 +257,16 @@
{
"description": "empty data",
"data": [],
"valid": false
"valid": false,
"schema_id": "minContains_5_0"
},
{
"description": "invalid minContains",
"data": [
1
],
"valid": false
"valid": false,
"schema_id": "minContains_5_0"
},
{
"description": "invalid maxContains",
@ -254,7 +275,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "minContains_5_0"
},
{
"description": "invalid maxContains and minContains",
@ -262,7 +284,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "minContains_5_0"
}
]
},
@ -271,12 +294,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 0,
"extensible": true
"extensible": true,
"$id": "minContains_6_0"
}
]
},
@ -284,14 +307,16 @@
{
"description": "empty data",
"data": [],
"valid": true
"valid": true,
"schema_id": "minContains_6_0"
},
{
"description": "minContains = 0 makes contains always pass",
"data": [
2
],
"valid": true
"valid": true,
"schema_id": "minContains_6_0"
}
]
},
@ -300,13 +325,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 0,
"maxContains": 1,
"extensible": true
"extensible": true,
"$id": "minContains_7_0"
}
]
},
@ -314,14 +339,16 @@
{
"description": "empty data",
"data": [],
"valid": true
"valid": true,
"schema_id": "minContains_7_0"
},
{
"description": "not more than maxContains",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "minContains_7_0"
},
{
"description": "too many",
@ -329,7 +356,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "minContains_7_0"
}
]
},
@ -338,12 +366,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"contains": {
"const": 1
},
"minContains": 1,
"extensible": true
"extensible": true,
"$id": "minContains_8_0"
}
]
},
@ -354,7 +382,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "minContains_8_0"
}
]
}

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minItems": 1,
"extensible": true
"extensible": true,
"$id": "minItems_0_0"
}
]
},
@ -17,24 +17,28 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "minItems_0_0"
},
{
"description": "exact length is valid",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "minItems_0_0"
},
{
"description": "too short is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "minItems_0_0"
},
{
"description": "ignores non-arrays",
"data": "",
"valid": true
"valid": true,
"schema_id": "minItems_0_0"
}
]
},
@ -43,9 +47,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minItems": 1.0,
"extensible": true
"minItems": 1,
"extensible": true,
"$id": "minItems_1_0"
}
]
},
@ -56,12 +60,14 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "minItems_1_0"
},
{
"description": "too short is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "minItems_1_0"
}
]
},
@ -70,9 +76,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minItems": 1,
"extensible": true
"extensible": true,
"$id": "minItems_2_0"
}
]
},
@ -82,7 +88,8 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "minItems_2_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minLength": 2
"minLength": 2,
"$id": "minLength_0_0"
}
]
},
@ -13,27 +13,32 @@
{
"description": "longer is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "minLength_0_0"
},
{
"description": "exact length is valid",
"data": "fo",
"valid": true
"valid": true,
"schema_id": "minLength_0_0"
},
{
"description": "too short is invalid",
"data": "f",
"valid": false
"valid": false,
"schema_id": "minLength_0_0"
},
{
"description": "ignores non-strings",
"data": 1,
"valid": true
"valid": true,
"schema_id": "minLength_0_0"
},
{
"description": "one grapheme is not long enough",
"data": "\uD83D\uDCA9",
"valid": false
"data": "💩",
"valid": false,
"schema_id": "minLength_0_0"
}
]
},
@ -42,8 +47,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minLength": 2.0
"minLength": 2,
"$id": "minLength_1_0"
}
]
},
@ -51,12 +56,14 @@
{
"description": "longer is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "minLength_1_0"
},
{
"description": "too short is invalid",
"data": "f",
"valid": false
"valid": false,
"schema_id": "minLength_1_0"
}
]
}

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minProperties": 1,
"extensible": true
"extensible": true,
"$id": "minProperties_0_0"
}
]
},
@ -17,34 +17,40 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "minProperties_0_0"
},
{
"description": "exact length is valid",
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "minProperties_0_0"
},
{
"description": "too short is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "minProperties_0_0"
},
{
"description": "ignores arrays",
"data": [],
"valid": true
"valid": true,
"schema_id": "minProperties_0_0"
},
{
"description": "ignores strings",
"data": "",
"valid": true
"valid": true,
"schema_id": "minProperties_0_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "minProperties_0_0"
}
]
},
@ -53,9 +59,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minProperties": 1.0,
"extensible": true
"minProperties": 1,
"extensible": true,
"$id": "minProperties_1_0"
}
]
},
@ -66,12 +72,14 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "minProperties_1_0"
},
{
"description": "too short is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "minProperties_1_0"
}
]
},
@ -80,9 +88,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minProperties": 1,
"extensible": true
"extensible": true,
"$id": "minProperties_2_0"
}
]
},
@ -92,7 +100,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "minProperties_2_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minimum": 1.1
"minimum": 1.1,
"$id": "minimum_0_0"
}
]
},
@ -13,22 +13,26 @@
{
"description": "above the minimum is valid",
"data": 2.6,
"valid": true
"valid": true,
"schema_id": "minimum_0_0"
},
{
"description": "boundary point is valid",
"data": 1.1,
"valid": true
"valid": true,
"schema_id": "minimum_0_0"
},
{
"description": "below the minimum is invalid",
"data": 0.6,
"valid": false
"valid": false,
"schema_id": "minimum_0_0"
},
{
"description": "ignores non-numbers",
"data": "x",
"valid": true
"valid": true,
"schema_id": "minimum_0_0"
}
]
},
@ -37,8 +41,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"minimum": -2
"minimum": -2,
"$id": "minimum_1_0"
}
]
},
@ -46,37 +50,44 @@
{
"description": "negative above the minimum is valid",
"data": -1,
"valid": true
"valid": true,
"schema_id": "minimum_1_0"
},
{
"description": "positive above the minimum is valid",
"data": 0,
"valid": true
"valid": true,
"schema_id": "minimum_1_0"
},
{
"description": "boundary point is valid",
"data": -2,
"valid": true
"valid": true,
"schema_id": "minimum_1_0"
},
{
"description": "boundary point with float is valid",
"data": -2.0,
"valid": true
"data": -2,
"valid": true,
"schema_id": "minimum_1_0"
},
{
"description": "float below the minimum is invalid",
"data": -2.0001,
"valid": false
"valid": false,
"schema_id": "minimum_1_0"
},
{
"description": "int below the minimum is invalid",
"data": -3,
"valid": false
"valid": false,
"schema_id": "minimum_1_0"
},
{
"description": "ignores non-numbers",
"data": "x",
"valid": true
"valid": true,
"schema_id": "minimum_1_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"multipleOf": 2
"multipleOf": 2,
"$id": "multipleOf_0_0"
}
]
},
@ -13,17 +13,20 @@
{
"description": "int by int",
"data": 10,
"valid": true
"valid": true,
"schema_id": "multipleOf_0_0"
},
{
"description": "int by int fail",
"data": 7,
"valid": false
"valid": false,
"schema_id": "multipleOf_0_0"
},
{
"description": "ignores non-numbers",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "multipleOf_0_0"
}
]
},
@ -32,8 +35,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"multipleOf": 1.5
"multipleOf": 1.5,
"$id": "multipleOf_1_0"
}
]
},
@ -41,17 +44,20 @@
{
"description": "zero is multiple of anything",
"data": 0,
"valid": true
"valid": true,
"schema_id": "multipleOf_1_0"
},
{
"description": "4.5 is multiple of 1.5",
"data": 4.5,
"valid": true
"valid": true,
"schema_id": "multipleOf_1_0"
},
{
"description": "35 is not multiple of 1.5",
"data": 35,
"valid": false
"valid": false,
"schema_id": "multipleOf_1_0"
}
]
},
@ -60,8 +66,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"multipleOf": 0.0001
"multipleOf": 0.0001,
"$id": "multipleOf_2_0"
}
]
},
@ -69,12 +75,14 @@
{
"description": "0.0075 is multiple of 0.0001",
"data": 0.0075,
"valid": true
"valid": true,
"schema_id": "multipleOf_2_0"
},
{
"description": "0.00751 is not multiple of 0.0001",
"data": 0.00751,
"valid": false
"valid": false,
"schema_id": "multipleOf_2_0"
}
]
},
@ -83,9 +91,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "integer",
"multipleOf": 1e-8
"multipleOf": 1e-8,
"$id": "multipleOf_3_0"
}
]
},
@ -93,7 +101,8 @@
{
"description": "any integer is a multiple of 1e-8",
"data": 12391239123,
"valid": true
"valid": true,
"schema_id": "multipleOf_3_0"
}
]
}

View File

@ -4,10 +4,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {
"type": "integer"
}
},
"$id": "not_0_0"
}
]
},
@ -15,12 +15,14 @@
{
"description": "allowed",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "not_0_0"
},
{
"description": "disallowed",
"data": 1,
"valid": false
"valid": false,
"schema_id": "not_0_0"
}
]
},
@ -29,13 +31,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {
"type": [
"integer",
"boolean"
]
}
},
"$id": "not_1_0"
}
]
},
@ -43,17 +45,20 @@
{
"description": "valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "not_1_0"
},
{
"description": "mismatch",
"data": 1,
"valid": false
"valid": false,
"schema_id": "not_1_0"
},
{
"description": "other mismatch",
"data": true,
"valid": false
"valid": false,
"schema_id": "not_1_0"
}
]
},
@ -62,7 +67,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {
"type": "object",
"properties": {
@ -71,7 +75,8 @@
}
}
},
"extensible": true
"extensible": true,
"$id": "not_2_0"
}
]
},
@ -79,21 +84,24 @@
{
"description": "match",
"data": 1,
"valid": true
"valid": true,
"schema_id": "not_2_0"
},
{
"description": "other match",
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "not_2_0"
},
{
"description": "mismatch",
"data": {
"foo": "bar"
},
"valid": false
"valid": false,
"schema_id": "not_2_0"
}
]
},
@ -102,12 +110,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {
"not": {}
}
}
},
"$id": "not_3_0"
}
]
},
@ -118,12 +126,14 @@
"foo": 1,
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "not_3_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "not_3_0"
}
]
},
@ -132,8 +142,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {}
"not": {},
"$id": "not_4_0"
}
]
},
@ -141,51 +151,60 @@
{
"description": "number is invalid",
"data": 1,
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "boolean true is invalid",
"data": true,
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "boolean false is invalid",
"data": false,
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "null is invalid",
"data": null,
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "object is invalid",
"data": {
"foo": "bar"
},
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "array is invalid",
"data": [
"foo"
],
"valid": false
"valid": false,
"schema_id": "not_4_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "not_4_0"
}
]
},
@ -194,8 +213,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": true
"not": true,
"$id": "not_5_0"
}
]
},
@ -203,51 +222,60 @@
{
"description": "number is invalid",
"data": 1,
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "boolean true is invalid",
"data": true,
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "boolean false is invalid",
"data": false,
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "null is invalid",
"data": null,
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "object is invalid",
"data": {
"foo": "bar"
},
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "array is invalid",
"data": [
"foo"
],
"valid": false
"valid": false,
"schema_id": "not_5_0"
},
{
"description": "empty array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "not_5_0"
}
]
},
@ -256,9 +284,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": false,
"extensible": true
"extensible": true,
"$id": "not_6_0"
}
]
},
@ -266,51 +294,60 @@
{
"description": "number is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "string is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "boolean true is valid",
"data": true,
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "boolean false is valid",
"data": false,
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "object is valid",
"data": {
"foo": "bar"
},
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "array is valid",
"data": [
"foo"
],
"valid": true
"valid": true,
"schema_id": "not_6_0"
},
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "not_6_0"
}
]
},
@ -319,10 +356,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {
"not": {}
}
},
"$id": "not_7_0"
}
]
},
@ -330,7 +367,8 @@
{
"description": "any value is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "not_7_0"
}
]
},
@ -339,11 +377,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {
"type": "integer"
},
"extensible": true
"extensible": true,
"$id": "not_8_0"
}
]
},
@ -353,7 +391,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "not_8_0"
}
]
},
@ -362,10 +401,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"not": {
"type": "integer"
}
},
"$id": "not_9_0"
}
]
},
@ -375,7 +414,8 @@
"data": {
"foo": 1
},
"valid": false
"valid": false,
"schema_id": "not_9_0"
}
]
},
@ -384,7 +424,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"bar": {
"type": "string"
@ -393,7 +432,8 @@
"not": {
"type": "integer"
},
"extensible": true
"extensible": true,
"$id": "not_10_0"
}
]
},
@ -404,7 +444,8 @@
"bar": "baz",
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "not_10_0"
}
]
},
@ -413,7 +454,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"bar": {
"type": "string"
@ -421,7 +461,8 @@
},
"not": {
"type": "integer"
}
},
"$id": "not_11_0"
}
]
},
@ -432,14 +473,16 @@
"bar": "baz",
"foo": 1
},
"valid": false
"valid": false,
"schema_id": "not_11_0"
},
{
"description": "defined property allowed",
"data": {
"bar": "baz"
},
"valid": true
"valid": true,
"schema_id": "not_11_0"
}
]
}

View File

@ -4,7 +4,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"type": "integer"
@ -12,7 +11,8 @@
{
"minimum": 2
}
]
],
"$id": "oneOf_0_0"
}
]
},
@ -20,22 +20,26 @@
{
"description": "first oneOf valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "oneOf_0_0"
},
{
"description": "second oneOf valid",
"data": 2.5,
"valid": true
"valid": true,
"schema_id": "oneOf_0_0"
},
{
"description": "both oneOf valid",
"data": 3,
"valid": false
"valid": false,
"schema_id": "oneOf_0_0"
},
{
"description": "neither oneOf valid",
"data": 1.5,
"valid": false
"valid": false,
"schema_id": "oneOf_0_0"
}
]
},
@ -44,7 +48,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string",
"oneOf": [
{
@ -53,7 +56,8 @@
{
"maxLength": 4
}
]
],
"$id": "oneOf_1_0"
}
]
},
@ -61,17 +65,20 @@
{
"description": "mismatch base schema",
"data": 3,
"valid": false
"valid": false,
"schema_id": "oneOf_1_0"
},
{
"description": "one oneOf valid",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "oneOf_1_0"
},
{
"description": "both oneOf valid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "oneOf_1_0"
}
]
},
@ -80,12 +87,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
true,
true,
true
]
],
"$id": "oneOf_2_0"
}
]
},
@ -93,7 +100,8 @@
{
"description": "any value is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "oneOf_2_0"
}
]
},
@ -102,12 +110,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
true,
false,
false
]
],
"$id": "oneOf_3_0"
}
]
},
@ -115,7 +123,8 @@
{
"description": "any value is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "oneOf_3_0"
}
]
},
@ -124,12 +133,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
true,
true,
false
]
],
"$id": "oneOf_4_0"
}
]
},
@ -137,7 +146,8 @@
{
"description": "any value is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "oneOf_4_0"
}
]
},
@ -146,12 +156,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
false,
false,
false
]
],
"$id": "oneOf_5_0"
}
]
},
@ -159,7 +169,8 @@
{
"description": "any value is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "oneOf_5_0"
}
]
},
@ -168,332 +179,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"properties": {
"bar": {
"type": "integer"
}
},
"required": [
"bar"
]
},
{
"properties": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
]
}
]
}
]
},
"tests": [
{
"description": "first oneOf valid (complex)",
"data": {
"bar": 2
},
"valid": true
},
{
"description": "second oneOf valid (complex)",
"data": {
"foo": "baz"
},
"valid": true
},
{
"description": "both oneOf valid (complex)",
"data": {
"foo": "baz",
"bar": 2
},
"valid": false
},
{
"description": "neither oneOf valid (complex)",
"data": {
"foo": 2,
"bar": "quux"
},
"valid": false
}
]
},
{
"description": "oneOf with empty schema",
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"type": "number"
},
{}
]
}
]
},
"tests": [
{
"description": "one valid - valid",
"data": "foo",
"valid": true
},
{
"description": "both valid - invalid",
"data": 123,
"valid": false
}
]
},
{
"description": "oneOf with required",
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"foo": true,
"bar": true,
"baz": true
},
"oneOf": [
{
"required": [
"foo",
"bar"
]
},
{
"required": [
"foo",
"baz"
]
}
]
}
]
},
"tests": [
{
"description": "both invalid - invalid",
"data": {
"bar": 2
},
"valid": false
},
{
"description": "first valid - valid",
"data": {
"foo": 1,
"bar": 2
},
"valid": true
},
{
"description": "second valid - valid",
"data": {
"foo": 1,
"baz": 3
},
"valid": true
},
{
"description": "both valid - invalid",
"data": {
"foo": 1,
"bar": 2,
"baz": 3
},
"valid": false
},
{
"description": "extra property invalid (strict)",
"data": {
"foo": 1,
"bar": 2,
"extra": 3
},
"valid": false
}
]
},
{
"description": "oneOf with required (extensible)",
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"extensible": true,
"oneOf": [
{
"required": [
"foo",
"bar"
]
},
{
"required": [
"foo",
"baz"
]
}
]
}
]
},
"tests": [
{
"description": "both invalid - invalid",
"data": {
"bar": 2
},
"valid": false
},
{
"description": "first valid - valid",
"data": {
"foo": 1,
"bar": 2
},
"valid": true
},
{
"description": "second valid - valid",
"data": {
"foo": 1,
"baz": 3
},
"valid": true
},
{
"description": "both valid - invalid",
"data": {
"foo": 1,
"bar": 2,
"baz": 3
},
"valid": false
},
{
"description": "extra properties are valid (extensible)",
"data": {
"foo": 1,
"bar": 2,
"extra": "value"
},
"valid": true
}
]
},
{
"description": "oneOf with missing optional property",
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"properties": {
"bar": true,
"baz": true
},
"required": [
"bar"
]
},
{
"properties": {
"foo": true
},
"required": [
"foo"
]
}
]
}
]
},
"tests": [
{
"description": "first oneOf valid",
"data": {
"bar": 8
},
"valid": true
},
{
"description": "second oneOf valid",
"data": {
"foo": "foo"
},
"valid": true
},
{
"description": "both oneOf valid",
"data": {
"foo": "foo",
"bar": 8
},
"valid": false
},
{
"description": "neither oneOf valid",
"data": {
"baz": "quux"
},
"valid": false
}
]
},
{
"description": "nested oneOf, to check validation semantics",
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"oneOf": [
{
"type": "null"
}
]
}
]
}
]
},
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false
}
]
},
{
"description": "extensible: true allows extra properties in oneOf",
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"oneOf": [
{
"properties": {
@ -516,7 +201,355 @@
]
}
],
"extensible": true
"$id": "oneOf_6_0"
}
]
},
"tests": [
{
"description": "first oneOf valid (complex)",
"data": {
"bar": 2
},
"valid": true,
"schema_id": "oneOf_6_0"
},
{
"description": "second oneOf valid (complex)",
"data": {
"foo": "baz"
},
"valid": true,
"schema_id": "oneOf_6_0"
},
{
"description": "both oneOf valid (complex)",
"data": {
"foo": "baz",
"bar": 2
},
"valid": false,
"schema_id": "oneOf_6_0"
},
{
"description": "neither oneOf valid (complex)",
"data": {
"foo": 2,
"bar": "quux"
},
"valid": false,
"schema_id": "oneOf_6_0"
}
]
},
{
"description": "oneOf with empty schema",
"database": {
"schemas": [
{
"oneOf": [
{
"type": "number"
},
{}
],
"$id": "oneOf_7_0"
}
]
},
"tests": [
{
"description": "one valid - valid",
"data": "foo",
"valid": true,
"schema_id": "oneOf_7_0"
},
{
"description": "both valid - invalid",
"data": 123,
"valid": false,
"schema_id": "oneOf_7_0"
}
]
},
{
"description": "oneOf with required",
"database": {
"schemas": [
{
"type": "object",
"properties": {
"foo": true,
"bar": true,
"baz": true
},
"oneOf": [
{
"required": [
"foo",
"bar"
]
},
{
"required": [
"foo",
"baz"
]
}
],
"$id": "oneOf_8_0"
}
]
},
"tests": [
{
"description": "both invalid - invalid",
"data": {
"bar": 2
},
"valid": false,
"schema_id": "oneOf_8_0"
},
{
"description": "first valid - valid",
"data": {
"foo": 1,
"bar": 2
},
"valid": true,
"schema_id": "oneOf_8_0"
},
{
"description": "second valid - valid",
"data": {
"foo": 1,
"baz": 3
},
"valid": true,
"schema_id": "oneOf_8_0"
},
{
"description": "both valid - invalid",
"data": {
"foo": 1,
"bar": 2,
"baz": 3
},
"valid": false,
"schema_id": "oneOf_8_0"
},
{
"description": "extra property invalid (strict)",
"data": {
"foo": 1,
"bar": 2,
"extra": 3
},
"valid": false,
"schema_id": "oneOf_8_0"
}
]
},
{
"description": "oneOf with required (extensible)",
"database": {
"schemas": [
{
"type": "object",
"extensible": true,
"oneOf": [
{
"required": [
"foo",
"bar"
]
},
{
"required": [
"foo",
"baz"
]
}
],
"$id": "oneOf_9_0"
}
]
},
"tests": [
{
"description": "both invalid - invalid",
"data": {
"bar": 2
},
"valid": false,
"schema_id": "oneOf_9_0"
},
{
"description": "first valid - valid",
"data": {
"foo": 1,
"bar": 2
},
"valid": true,
"schema_id": "oneOf_9_0"
},
{
"description": "second valid - valid",
"data": {
"foo": 1,
"baz": 3
},
"valid": true,
"schema_id": "oneOf_9_0"
},
{
"description": "both valid - invalid",
"data": {
"foo": 1,
"bar": 2,
"baz": 3
},
"valid": false,
"schema_id": "oneOf_9_0"
},
{
"description": "extra properties are valid (extensible)",
"data": {
"foo": 1,
"bar": 2,
"extra": "value"
},
"valid": true,
"schema_id": "oneOf_9_0"
}
]
},
{
"description": "oneOf with missing optional property",
"database": {
"schemas": [
{
"oneOf": [
{
"properties": {
"bar": true,
"baz": true
},
"required": [
"bar"
]
},
{
"properties": {
"foo": true
},
"required": [
"foo"
]
}
],
"$id": "oneOf_10_0"
}
]
},
"tests": [
{
"description": "first oneOf valid",
"data": {
"bar": 8
},
"valid": true,
"schema_id": "oneOf_10_0"
},
{
"description": "second oneOf valid",
"data": {
"foo": "foo"
},
"valid": true,
"schema_id": "oneOf_10_0"
},
{
"description": "both oneOf valid",
"data": {
"foo": "foo",
"bar": 8
},
"valid": false,
"schema_id": "oneOf_10_0"
},
{
"description": "neither oneOf valid",
"data": {
"baz": "quux"
},
"valid": false,
"schema_id": "oneOf_10_0"
}
]
},
{
"description": "nested oneOf, to check validation semantics",
"database": {
"schemas": [
{
"oneOf": [
{
"oneOf": [
{
"type": "null"
}
]
}
],
"$id": "oneOf_11_0"
}
]
},
"tests": [
{
"description": "null is valid",
"data": null,
"valid": true,
"schema_id": "oneOf_11_0"
},
{
"description": "anything non-null is invalid",
"data": 123,
"valid": false,
"schema_id": "oneOf_11_0"
}
]
},
{
"description": "extensible: true allows extra properties in oneOf",
"database": {
"schemas": [
{
"oneOf": [
{
"properties": {
"bar": {
"type": "integer"
}
},
"required": [
"bar"
]
},
{
"properties": {
"foo": {
"type": "string"
}
},
"required": [
"foo"
]
}
],
"extensible": true,
"$id": "oneOf_12_0"
}
]
},
@ -527,7 +560,8 @@
"bar": 2,
"extra": "prop"
},
"valid": true
"valid": true,
"schema_id": "oneOf_12_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"pattern": "^a*$"
"pattern": "^a*$",
"$id": "pattern_0_0"
}
]
},
@ -13,42 +13,50 @@
{
"description": "a matching pattern is valid",
"data": "aaa",
"valid": true
"valid": true,
"schema_id": "pattern_0_0"
},
{
"description": "a non-matching pattern is invalid",
"data": "abc",
"valid": false
"valid": false,
"schema_id": "pattern_0_0"
},
{
"description": "ignores booleans",
"data": true,
"valid": true
"valid": true,
"schema_id": "pattern_0_0"
},
{
"description": "ignores integers",
"data": 123,
"valid": true
"valid": true,
"schema_id": "pattern_0_0"
},
{
"description": "ignores floats",
"data": 1.0,
"valid": true
"data": 1,
"valid": true,
"schema_id": "pattern_0_0"
},
{
"description": "ignores objects",
"data": {},
"valid": true
"valid": true,
"schema_id": "pattern_0_0"
},
{
"description": "ignores arrays",
"data": [],
"valid": true
"valid": true,
"schema_id": "pattern_0_0"
},
{
"description": "ignores null",
"data": null,
"valid": true
"valid": true,
"schema_id": "pattern_0_0"
}
]
},
@ -57,8 +65,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"pattern": "a+"
"pattern": "a+",
"$id": "pattern_1_0"
}
]
},
@ -66,7 +74,8 @@
{
"description": "matches a substring",
"data": "xxaayy",
"valid": true
"valid": true,
"schema_id": "pattern_1_0"
}
]
}

View File

@ -4,13 +4,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"patternProperties": {
"f.*o": {
"type": "integer"
}
},
"items": {}
"items": {},
"$id": "patternProperties_0_0"
}
]
},
@ -20,7 +20,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "patternProperties_0_0"
},
{
"description": "multiple valid matches is valid",
@ -28,7 +29,8 @@
"foo": 1,
"foooooo": 2
},
"valid": true
"valid": true,
"schema_id": "patternProperties_0_0"
},
{
"description": "a single invalid match is invalid",
@ -36,7 +38,8 @@
"foo": "bar",
"fooooo": 2
},
"valid": false
"valid": false,
"schema_id": "patternProperties_0_0"
},
{
"description": "multiple invalid matches is invalid",
@ -44,24 +47,28 @@
"foo": "bar",
"foooooo": "baz"
},
"valid": false
"valid": false,
"schema_id": "patternProperties_0_0"
},
{
"description": "ignores arrays",
"data": [
"foo"
],
"valid": true
"valid": true,
"schema_id": "patternProperties_0_0"
},
{
"description": "ignores strings",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "patternProperties_0_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "patternProperties_0_0"
},
{
"description": "extra property not matching pattern is INVALID (strict by default)",
@ -69,7 +76,8 @@
"foo": 1,
"extra": 2
},
"valid": false
"valid": false,
"schema_id": "patternProperties_0_0"
}
]
},
@ -78,7 +86,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"patternProperties": {
"a*": {
"type": "integer"
@ -86,7 +93,8 @@
"aaa*": {
"maximum": 20
}
}
},
"$id": "patternProperties_1_0"
}
]
},
@ -96,14 +104,16 @@
"data": {
"a": 21
},
"valid": true
"valid": true,
"schema_id": "patternProperties_1_0"
},
{
"description": "a simultaneous match is valid",
"data": {
"aaaa": 18
},
"valid": true
"valid": true,
"schema_id": "patternProperties_1_0"
},
{
"description": "multiple matches is valid",
@ -111,21 +121,24 @@
"a": 21,
"aaaa": 18
},
"valid": true
"valid": true,
"schema_id": "patternProperties_1_0"
},
{
"description": "an invalid due to one is invalid",
"data": {
"a": "bar"
},
"valid": false
"valid": false,
"schema_id": "patternProperties_1_0"
},
{
"description": "an invalid due to the other is invalid",
"data": {
"aaaa": 31
},
"valid": false
"valid": false,
"schema_id": "patternProperties_1_0"
},
{
"description": "an invalid due to both is invalid",
@ -133,7 +146,8 @@
"aaa": "foo",
"aaaa": 31
},
"valid": false
"valid": false,
"schema_id": "patternProperties_1_0"
}
]
},
@ -142,7 +156,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"patternProperties": {
"[0-9]{2,}": {
"type": "boolean"
@ -151,7 +164,8 @@
"type": "string"
}
},
"extensible": true
"extensible": true,
"$id": "patternProperties_2_0"
}
]
},
@ -161,28 +175,32 @@
"data": {
"answer 1": "42"
},
"valid": true
"valid": true,
"schema_id": "patternProperties_2_0"
},
{
"description": "recognized members are accounted for",
"data": {
"a31b": null
},
"valid": false
"valid": false,
"schema_id": "patternProperties_2_0"
},
{
"description": "regexes are case sensitive",
"data": {
"a_x_3": 3
},
"valid": true
"valid": true,
"schema_id": "patternProperties_2_0"
},
{
"description": "regexes are case sensitive, 2",
"data": {
"a_X_3": 3
},
"valid": false
"valid": false,
"schema_id": "patternProperties_2_0"
}
]
},
@ -191,11 +209,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"patternProperties": {
"f.*": true,
"b.*": false
}
},
"$id": "patternProperties_3_0"
}
]
},
@ -205,14 +223,16 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "patternProperties_3_0"
},
{
"description": "object with property matching schema false is invalid",
"data": {
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "patternProperties_3_0"
},
{
"description": "object with both properties is invalid",
@ -220,19 +240,22 @@
"foo": 1,
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "patternProperties_3_0"
},
{
"description": "object with a property matching both true and false is invalid",
"data": {
"foobar": 1
},
"valid": false
"valid": false,
"schema_id": "patternProperties_3_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "patternProperties_3_0"
}
]
},
@ -241,12 +264,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"patternProperties": {
"^.*bar$": {
"type": "null"
}
}
},
"$id": "patternProperties_4_0"
}
]
},
@ -256,7 +279,8 @@
"data": {
"foobar": null
},
"valid": true
"valid": true,
"schema_id": "patternProperties_4_0"
}
]
},
@ -265,13 +289,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"patternProperties": {
"f.*o": {
"type": "integer"
}
},
"extensible": true
"extensible": true,
"$id": "patternProperties_5_0"
}
]
},
@ -281,14 +305,16 @@
"data": {
"bar": 1
},
"valid": true
"valid": true,
"schema_id": "patternProperties_5_0"
},
{
"description": "property matching pattern MUST still be valid",
"data": {
"foo": "invalid string"
},
"valid": false
"valid": false,
"schema_id": "patternProperties_5_0"
}
]
}

View File

@ -4,7 +4,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "integer"
@ -12,7 +11,8 @@
{
"type": "string"
}
]
],
"$id": "prefixItems_0_0"
}
]
},
@ -23,7 +23,8 @@
1,
"foo"
],
"valid": true
"valid": true,
"schema_id": "prefixItems_0_0"
},
{
"description": "wrong types",
@ -31,14 +32,16 @@
"foo",
1
],
"valid": false
"valid": false,
"schema_id": "prefixItems_0_0"
},
{
"description": "incomplete array of items",
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "prefixItems_0_0"
},
{
"description": "array with additional items (invalid due to strictness)",
@ -47,12 +50,14 @@
"foo",
true
],
"valid": false
"valid": false,
"schema_id": "prefixItems_0_0"
},
{
"description": "empty array",
"data": [],
"valid": true
"valid": true,
"schema_id": "prefixItems_0_0"
},
{
"description": "JavaScript pseudo-array is valid (invalid due to strict object validation)",
@ -61,7 +66,8 @@
"1": "valid",
"length": 2
},
"valid": false
"valid": false,
"schema_id": "prefixItems_0_0"
}
]
},
@ -70,11 +76,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
true,
false
]
],
"$id": "prefixItems_1_0"
}
]
},
@ -84,7 +90,8 @@
"data": [
1
],
"valid": true
"valid": true,
"schema_id": "prefixItems_1_0"
},
{
"description": "array with two items is invalid",
@ -92,12 +99,14 @@
1,
"foo"
],
"valid": false
"valid": false,
"schema_id": "prefixItems_1_0"
},
{
"description": "empty array is valid",
"data": [],
"valid": true
"valid": true,
"schema_id": "prefixItems_1_0"
}
]
},
@ -106,13 +115,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "integer"
}
],
"extensible": true
"extensible": true,
"$id": "prefixItems_2_0"
}
]
},
@ -124,7 +133,8 @@
"foo",
false
],
"valid": true
"valid": true,
"schema_id": "prefixItems_2_0"
}
]
},
@ -133,12 +143,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "null"
}
]
],
"$id": "prefixItems_3_0"
}
]
},
@ -148,7 +158,8 @@
"data": [
null
],
"valid": true
"valid": true,
"schema_id": "prefixItems_3_0"
}
]
},
@ -157,13 +168,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "integer"
}
],
"extensible": true
"extensible": true,
"$id": "prefixItems_4_0"
}
]
},
@ -174,7 +185,8 @@
1,
"foo"
],
"valid": true
"valid": true,
"schema_id": "prefixItems_4_0"
}
]
}

View File

@ -4,7 +4,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {
"type": "integer"
@ -12,7 +11,8 @@
"bar": {
"type": "string"
}
}
},
"$id": "properties_0_0"
}
]
},
@ -23,7 +23,8 @@
"foo": 1,
"bar": "baz"
},
"valid": true
"valid": true,
"schema_id": "properties_0_0"
},
{
"description": "one property invalid is invalid",
@ -31,7 +32,8 @@
"foo": 1,
"bar": {}
},
"valid": false
"valid": false,
"schema_id": "properties_0_0"
},
{
"description": "both properties invalid is invalid",
@ -39,22 +41,26 @@
"foo": [],
"bar": {}
},
"valid": false
"valid": false,
"schema_id": "properties_0_0"
},
{
"description": "doesn't invalidate other properties",
"data": {},
"valid": true
"valid": true,
"schema_id": "properties_0_0"
},
{
"description": "ignores arrays",
"data": [],
"valid": true
"valid": true,
"schema_id": "properties_0_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "properties_0_0"
}
]
},
@ -63,11 +69,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": true,
"bar": false
}
},
"$id": "properties_1_0"
}
]
},
@ -75,21 +81,24 @@
{
"description": "no property present is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "properties_1_0"
},
{
"description": "only 'true' property present is valid",
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "properties_1_0"
},
{
"description": "only 'false' property present is invalid",
"data": {
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "properties_1_0"
},
{
"description": "both properties present is invalid",
@ -97,7 +106,8 @@
"foo": 1,
"bar": 2
},
"valid": false
"valid": false,
"schema_id": "properties_1_0"
}
]
},
@ -106,7 +116,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo\nbar": {
"type": "number"
@ -126,7 +135,8 @@
"foo\fbar": {
"type": "number"
}
}
},
"$id": "properties_2_0"
}
]
},
@ -141,7 +151,8 @@
"foo\tbar": 1,
"foo\fbar": 1
},
"valid": true
"valid": true,
"schema_id": "properties_2_0"
},
{
"description": "object with strings is invalid",
@ -153,7 +164,8 @@
"foo\tbar": "1",
"foo\fbar": "1"
},
"valid": false
"valid": false,
"schema_id": "properties_2_0"
}
]
},
@ -162,12 +174,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {
"type": "null"
}
}
},
"$id": "properties_3_0"
}
]
},
@ -177,7 +189,8 @@
"data": {
"foo": null
},
"valid": true
"valid": true,
"schema_id": "properties_3_0"
}
]
},
@ -187,7 +200,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"__proto__": {
"type": "number"
@ -202,7 +214,8 @@
"constructor": {
"type": "number"
}
}
},
"$id": "properties_4_0"
}
]
},
@ -210,24 +223,28 @@
{
"description": "ignores arrays",
"data": [],
"valid": true
"valid": true,
"schema_id": "properties_4_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "properties_4_0"
},
{
"description": "none of the properties mentioned",
"data": {},
"valid": true
"valid": true,
"schema_id": "properties_4_0"
},
{
"description": "__proto__ not valid",
"data": {
"__proto__": "foo"
},
"valid": false
"valid": false,
"schema_id": "properties_4_0"
},
{
"description": "toString not valid",
@ -236,7 +253,8 @@
"length": 37
}
},
"valid": false
"valid": false,
"schema_id": "properties_4_0"
},
{
"description": "constructor not valid",
@ -245,7 +263,8 @@
"length": 37
}
},
"valid": false
"valid": false,
"schema_id": "properties_4_0"
},
{
"description": "all present and valid",
@ -256,7 +275,8 @@
},
"constructor": 37
},
"valid": true
"valid": true,
"schema_id": "properties_4_0"
}
]
},
@ -265,13 +285,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {
"type": "integer"
}
},
"extensible": true
"extensible": true,
"$id": "properties_5_0"
}
]
},
@ -282,7 +302,8 @@
"foo": 1,
"bar": "baz"
},
"valid": true
"valid": true,
"schema_id": "properties_5_0"
}
]
},
@ -291,12 +312,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {
"type": "string"
}
}
},
"$id": "properties_6_0"
}
]
},
@ -307,7 +328,8 @@
"foo": "bar",
"extra": 1
},
"valid": false
"valid": false,
"schema_id": "properties_6_0"
}
]
},
@ -316,7 +338,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"nested": {
"properties": {
@ -325,7 +346,8 @@
}
}
}
}
},
"$id": "properties_7_0"
}
]
},
@ -338,7 +360,8 @@
"extra": 1
}
},
"valid": false
"valid": false,
"schema_id": "properties_7_0"
}
]
},
@ -347,7 +370,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"nested": {
"extensible": true,
@ -357,7 +379,8 @@
}
}
}
}
},
"$id": "properties_8_0"
}
]
},
@ -370,7 +393,8 @@
"extra": 1
}
},
"valid": true
"valid": true,
"schema_id": "properties_8_0"
}
]
},
@ -379,7 +403,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"extensible": true,
"properties": {
"nested": {
@ -389,7 +412,8 @@
}
}
}
}
},
"$id": "properties_9_0"
}
]
},
@ -402,7 +426,8 @@
"extra": 1
}
},
"valid": true
"valid": true,
"schema_id": "properties_9_0"
}
]
},
@ -411,7 +436,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"extensible": true,
"properties": {
"nested": {
@ -422,7 +446,8 @@
}
}
}
}
},
"$id": "properties_10_0"
}
]
},
@ -435,7 +460,8 @@
"extra": 1
}
},
"valid": false
"valid": false,
"schema_id": "properties_10_0"
}
]
},
@ -444,7 +470,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"list": {
"type": "array",
@ -456,7 +481,8 @@
}
}
}
}
},
"$id": "properties_11_0"
}
]
},
@ -471,7 +497,8 @@
}
]
},
"valid": false
"valid": false,
"schema_id": "properties_11_0"
}
]
},
@ -480,7 +507,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"extensible": true,
"properties": {
"list": {
@ -493,7 +519,8 @@
}
}
}
}
},
"$id": "properties_12_0"
}
]
},
@ -508,7 +535,8 @@
}
]
},
"valid": true
"valid": true,
"schema_id": "properties_12_0"
}
]
}

View File

@ -4,11 +4,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": {
"maxLength": 3
},
"extensible": true
"extensible": true,
"$id": "propertyNames_0_0"
}
]
},
@ -19,7 +19,8 @@
"f": {},
"foo": {}
},
"valid": true
"valid": true,
"schema_id": "propertyNames_0_0"
},
{
"description": "some property names invalid",
@ -27,12 +28,14 @@
"foo": {},
"foobar": {}
},
"valid": false
"valid": false,
"schema_id": "propertyNames_0_0"
},
{
"description": "object without properties is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "propertyNames_0_0"
},
{
"description": "ignores arrays",
@ -42,17 +45,20 @@
3,
4
],
"valid": true
"valid": true,
"schema_id": "propertyNames_0_0"
},
{
"description": "ignores strings",
"data": "foobar",
"valid": true
"valid": true,
"schema_id": "propertyNames_0_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "propertyNames_0_0"
}
]
},
@ -61,11 +67,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": {
"pattern": "^a+$"
},
"extensible": true
"extensible": true,
"$id": "propertyNames_1_0"
}
]
},
@ -77,19 +83,22 @@
"aa": {},
"aaa": {}
},
"valid": true
"valid": true,
"schema_id": "propertyNames_1_0"
},
{
"description": "non-matching property name is invalid",
"data": {
"aaA": {}
},
"valid": false
"valid": false,
"schema_id": "propertyNames_1_0"
},
{
"description": "object without properties is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "propertyNames_1_0"
}
]
},
@ -98,9 +107,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": true,
"extensible": true
"extensible": true,
"$id": "propertyNames_2_0"
}
]
},
@ -110,12 +119,14 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "propertyNames_2_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "propertyNames_2_0"
}
]
},
@ -124,9 +135,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": false,
"extensible": true
"extensible": true,
"$id": "propertyNames_3_0"
}
]
},
@ -136,12 +147,14 @@
"data": {
"foo": 1
},
"valid": false
"valid": false,
"schema_id": "propertyNames_3_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "propertyNames_3_0"
}
]
},
@ -150,11 +163,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": {
"const": "foo"
},
"extensible": true
"extensible": true,
"$id": "propertyNames_4_0"
}
]
},
@ -164,19 +177,22 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "propertyNames_4_0"
},
{
"description": "object with any other property is invalid",
"data": {
"bar": 1
},
"valid": false
"valid": false,
"schema_id": "propertyNames_4_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "propertyNames_4_0"
}
]
},
@ -185,14 +201,14 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": {
"enum": [
"foo",
"bar"
]
},
"extensible": true
"extensible": true,
"$id": "propertyNames_5_0"
}
]
},
@ -202,7 +218,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "propertyNames_5_0"
},
{
"description": "object with property foo and bar is valid",
@ -210,19 +227,22 @@
"foo": 1,
"bar": 1
},
"valid": true
"valid": true,
"schema_id": "propertyNames_5_0"
},
{
"description": "object with any other property is invalid",
"data": {
"baz": 1
},
"valid": false
"valid": false,
"schema_id": "propertyNames_5_0"
},
{
"description": "empty object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "propertyNames_5_0"
}
]
},
@ -231,11 +251,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"propertyNames": {
"maxLength": 3
},
"extensible": true
"extensible": true,
"$id": "propertyNames_6_0"
}
]
},
@ -245,14 +265,16 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "propertyNames_6_0"
},
{
"description": "extra property with invalid name is invalid",
"data": {
"foobar": 1
},
"valid": false
"valid": false,
"schema_id": "propertyNames_6_0"
}
]
}

1739
tests/fixtures/ref.json vendored

File diff suppressed because it is too large Load Diff

View File

@ -4,14 +4,14 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {},
"bar": {}
},
"required": [
"foo"
]
],
"$id": "required_0_0"
}
]
},
@ -21,39 +21,46 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "required_0_0"
},
{
"description": "non-present required property is invalid",
"data": {
"bar": 1
},
"valid": false
"valid": false,
"schema_id": "required_0_0"
},
{
"description": "ignores arrays",
"data": [],
"valid": true
"valid": true,
"schema_id": "required_0_0"
},
{
"description": "ignores strings",
"data": "",
"valid": true
"valid": true,
"schema_id": "required_0_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "required_0_0"
},
{
"description": "ignores null",
"data": null,
"valid": true
"valid": true,
"schema_id": "required_0_0"
},
{
"description": "ignores boolean",
"data": true,
"valid": true
"valid": true,
"schema_id": "required_0_0"
}
]
},
@ -62,10 +69,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {}
}
},
"$id": "required_1_0"
}
]
},
@ -73,7 +80,8 @@
{
"description": "not required by default",
"data": {},
"valid": true
"valid": true,
"schema_id": "required_1_0"
}
]
},
@ -82,11 +90,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"foo": {}
},
"required": []
"required": [],
"$id": "required_2_0"
}
]
},
@ -94,7 +102,8 @@
{
"description": "property not required",
"data": {},
"valid": true
"valid": true,
"schema_id": "required_2_0"
}
]
},
@ -103,7 +112,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"foo\nbar",
"foo\"bar",
@ -112,7 +120,8 @@
"foo\tbar",
"foo\fbar"
],
"extensible": true
"extensible": true,
"$id": "required_3_0"
}
]
},
@ -127,7 +136,8 @@
"foo\tbar": 1,
"foo\fbar": 1
},
"valid": true
"valid": true,
"schema_id": "required_3_0"
},
{
"description": "object with some properties missing is invalid",
@ -135,7 +145,8 @@
"foo\nbar": "1",
"foo\"bar": "1"
},
"valid": false
"valid": false,
"schema_id": "required_3_0"
}
]
},
@ -145,13 +156,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"__proto__",
"toString",
"constructor"
],
"extensible": true
"extensible": true,
"$id": "required_4_0"
}
]
},
@ -159,24 +170,28 @@
{
"description": "ignores arrays",
"data": [],
"valid": true
"valid": true,
"schema_id": "required_4_0"
},
{
"description": "ignores other non-objects",
"data": 12,
"valid": true
"valid": true,
"schema_id": "required_4_0"
},
{
"description": "none of the properties mentioned",
"data": {},
"valid": false
"valid": false,
"schema_id": "required_4_0"
},
{
"description": "__proto__ present",
"data": {
"__proto__": "foo"
},
"valid": false
"valid": false,
"schema_id": "required_4_0"
},
{
"description": "toString present",
@ -185,7 +200,8 @@
"length": 37
}
},
"valid": false
"valid": false,
"schema_id": "required_4_0"
},
{
"description": "constructor present",
@ -194,7 +210,8 @@
"length": 37
}
},
"valid": false
"valid": false,
"schema_id": "required_4_0"
},
{
"description": "all present",
@ -205,7 +222,8 @@
},
"constructor": 37
},
"valid": true
"valid": true,
"schema_id": "required_4_0"
}
]
},
@ -214,11 +232,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"required": [
"foo"
],
"extensible": true
"extensible": true,
"$id": "required_5_0"
}
]
},
@ -229,7 +247,8 @@
"foo": 1,
"bar": 2
},
"valid": true
"valid": true,
"schema_id": "required_5_0"
}
]
}

View File

@ -4,8 +4,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "integer"
"type": "integer",
"$id": "type_0_0"
}
]
},
@ -13,47 +13,56 @@
{
"description": "an integer is an integer",
"data": 1,
"valid": true
"valid": true,
"schema_id": "type_0_0"
},
{
"description": "a float with zero fractional part is an integer",
"data": 1.0,
"valid": true
"data": 1,
"valid": true,
"schema_id": "type_0_0"
},
{
"description": "a float is not an integer",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_0_0"
},
{
"description": "a string is not an integer",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_0_0"
},
{
"description": "a string is still not an integer, even if it looks like one",
"data": "1",
"valid": false
"valid": false,
"schema_id": "type_0_0"
},
{
"description": "an object is not an integer",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_0_0"
},
{
"description": "an array is not an integer",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_0_0"
},
{
"description": "a boolean is not an integer",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_0_0"
},
{
"description": "null is not an integer",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_0_0"
}
]
},
@ -62,8 +71,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "number"
"type": "number",
"$id": "type_1_0"
}
]
},
@ -71,47 +80,56 @@
{
"description": "an integer is a number",
"data": 1,
"valid": true
"valid": true,
"schema_id": "type_1_0"
},
{
"description": "a float with zero fractional part is a number (and an integer)",
"data": 1.0,
"valid": true
"data": 1,
"valid": true,
"schema_id": "type_1_0"
},
{
"description": "a float is a number",
"data": 1.1,
"valid": true
"valid": true,
"schema_id": "type_1_0"
},
{
"description": "a string is not a number",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_1_0"
},
{
"description": "a string is still not a number, even if it looks like one",
"data": "1",
"valid": false
"valid": false,
"schema_id": "type_1_0"
},
{
"description": "an object is not a number",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_1_0"
},
{
"description": "an array is not a number",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_1_0"
},
{
"description": "a boolean is not a number",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_1_0"
},
{
"description": "null is not a number",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_1_0"
}
]
},
@ -120,8 +138,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "string"
"type": "string",
"$id": "type_2_0"
}
]
},
@ -129,47 +147,56 @@
{
"description": "1 is not a string",
"data": 1,
"valid": false
"valid": false,
"schema_id": "type_2_0"
},
{
"description": "a float is not a string",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_2_0"
},
{
"description": "a string is a string",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "type_2_0"
},
{
"description": "a string is still a string, even if it looks like a number",
"data": "1",
"valid": true
"valid": true,
"schema_id": "type_2_0"
},
{
"description": "an empty string is still a string",
"data": "",
"valid": true
"valid": true,
"schema_id": "type_2_0"
},
{
"description": "an object is not a string",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_2_0"
},
{
"description": "an array is not a string",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_2_0"
},
{
"description": "a boolean is not a string",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_2_0"
},
{
"description": "null is not a string",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_2_0"
}
]
},
@ -178,8 +205,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object"
"type": "object",
"$id": "type_3_0"
}
]
},
@ -187,37 +214,44 @@
{
"description": "an integer is not an object",
"data": 1,
"valid": false
"valid": false,
"schema_id": "type_3_0"
},
{
"description": "a float is not an object",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_3_0"
},
{
"description": "a string is not an object",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_3_0"
},
{
"description": "an object is an object",
"data": {},
"valid": true
"valid": true,
"schema_id": "type_3_0"
},
{
"description": "an array is not an object",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_3_0"
},
{
"description": "a boolean is not an object",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_3_0"
},
{
"description": "null is not an object",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_3_0"
}
]
},
@ -226,8 +260,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "array"
"type": "array",
"$id": "type_4_0"
}
]
},
@ -235,37 +269,44 @@
{
"description": "an integer is not an array",
"data": 1,
"valid": false
"valid": false,
"schema_id": "type_4_0"
},
{
"description": "a float is not an array",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_4_0"
},
{
"description": "a string is not an array",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_4_0"
},
{
"description": "an object is not an array",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_4_0"
},
{
"description": "an array is an array",
"data": [],
"valid": true
"valid": true,
"schema_id": "type_4_0"
},
{
"description": "a boolean is not an array",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_4_0"
},
{
"description": "null is not an array",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_4_0"
}
]
},
@ -274,8 +315,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "boolean"
"type": "boolean",
"$id": "type_5_0"
}
]
},
@ -283,52 +324,62 @@
{
"description": "an integer is not a boolean",
"data": 1,
"valid": false
"valid": false,
"schema_id": "type_5_0"
},
{
"description": "zero is not a boolean",
"data": 0,
"valid": false
"valid": false,
"schema_id": "type_5_0"
},
{
"description": "a float is not a boolean",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_5_0"
},
{
"description": "a string is not a boolean",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_5_0"
},
{
"description": "an empty string is a null",
"data": "",
"valid": true
"valid": true,
"schema_id": "type_5_0"
},
{
"description": "an object is not a boolean",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_5_0"
},
{
"description": "an array is not a boolean",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_5_0"
},
{
"description": "true is a boolean",
"data": true,
"valid": true
"valid": true,
"schema_id": "type_5_0"
},
{
"description": "false is a boolean",
"data": false,
"valid": true
"valid": true,
"schema_id": "type_5_0"
},
{
"description": "null is not a boolean",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_5_0"
}
]
},
@ -337,8 +388,8 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "null"
"type": "null",
"$id": "type_6_0"
}
]
},
@ -346,52 +397,62 @@
{
"description": "an integer is not null",
"data": 1,
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "a float is not null",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "zero is not null",
"data": 0,
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "a string is not null",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "an empty string is null",
"data": "",
"valid": true
"valid": true,
"schema_id": "type_6_0"
},
{
"description": "an object is not null",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "an array is not null",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "true is not null",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "false is not null",
"data": false,
"valid": false
"valid": false,
"schema_id": "type_6_0"
},
{
"description": "null is null",
"data": null,
"valid": true
"valid": true,
"schema_id": "type_6_0"
}
]
},
@ -400,11 +461,11 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": [
"integer",
"string"
]
],
"$id": "type_7_0"
}
]
},
@ -412,37 +473,44 @@
{
"description": "an integer is valid",
"data": 1,
"valid": true
"valid": true,
"schema_id": "type_7_0"
},
{
"description": "a string is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "type_7_0"
},
{
"description": "a float is invalid",
"data": 1.1,
"valid": false
"valid": false,
"schema_id": "type_7_0"
},
{
"description": "an object is invalid",
"data": {},
"valid": false
"valid": false,
"schema_id": "type_7_0"
},
{
"description": "an array is invalid",
"data": [],
"valid": false
"valid": false,
"schema_id": "type_7_0"
},
{
"description": "a boolean is invalid",
"data": true,
"valid": false
"valid": false,
"schema_id": "type_7_0"
},
{
"description": "null is invalid",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_7_0"
}
]
},
@ -451,10 +519,10 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": [
"string"
]
],
"$id": "type_8_0"
}
]
},
@ -462,12 +530,14 @@
{
"description": "string is valid",
"data": "foo",
"valid": true
"valid": true,
"schema_id": "type_8_0"
},
{
"description": "number is invalid",
"data": 123,
"valid": false
"valid": false,
"schema_id": "type_8_0"
}
]
},
@ -476,12 +546,12 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": [
"array",
"object"
],
"items": {}
"items": {},
"$id": "type_9_0"
}
]
},
@ -493,27 +563,32 @@
2,
3
],
"valid": true
"valid": true,
"schema_id": "type_9_0"
},
{
"description": "object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "type_9_0"
},
{
"description": "number is invalid",
"data": 123,
"valid": false
"valid": false,
"schema_id": "type_9_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_9_0"
},
{
"description": "null is invalid",
"data": null,
"valid": false
"valid": false,
"schema_id": "type_9_0"
}
]
},
@ -522,13 +597,13 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": [
"array",
"object",
"null"
],
"items": {}
"items": {},
"$id": "type_10_0"
}
]
},
@ -540,27 +615,32 @@
2,
3
],
"valid": true
"valid": true,
"schema_id": "type_10_0"
},
{
"description": "object is valid",
"data": {},
"valid": true
"valid": true,
"schema_id": "type_10_0"
},
{
"description": "null is valid",
"data": null,
"valid": true
"valid": true,
"schema_id": "type_10_0"
},
{
"description": "number is invalid",
"data": 123,
"valid": false
"valid": false,
"schema_id": "type_10_0"
},
{
"description": "string is invalid",
"data": "foo",
"valid": false
"valid": false,
"schema_id": "type_10_0"
}
]
},
@ -569,9 +649,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"extensible": true
"extensible": true,
"$id": "type_11_0"
}
]
},
@ -581,7 +661,8 @@
"data": {
"foo": 1
},
"valid": true
"valid": true,
"schema_id": "type_11_0"
}
]
}

View File

@ -1,343 +0,0 @@
[
{
"description": "Entities extending entities",
"database": {
"types": [
{
"name": "entity",
"hierarchy": [
"entity"
],
"schemas": [
{
"$id": "entity",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string",
"const": "entity"
}
}
}
]
},
{
"name": "organization",
"hierarchy": [
"entity",
"organization"
],
"schemas": [
{
"$id": "organization",
"$ref": "entity",
"properties": {
"name": {
"type": "string"
}
}
}
]
},
{
"name": "person",
"hierarchy": [
"entity",
"organization",
"person"
],
"schemas": [
{
"$id": "person",
"$ref": "organization",
"properties": {
"first_name": {
"type": "string"
}
}
}
]
}
],
"puncs": [
{
"name": "save_org",
"schemas": [
{
"$id": "save_org.request",
"$ref": "organization"
}
]
}
]
},
"tests": [
{
"description": "Valid person against organization schema (implicit type allowance)",
"schema_id": "save_org.request",
"data": {
"id": "1",
"type": "person",
"name": "ACME"
},
"valid": true
},
{
"description": "Valid organization against organization schema",
"schema_id": "save_org.request",
"data": {
"id": "2",
"type": "organization",
"name": "ACME"
},
"valid": true
},
{
"description": "Invalid entity against organization schema (ancestor not allowed)",
"schema_id": "save_org.request",
"data": {
"id": "3",
"type": "entity"
},
"valid": false
},
{
"description": "Invalid generic type against organization schema",
"schema_id": "save_org.request",
"data": {
"id": "4",
"type": "generic_thing"
},
"valid": false
}
]
},
{
"description": "Ad-hocs extending entities (still entities with type magic)",
"database": {
"types": [
{
"name": "entity",
"hierarchy": [
"entity"
],
"schemas": [
{
"$id": "entity",
"type": "object",
"properties": {
"id": {
"type": "string"
},
"type": {
"type": "string",
"const": "entity"
}
}
}
]
},
{
"name": "person",
"hierarchy": [
"entity",
"person"
],
"schemas": [
{
"$id": "person",
"$ref": "entity",
"properties": {
"first_name": {
"type": "string"
}
}
}
]
}
],
"puncs": [
{
"name": "save_person_light",
"schemas": [
{
"$id": "person.light",
"$ref": "person",
"extensible": false,
"properties": {
"first_name": {
"type": "string"
}
}
},
{
"$id": "save_person_light.request",
"$ref": "person.light"
}
]
}
]
},
"tests": [
{
"description": "Valid person against person.light ad-hoc schema",
"schema_id": "save_person_light.request",
"data": {
"id": "1",
"type": "person",
"first_name": "John"
},
"valid": true
},
{
"description": "Invalid person against person.light (strictness violation)",
"schema_id": "save_person_light.request",
"data": {
"id": "1",
"type": "person",
"first_name": "John",
"extra": "bad"
},
"valid": false
},
{
"description": "Invalid entity against person.light ad-hoc schema (ancestor not allowed)",
"schema_id": "save_person_light.request",
"data": {
"id": "1",
"type": "entity",
"first_name": "John"
},
"valid": false
}
]
},
{
"description": "Ad-hocs extending ad-hocs (No type property)",
"database": {
"puncs": [
{
"name": "save_address",
"schemas": [
{
"$id": "address",
"type": "object",
"properties": {
"street": {
"type": "string"
},
"city": {
"type": "string"
}
}
},
{
"$id": "us_address",
"$ref": "address",
"properties": {
"state": {
"type": "string"
},
"zip": {
"type": "string"
}
}
},
{
"$id": "save_address.request",
"$ref": "us_address"
}
]
}
]
},
"tests": [
{
"description": "Valid us_address",
"schema_id": "save_address.request",
"data": {
"street": "123 Main",
"city": "Anytown",
"state": "CA",
"zip": "12345"
},
"valid": true
},
{
"description": "Invalid base address against us_address",
"schema_id": "save_address.request",
"data": {
"street": "123 Main",
"city": "Anytown"
},
"valid": true
}
]
},
{
"description": "Ad-hocs extending ad-hocs (with string type property, no magic)",
"database": {
"puncs": [
{
"name": "save_config",
"schemas": [
{
"$id": "config_base",
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "config_base"
},
"setting": {
"type": "string"
}
}
},
{
"$id": "config_advanced",
"$ref": "config_base",
"properties": {
"type": {
"type": "string",
"const": "config_advanced"
},
"advanced_setting": {
"type": "string"
}
}
},
{
"$id": "save_config.request",
"$ref": "config_base"
}
]
}
]
},
"tests": [
{
"description": "Valid config_base against config_base",
"schema_id": "save_config.request",
"data": {
"type": "config_base",
"setting": "on"
},
"valid": true
},
{
"description": "Invalid config_advanced against config_base (no type magic, const is strictly 'config_base')",
"schema_id": "save_config.request",
"data": {
"type": "config_advanced",
"setting": "on",
"advanced_setting": "off"
},
"valid": false
}
]
}
]

View File

@ -4,9 +4,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"uniqueItems": true,
"extensible": true
"extensible": true,
"$id": "uniqueItems_0_0"
}
]
},
@ -17,7 +17,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of integers is invalid",
@ -25,7 +26,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of more than two integers is invalid",
@ -34,16 +36,18 @@
2,
1
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "numbers are unique if mathematically unequal",
"data": [
1.0,
1.00,
1,
1,
1
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "false is not equal to zero",
@ -51,7 +55,8 @@
0,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "true is not equal to one",
@ -59,7 +64,8 @@
1,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "unique array of strings is valid",
@ -68,7 +74,8 @@
"bar",
"baz"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of strings is invalid",
@ -77,7 +84,8 @@
"bar",
"foo"
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "unique array of objects is valid",
@ -89,7 +97,8 @@
"foo": "baz"
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of objects is invalid",
@ -101,7 +110,8 @@
"foo": "bar"
}
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "property order of array of objects is ignored",
@ -115,7 +125,8 @@
"foo": "bar"
}
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "unique array of nested objects is valid",
@ -135,7 +146,8 @@
}
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of nested objects is invalid",
@ -155,7 +167,8 @@
}
}
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "unique array of arrays is valid",
@ -167,7 +180,8 @@
"bar"
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of arrays is invalid",
@ -179,7 +193,8 @@
"foo"
]
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique array of more than two arrays is invalid",
@ -194,7 +209,8 @@
"foo"
]
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "1 and true are unique",
@ -202,7 +218,8 @@
1,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "0 and false are unique",
@ -210,7 +227,8 @@
0,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "[1] and [true] are unique",
@ -222,7 +240,8 @@
true
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "[0] and [false] are unique",
@ -234,7 +253,8 @@
false
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "nested [1] and [true] are unique",
@ -252,7 +272,8 @@
"foo"
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "nested [0] and [false] are unique",
@ -270,7 +291,8 @@
"foo"
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "unique heterogeneous types are valid",
@ -284,7 +306,8 @@
1,
"{}"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "non-unique heterogeneous types are invalid",
@ -298,7 +321,8 @@
{},
1
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "different objects are unique",
@ -312,7 +336,8 @@
"b": 1
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "objects are non-unique despite key order",
@ -326,7 +351,8 @@
"a": 1
}
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_0_0"
},
{
"description": "{\"a\": false} and {\"a\": 0} are unique",
@ -338,7 +364,8 @@
"a": 0
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
},
{
"description": "{\"a\": true} and {\"a\": 1} are unique",
@ -350,7 +377,8 @@
"a": 1
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_0_0"
}
]
},
@ -359,7 +387,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "boolean"
@ -369,7 +396,8 @@
}
],
"uniqueItems": true,
"extensible": true
"extensible": true,
"$id": "uniqueItems_1_0"
}
]
},
@ -380,7 +408,8 @@
false,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_1_0"
},
{
"description": "[true, false] from items array is valid",
@ -388,7 +417,8 @@
true,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_1_0"
},
{
"description": "[false, false] from items array is not valid",
@ -396,7 +426,8 @@
false,
false
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_1_0"
},
{
"description": "[true, true] from items array is not valid",
@ -404,7 +435,8 @@
true,
true
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_1_0"
},
{
"description": "unique array extended from [false, true] is valid",
@ -414,7 +446,8 @@
"foo",
"bar"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_1_0"
},
{
"description": "unique array extended from [true, false] is valid",
@ -424,7 +457,8 @@
"foo",
"bar"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_1_0"
},
{
"description": "non-unique array extended from [false, true] is not valid",
@ -434,7 +468,8 @@
"foo",
"foo"
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_1_0"
},
{
"description": "non-unique array extended from [true, false] is not valid",
@ -444,7 +479,8 @@
"foo",
"foo"
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_1_0"
}
]
},
@ -453,7 +489,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "boolean"
@ -463,7 +498,8 @@
}
],
"uniqueItems": true,
"items": false
"items": false,
"$id": "uniqueItems_2_0"
}
]
},
@ -474,7 +510,8 @@
false,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_2_0"
},
{
"description": "[true, false] from items array is valid",
@ -482,7 +519,8 @@
true,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_2_0"
},
{
"description": "[false, false] from items array is not valid",
@ -490,7 +528,8 @@
false,
false
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_2_0"
},
{
"description": "[true, true] from items array is not valid",
@ -498,7 +537,8 @@
true,
true
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_2_0"
},
{
"description": "extra items are invalid even if unique",
@ -507,7 +547,8 @@
true,
null
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_2_0"
}
]
},
@ -516,9 +557,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"uniqueItems": false,
"extensible": true
"extensible": true,
"$id": "uniqueItems_3_0"
}
]
},
@ -529,7 +570,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "non-unique array of integers is valid",
@ -537,16 +579,18 @@
1,
1
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "numbers are unique if mathematically unequal",
"data": [
1.0,
1.00,
1,
1,
1
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "false is not equal to zero",
@ -554,7 +598,8 @@
0,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "true is not equal to one",
@ -562,7 +607,8 @@
1,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "unique array of objects is valid",
@ -574,7 +620,8 @@
"foo": "baz"
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "non-unique array of objects is valid",
@ -586,7 +633,8 @@
"foo": "bar"
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "unique array of nested objects is valid",
@ -606,7 +654,8 @@
}
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "non-unique array of nested objects is valid",
@ -626,7 +675,8 @@
}
}
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "unique array of arrays is valid",
@ -638,7 +688,8 @@
"bar"
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "non-unique array of arrays is valid",
@ -650,7 +701,8 @@
"foo"
]
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "1 and true are unique",
@ -658,7 +710,8 @@
1,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "0 and false are unique",
@ -666,7 +719,8 @@
0,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "unique heterogeneous types are valid",
@ -679,7 +733,8 @@
null,
1
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
},
{
"description": "non-unique heterogeneous types are valid",
@ -693,7 +748,8 @@
{},
1
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_3_0"
}
]
},
@ -702,7 +758,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "boolean"
@ -712,7 +767,8 @@
}
],
"uniqueItems": false,
"extensible": true
"extensible": true,
"$id": "uniqueItems_4_0"
}
]
},
@ -723,7 +779,8 @@
false,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "[true, false] from items array is valid",
@ -731,7 +788,8 @@
true,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "[false, false] from items array is valid",
@ -739,7 +797,8 @@
false,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "[true, true] from items array is valid",
@ -747,7 +806,8 @@
true,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "unique array extended from [false, true] is valid",
@ -757,7 +817,8 @@
"foo",
"bar"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "unique array extended from [true, false] is valid",
@ -767,7 +828,8 @@
"foo",
"bar"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "non-unique array extended from [false, true] is valid",
@ -777,7 +839,8 @@
"foo",
"foo"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
},
{
"description": "non-unique array extended from [true, false] is valid",
@ -787,7 +850,8 @@
"foo",
"foo"
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_4_0"
}
]
},
@ -796,7 +860,6 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"prefixItems": [
{
"type": "boolean"
@ -806,7 +869,8 @@
}
],
"uniqueItems": false,
"items": false
"items": false,
"$id": "uniqueItems_5_0"
}
]
},
@ -817,7 +881,8 @@
false,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_5_0"
},
{
"description": "[true, false] from items array is valid",
@ -825,7 +890,8 @@
true,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_5_0"
},
{
"description": "[false, false] from items array is valid",
@ -833,7 +899,8 @@
false,
false
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_5_0"
},
{
"description": "[true, true] from items array is valid",
@ -841,7 +908,8 @@
true,
true
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_5_0"
},
{
"description": "extra items are invalid even if unique",
@ -850,7 +918,8 @@
true,
null
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_5_0"
}
]
},
@ -859,9 +928,9 @@
"database": {
"schemas": [
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"uniqueItems": true,
"extensible": true
"extensible": true,
"$id": "uniqueItems_6_0"
}
]
},
@ -872,7 +941,8 @@
1,
1
],
"valid": false
"valid": false,
"schema_id": "uniqueItems_6_0"
},
{
"description": "extra unique items valid",
@ -880,7 +950,8 @@
1,
2
],
"valid": true
"valid": true,
"schema_id": "uniqueItems_6_0"
}
]
}

View File

@ -89,20 +89,7 @@ fn test_library_api() {
})
);
// 6. Mask Happy Path
let mask_drop = mask_json_schema(
"test_schema",
JsonB(json!({"name": "Neo", "extra": "data"})),
);
assert_eq!(
mask_drop.0,
json!({
"type": "drop",
"response": {"name": "Neo"}
})
);
// 7. Clear Schemas
// 6. Clear Schemas
let clear_drop = clear_json_schemas();
assert_eq!(
clear_drop.0,