Re-add preserve_order feature, to preserve order of struct fields in a schema's properties

This commit is contained in:
Graham Esau 2024-05-18 21:55:05 +01:00
parent c4d42ec11a
commit d3b6ff5aeb
60 changed files with 757 additions and 773 deletions

1
Cargo.lock generated
View file

@ -381,6 +381,7 @@ version = "1.0.107"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",

View file

@ -44,6 +44,7 @@ serde = { version = "1.0", features = ["derive"] }
default = ["derive"]
derive = ["schemars_derive"]
preserve_order = ["serde_json/preserve_order"]
raw_value = ["serde_json/raw_value"]

View file

@ -11,8 +11,9 @@ use crate::Schema;
use crate::{visit::*, JsonSchema};
use dyn_clone::DynClone;
use serde::Serialize;
use serde_json::{Map, Value};
use std::borrow::Cow;
use std::collections::{BTreeMap, HashMap};
use std::collections::HashMap;
use std::{any::Any, collections::HashSet, fmt::Debug};
/// Settings to customize how Schemas are generated.
@ -149,7 +150,7 @@ impl SchemaSettings {
#[derive(Debug, Default)]
pub struct SchemaGenerator {
settings: SchemaSettings,
definitions: BTreeMap<String, Schema>,
definitions: Map<String, Value>,
pending_schema_ids: HashSet<Cow<'static, str>>,
schema_id_to_name: HashMap<Cow<'static, str>, String>,
used_schema_names: HashSet<String>,
@ -254,31 +255,31 @@ impl SchemaGenerator {
let schema = self.json_schema_internal::<T>(id);
self.definitions.insert(name, schema);
self.definitions.insert(name, schema.to_value());
}
/// Borrows the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated.
///
/// The keys of the returned `BTreeMap` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// themselves.
pub fn definitions(&self) -> &BTreeMap<String, Schema> {
pub fn definitions(&self) -> &Map<String, Value> {
&self.definitions
}
/// Mutably borrows the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated.
///
/// The keys of the returned `BTreeMap` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// themselves.
pub fn definitions_mut(&mut self) -> &mut BTreeMap<String, Schema> {
pub fn definitions_mut(&mut self) -> &mut Map<String, Value> {
&mut self.definitions
}
/// Returns the collection of all [referenceable](JsonSchema::is_referenceable) schemas that have been generated,
/// leaving an empty map in its place.
///
/// The keys of the returned `BTreeMap` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// The keys of the returned `Map` are the [schema names](JsonSchema::schema_name), and the values are the schemas
/// themselves.
pub fn take_definitions(&mut self) -> BTreeMap<String, Schema> {
pub fn take_definitions(&mut self) -> Map<String, Value> {
std::mem::take(&mut self.definitions)
}
@ -308,12 +309,7 @@ impl SchemaGenerator {
if !self.definitions.is_empty() {
object.insert(
"definitions".into(),
serde_json::Value::Object(
self.definitions
.iter()
.map(|(k, v)| (k.clone(), v.clone().into()))
.collect(),
),
serde_json::Value::Object(self.definitions.clone()),
);
}
@ -344,12 +340,7 @@ impl SchemaGenerator {
if !self.definitions.is_empty() {
object.insert(
"definitions".into(),
serde_json::Value::Object(
self.definitions
.into_iter()
.map(|(k, v)| (k, v.into()))
.collect(),
),
serde_json::Value::Object(self.definitions),
);
}
@ -386,12 +377,7 @@ impl SchemaGenerator {
if !self.definitions.is_empty() {
object.insert(
"definitions".into(),
serde_json::Value::Object(
self.definitions
.iter()
.map(|(k, v)| (k.clone(), v.clone().into()))
.collect(),
),
serde_json::Value::Object(self.definitions.clone()),
);
}
@ -428,12 +414,7 @@ impl SchemaGenerator {
if !self.definitions.is_empty() {
object.insert(
"definitions".into(),
serde_json::Value::Object(
self.definitions
.into_iter()
.map(|(k, v)| (k, v.into()))
.collect(),
),
serde_json::Value::Object(self.definitions),
);
}

View file

@ -180,7 +180,8 @@ mod ser {
use serde_json::Value;
// The order of properties in a JSON Schema object is insignificant, but we explicitly order
// some of them here to make them easier for a human to read.
// some of them here to make them easier for a human to read. All other properties are ordered
// either lexicographically (by default) or by insertion order (if `preserve_order` is enabled)
const ORDERED_KEYWORDS_START: [&str; 7] = [
"$id",
"$schema",

View file

@ -20,6 +20,6 @@
}
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}

View file

@ -3,6 +3,18 @@
"title": "ChronoTypes",
"type": "object",
"properties": {
"weekday": {
"type": "string",
"enum": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun"
]
},
"date_time": {
"type": "string",
"format": "date-time"
@ -18,18 +30,6 @@
"naive_time": {
"type": "string",
"format": "partial-date-time"
},
"weekday": {
"type": "string",
"enum": [
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
"Sun"
]
}
},
"required": [

View file

@ -3,13 +3,13 @@
"title": "Struct",
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"description": "This is a document",
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [

View file

@ -3,22 +3,22 @@
"title": "MyStruct",
"type": "object",
"properties": {
"my_bool": {
"type": "boolean",
"default": false
},
"my_int": {
"type": "integer",
"format": "int32",
"default": 0
},
"my_bool": {
"type": "boolean",
"default": false
},
"my_struct2": {
"default": "i:0 b:false",
"allOf": [
{
"$ref": "#/definitions/MyStruct2"
}
],
"default": "i:0 b:false"
]
},
"my_struct2_default_skipped": {
"$ref": "#/definitions/MyStruct2"
@ -31,14 +31,14 @@
"MyStruct2": {
"type": "object",
"properties": {
"my_bool": {
"type": "boolean",
"default": true
},
"my_int": {
"type": "integer",
"format": "int32",
"default": 6
},
"my_bool": {
"type": "boolean",
"default": true
}
}
},

View file

@ -1,7 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "DeprecatedEnum",
"deprecated": true,
"oneOf": [
{
"type": "string",
@ -20,13 +19,13 @@
"DeprecatedStructVariant": {
"type": "object",
"properties": {
"deprecated_field": {
"type": "boolean",
"deprecated": true
},
"foo": {
"type": "integer",
"format": "int32"
},
"deprecated_field": {
"type": "boolean",
"deprecated": true
}
},
"required": [
@ -35,11 +34,12 @@
]
}
},
"additionalProperties": false,
"deprecated": true,
"required": [
"DeprecatedStructVariant"
]
],
"additionalProperties": false,
"deprecated": true
}
]
],
"deprecated": true
}

View file

@ -3,18 +3,18 @@
"title": "DeprecatedStruct",
"type": "object",
"properties": {
"deprecated_field": {
"type": "boolean",
"deprecated": true
},
"foo": {
"type": "integer",
"format": "int32"
},
"deprecated_field": {
"type": "boolean",
"deprecated": true
}
},
"deprecated": true,
"required": [
"foo",
"deprecated_field"
]
],
"deprecated": true
}

View file

@ -34,10 +34,10 @@
}
}
},
"additionalProperties": false,
"required": [
"Complex"
]
],
"additionalProperties": false
}
]
}

View file

@ -18,15 +18,15 @@
"Duration": {
"type": "object",
"properties": {
"nanos": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"secs": {
"type": "integer",
"format": "uint64",
"minimum": 0
},
"nanos": {
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [
@ -37,15 +37,15 @@
"SystemTime": {
"type": "object",
"properties": {
"nanos_since_epoch": {
"type": "integer",
"format": "uint32",
"minimum": 0
},
"secs_since_epoch": {
"type": "integer",
"format": "uint64",
"minimum": 0
},
"nanos_since_epoch": {
"type": "integer",
"format": "uint32",
"minimum": 0
}
},
"required": [

View file

@ -12,83 +12,89 @@
]
}
},
"additionalProperties": false,
"required": [
"t"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"c": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"t": {
"type": "string",
"enum": [
"StringMap"
]
},
"c": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"t",
"c"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"c": {
"$ref": "#/definitions/UnitStruct"
},
"t": {
"type": "string",
"enum": [
"UnitStructNewType"
]
},
"c": {
"$ref": "#/definitions/UnitStruct"
}
},
"additionalProperties": false,
"required": [
"t",
"c"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"c": {
"$ref": "#/definitions/Struct"
},
"t": {
"type": "string",
"enum": [
"StructNewType"
]
},
"c": {
"$ref": "#/definitions/Struct"
}
},
"additionalProperties": false,
"required": [
"t",
"c"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"t": {
"type": "string",
"enum": [
"Struct"
]
},
"c": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"additionalProperties": false,
@ -96,23 +102,23 @@
"foo",
"bar"
]
},
"t": {
"type": "string",
"enum": [
"Struct"
]
}
},
"additionalProperties": false,
"required": [
"t",
"c"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"t": {
"type": "string",
"enum": [
"Tuple"
]
},
"c": {
"type": "array",
"items": [
@ -124,21 +130,15 @@
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
},
"t": {
"type": "string",
"enum": [
"Tuple"
]
"minItems": 2,
"maxItems": 2
}
},
"additionalProperties": false,
"required": [
"t",
"c"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -150,51 +150,51 @@
]
}
},
"additionalProperties": false,
"required": [
"t"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"c": {
"type": "integer",
"format": "int32"
},
"t": {
"type": "string",
"enum": [
"WithInt"
]
},
"c": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false,
"required": [
"t",
"c"
]
],
"additionalProperties": false
}
],
"definitions": {
"UnitStruct": {
"type": "null"
},
"Struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"UnitStruct": {
"type": "null"
}
}
}

View file

@ -19,17 +19,17 @@
{
"type": "object",
"properties": {
"c": {
"type": "object",
"additionalProperties": {
"type": "string"
}
},
"t": {
"type": "string",
"enum": [
"StringMap"
]
},
"c": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": [
@ -40,14 +40,14 @@
{
"type": "object",
"properties": {
"c": {
"$ref": "#/definitions/UnitStruct"
},
"t": {
"type": "string",
"enum": [
"UnitStructNewType"
]
},
"c": {
"$ref": "#/definitions/UnitStruct"
}
},
"required": [
@ -58,14 +58,14 @@
{
"type": "object",
"properties": {
"c": {
"$ref": "#/definitions/Struct"
},
"t": {
"type": "string",
"enum": [
"StructNewType"
]
},
"c": {
"$ref": "#/definitions/Struct"
}
},
"required": [
@ -76,27 +76,27 @@
{
"type": "object",
"properties": {
"t": {
"type": "string",
"enum": [
"Struct"
]
},
"c": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"t": {
"type": "string",
"enum": [
"Struct"
]
}
},
"required": [
@ -107,6 +107,12 @@
{
"type": "object",
"properties": {
"t": {
"type": "string",
"enum": [
"Tuple"
]
},
"c": {
"type": "array",
"items": [
@ -118,14 +124,8 @@
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
},
"t": {
"type": "string",
"enum": [
"Tuple"
]
"minItems": 2,
"maxItems": 2
}
},
"required": [
@ -150,15 +150,15 @@
{
"type": "object",
"properties": {
"c": {
"type": "integer",
"format": "int32"
},
"t": {
"type": "string",
"enum": [
"WithInt"
]
},
"c": {
"type": "integer",
"format": "int32"
}
},
"required": [
@ -168,24 +168,24 @@
}
],
"definitions": {
"UnitStruct": {
"type": "null"
},
"Struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"UnitStruct": {
"type": "null"
}
}
}

View file

@ -19,10 +19,10 @@
}
}
},
"additionalProperties": false,
"required": [
"stringMap"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -31,10 +31,10 @@
"$ref": "#/definitions/UnitStruct"
}
},
"additionalProperties": false,
"required": [
"unitStructNewType"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -43,10 +43,10 @@
"$ref": "#/definitions/Struct"
}
},
"additionalProperties": false,
"required": [
"structNewType"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -54,12 +54,12 @@
"struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"additionalProperties": false,
@ -69,10 +69,10 @@
]
}
},
"additionalProperties": false,
"required": [
"struct"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -88,14 +88,14 @@
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}
},
"additionalProperties": false,
"required": [
"tuple"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -105,31 +105,31 @@
"format": "int32"
}
},
"additionalProperties": false,
"required": [
"withInt"
]
],
"additionalProperties": false
}
],
"definitions": {
"UnitStruct": {
"type": "null"
},
"Struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"UnitStruct": {
"type": "null"
}
}
}

View file

@ -19,10 +19,10 @@
}
}
},
"additionalProperties": false,
"required": [
"stringMap"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -31,10 +31,10 @@
"$ref": "#/definitions/UnitStruct"
}
},
"additionalProperties": false,
"required": [
"unitStructNewType"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -43,10 +43,10 @@
"$ref": "#/definitions/Struct"
}
},
"additionalProperties": false,
"required": [
"structNewType"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -54,12 +54,12 @@
"struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
@ -68,10 +68,10 @@
]
}
},
"additionalProperties": false,
"required": [
"struct"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -87,14 +87,14 @@
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}
},
"additionalProperties": false,
"required": [
"tuple"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -104,31 +104,31 @@
"format": "int32"
}
},
"additionalProperties": false,
"required": [
"withInt"
]
],
"additionalProperties": false
}
],
"definitions": {
"UnitStruct": {
"type": "null"
},
"Struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"UnitStruct": {
"type": "null"
}
}
}

View file

@ -10,10 +10,10 @@
"const": "UnitOne"
}
},
"additionalProperties": false,
"required": [
"typeProperty"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -38,21 +38,21 @@
"const": "UnitStructNewType"
}
},
"additionalProperties": false,
"required": [
"typeProperty"
]
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
},
"typeProperty": {
"type": "string",
"const": "StructNewType"
@ -67,13 +67,13 @@
{
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
},
"typeProperty": {
"type": "string",
"const": "Struct"
@ -94,10 +94,10 @@
"const": "UnitTwo"
}
},
"additionalProperties": false,
"required": [
"typeProperty"
]
],
"additionalProperties": false
},
{
"type": "object",

View file

@ -44,13 +44,13 @@
{
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
},
"typeProperty": {
"type": "string",
"const": "StructNewType"
@ -65,13 +65,13 @@
{
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
},
"typeProperty": {
"type": "string",
"const": "Struct"

View file

@ -10,10 +10,10 @@
"const": "A"
}
},
"additionalProperties": false,
"required": [
"typeProperty"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -23,10 +23,10 @@
"const": "B"
}
},
"additionalProperties": false,
"required": [
"typeProperty"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -36,10 +36,10 @@
"const": "C"
}
},
"additionalProperties": false,
"required": [
"typeProperty"
]
],
"additionalProperties": false
}
]
}

View file

@ -20,12 +20,12 @@
{
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"additionalProperties": false,
@ -45,8 +45,8 @@
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
},
{
"type": "integer",
@ -54,24 +54,24 @@
}
],
"definitions": {
"UnitStruct": {
"type": "null"
},
"Struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"UnitStruct": {
"type": "null"
}
}
}

View file

@ -20,12 +20,12 @@
{
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
@ -44,8 +44,8 @@
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
},
{
"type": "integer",
@ -53,24 +53,24 @@
}
],
"definitions": {
"UnitStruct": {
"type": "null"
},
"Struct": {
"type": "object",
"properties": {
"bar": {
"type": "boolean"
},
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
}
},
"required": [
"foo",
"bar"
]
},
"UnitStruct": {
"type": "null"
}
}
}

View file

@ -2,10 +2,10 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Set_of_Foo",
"type": "array",
"uniqueItems": true,
"items": {
"$ref": "#/definitions/Foo"
},
"uniqueItems": true,
"definitions": {
"Foo": {
"type": "string",

View file

@ -3,6 +3,14 @@
"title": "Struct",
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32",
"examples": [
8,
null
]
},
"bar": {
"type": "boolean"
},
@ -14,26 +22,18 @@
"examples": [
null
]
},
"foo": {
"type": "integer",
"format": "int32",
"examples": [
8,
null
]
}
},
"examples": [
{
"bar": false,
"baz": null,
"foo": 0
},
null
],
"required": [
"foo",
"bar"
],
"examples": [
{
"foo": 0,
"bar": false,
"baz": null
},
null
]
}

View file

@ -3,20 +3,20 @@
"title": "Flat",
"type": "object",
"properties": {
"b": {
"type": "boolean"
},
"f": {
"type": "number",
"format": "float"
},
"os": {
"type": "string",
"default": ""
"b": {
"type": "boolean"
},
"s": {
"type": "string"
},
"os": {
"type": "string",
"default": ""
},
"v": {
"type": "array",
"items": {

View file

@ -2,12 +2,21 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"bool": {
"type": "boolean"
"zero": {
"type": "integer"
},
"one": {
"type": "integer"
},
"minusOne": {
"type": "integer"
},
"zeroPointZero": {
"type": "number"
},
"bool": {
"type": "boolean"
},
"null": true,
"object": {
"type": "object",
@ -19,31 +28,22 @@
}
}
}
},
"one": {
"type": "integer"
},
"zero": {
"type": "integer"
},
"zeroPointZero": {
"type": "number"
}
},
"examples": [
{
"bool": true,
"zero": 0,
"one": 1,
"minusOne": -1,
"zeroPointZero": 0.0,
"bool": true,
"null": null,
"object": {
"array": [
"foo",
"bar"
]
},
"one": 1,
"zero": 0,
"zeroPointZero": 0.0
}
}
]
}

View file

@ -3,12 +3,28 @@
"title": "MyStruct",
"type": "object",
"properties": {
"myInt": {
"type": "integer"
},
"myBool": {
"type": "boolean"
},
"myNullableEnum": true,
"myInnerStruct": {
"type": "object",
"properties": {
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_vec": {
"type": "array",
"items": {
"type": "string"
}
},
"my_empty_map": {
"type": "object",
"additionalProperties": true
@ -17,19 +33,13 @@
"type": "array",
"items": true
},
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_tuple": {
"type": "array",
"items": [
{
"type": "string",
"maxLength": 1,
"minLength": 1
"minLength": 1,
"maxLength": 1
},
{
"type": "integer"
@ -37,40 +47,30 @@
],
"maxItems": 2,
"minItems": 2
},
"my_vec": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"myInt": {
"type": "integer"
},
"myNullableEnum": true
}
},
"examples": [
{
"myInt": 123,
"myBool": true,
"myNullableEnum": null,
"myInnerStruct": {
"my_empty_map": {},
"my_empty_vec": [],
"my_map": {
"": 0.0
},
"my_tuple": [
"💩",
42
],
"my_vec": [
"hello",
"world"
],
"my_empty_map": {},
"my_empty_vec": [],
"my_tuple": [
"💩",
42
]
},
"myInt": 123,
"myNullableEnum": null
}
}
]
}

View file

@ -3,12 +3,28 @@
"title": "MyStruct",
"type": "object",
"properties": {
"myInt": {
"type": "integer"
},
"myBool": {
"type": "boolean"
},
"myNullableEnum": true,
"myInnerStruct": {
"type": "object",
"properties": {
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_vec": {
"type": "array",
"items": {
"type": "string"
}
},
"my_empty_map": {
"type": "object",
"additionalProperties": true
@ -17,19 +33,13 @@
"type": "array",
"items": true
},
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_tuple": {
"type": "array",
"items": [
{
"type": "string",
"maxLength": 1,
"minLength": 1
"minLength": 1,
"maxLength": 1
},
{
"type": "integer"
@ -37,40 +47,30 @@
],
"maxItems": 2,
"minItems": 2
},
"my_vec": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"myInt": {
"type": "integer"
},
"myNullableEnum": true
}
},
"examples": [
{
"myInt": 123,
"myBool": true,
"myNullableEnum": null,
"myInnerStruct": {
"my_empty_map": {},
"my_empty_vec": [],
"my_map": {
"": 0.0
},
"my_tuple": [
"💩",
42
],
"my_vec": [
"hello",
"world"
],
"my_empty_map": {},
"my_empty_vec": [],
"my_tuple": [
"💩",
42
]
},
"myInt": 123,
"myNullableEnum": null
}
}
]
}

View file

@ -3,12 +3,30 @@
"title": "MyStruct",
"type": "object",
"properties": {
"myInt": {
"type": "integer"
},
"myBool": {
"type": "boolean"
},
"myNullableEnum": {
"nullable": true
},
"myInnerStruct": {
"type": "object",
"properties": {
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_vec": {
"type": "array",
"items": {
"type": "string"
}
},
"my_empty_map": {
"type": "object",
"additionalProperties": true
@ -17,19 +35,13 @@
"type": "array",
"items": {}
},
"my_map": {
"type": "object",
"additionalProperties": {
"type": "number"
}
},
"my_tuple": {
"type": "array",
"items": [
{
"type": "string",
"maxLength": 1,
"minLength": 1
"minLength": 1,
"maxLength": 1
},
{
"type": "integer"
@ -37,40 +49,28 @@
],
"maxItems": 2,
"minItems": 2
},
"my_vec": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"myInt": {
"type": "integer"
},
"myNullableEnum": {
"nullable": true
}
},
"example": {
"myInt": 123,
"myBool": true,
"myNullableEnum": null,
"myInnerStruct": {
"my_empty_map": {},
"my_empty_vec": [],
"my_map": {
"": 0.0
},
"my_tuple": [
"💩",
42
],
"my_vec": [
"hello",
"world"
],
"my_empty_map": {},
"my_empty_vec": [],
"my_tuple": [
"💩",
42
]
},
"myInt": 123,
"myNullableEnum": null
}
}
}

View file

@ -11,11 +11,11 @@
},
"set": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "integer",
"format": "int"
},
"uniqueItems": true
}
}
},
"required": [

View file

@ -9,10 +9,10 @@
"$ref": "#/definitions/InnerStruct"
}
},
"additionalProperties": false,
"required": [
"InnerStruct"
]
],
"additionalProperties": false
}
],
"definitions": {

View file

@ -3,14 +3,14 @@
"title": "A",
"type": "object",
"properties": {
"v": {
"type": "integer",
"format": "int32"
},
"x": {
"type": "integer",
"format": "uint8",
"minimum": 0
},
"v": {
"type": "integer",
"format": "int32"
}
},
"required": [

View file

@ -3,12 +3,10 @@
"title": "MyStruct",
"type": "object",
"properties": {
"nonzero_signed": {
"unsigned": {
"type": "integer",
"format": "int32",
"not": {
"const": 0
}
"format": "uint32",
"minimum": 0
},
"nonzero_unsigned": {
"type": "integer",
@ -19,10 +17,12 @@
"type": "integer",
"format": "int32"
},
"unsigned": {
"nonzero_signed": {
"type": "integer",
"format": "uint32",
"minimum": 0
"format": "int32",
"not": {
"const": 0
}
}
},
"required": [

View file

@ -3,10 +3,10 @@
"title": "OsStrings",
"type": "object",
"properties": {
"borrowed": {
"owned": {
"$ref": "#/definitions/OsString"
},
"owned": {
"borrowed": {
"$ref": "#/definitions/OsString"
}
},

View file

@ -3,14 +3,14 @@
"title": "MyStruct",
"type": "object",
"properties": {
"bound": {
"$ref": "#/definitions/Bound_of_string"
"range": {
"$ref": "#/definitions/Range_of_uint"
},
"inclusive": {
"$ref": "#/definitions/Range_of_double"
},
"range": {
"$ref": "#/definitions/Range_of_uint"
"bound": {
"$ref": "#/definitions/Bound_of_string"
}
},
"required": [
@ -19,6 +19,42 @@
"bound"
],
"definitions": {
"Range_of_uint": {
"type": "object",
"properties": {
"start": {
"type": "integer",
"format": "uint",
"minimum": 0
},
"end": {
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"start",
"end"
]
},
"Range_of_double": {
"type": "object",
"properties": {
"start": {
"type": "number",
"format": "double"
},
"end": {
"type": "number",
"format": "double"
}
},
"required": [
"start",
"end"
]
},
"Bound_of_string": {
"oneOf": [
{
@ -48,42 +84,6 @@
"const": "Unbounded"
}
]
},
"Range_of_double": {
"type": "object",
"properties": {
"end": {
"type": "number",
"format": "double"
},
"start": {
"type": "number",
"format": "double"
}
},
"required": [
"start",
"end"
]
},
"Range_of_uint": {
"type": "object",
"properties": {
"end": {
"type": "integer",
"format": "uint",
"minimum": 0
},
"start": {
"type": "integer",
"format": "uint",
"minimum": 0
}
},
"required": [
"start",
"end"
]
}
}
}

View file

@ -6,27 +6,27 @@
"command_line": {
"type": "string"
},
"system_cpu_time": {
"allOf": [
{
"$ref": "#/definitions/Duration"
}
],
"default": "0.000000000s"
},
"user_cpu_time": {
"allOf": [
{
"$ref": "#/definitions/Duration"
}
],
"default": {
"nanos": 0,
"secs": 0
}
},
"wall_time": {
"$ref": "#/definitions/Duration"
},
"user_cpu_time": {
"default": {
"secs": 0,
"nanos": 0
},
"allOf": [
{
"$ref": "#/definitions/Duration"
}
]
},
"system_cpu_time": {
"default": "0.000000000s",
"allOf": [
{
"$ref": "#/definitions/Duration"
}
]
}
},
"required": [
@ -37,13 +37,13 @@
"Duration": {
"type": "object",
"properties": {
"nanos": {
"type": "integer",
"format": "int32"
},
"secs": {
"type": "integer",
"format": "int64"
},
"nanos": {
"type": "integer",
"format": "int32"
}
},
"required": [

View file

@ -6,21 +6,21 @@
"byte_or_bool2": {
"$ref": "#/definitions/Or_for_uint8_and_boolean"
},
"fake_map": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
},
"uniqueItems": true
}
"unit_or_t2": {
"$ref": "#/definitions/Or_for_null_and_int32"
},
"s": {
"$ref": "#/definitions/Str"
},
"unit_or_t2": {
"$ref": "#/definitions/Or_for_null_and_int32"
"fake_map": {
"type": "object",
"additionalProperties": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
}
}
},
"required": [
@ -30,17 +30,6 @@
"fake_map"
],
"definitions": {
"Or_for_null_and_int32": {
"anyOf": [
{
"type": "null"
},
{
"type": "integer",
"format": "int32"
}
]
},
"Or_for_uint8_and_boolean": {
"anyOf": [
{
@ -53,6 +42,17 @@
}
]
},
"Or_for_null_and_int32": {
"anyOf": [
{
"type": "null"
},
{
"type": "integer",
"format": "int32"
}
]
},
"Str": {
"type": "string"
}

View file

@ -15,18 +15,6 @@
"result2"
],
"definitions": {
"MyStruct": {
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32"
}
},
"required": [
"foo"
]
},
"Result_of_MyStruct_or_Array_of_string": {
"oneOf": [
{
@ -56,6 +44,18 @@
}
]
},
"MyStruct": {
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32"
}
},
"required": [
"foo"
]
},
"Result_of_boolean_or_null": {
"oneOf": [
{

View file

@ -3,9 +3,6 @@
"title": "a-new-name-Array_of_string-int32-int32",
"type": "object",
"properties": {
"inner": {
"$ref": "#/definitions/another-new-name"
},
"t": {
"type": "integer",
"format": "int32"
@ -21,6 +18,9 @@
"items": {
"type": "string"
}
},
"inner": {
"$ref": "#/definitions/another-new-name"
}
},
"required": [

View file

@ -3,9 +3,6 @@
"title": "MyStruct_for_int32_and_null_and_boolean_and_Array_of_string",
"type": "object",
"properties": {
"inner": {
"$ref": "#/definitions/MySimpleStruct"
},
"t": {
"type": "integer",
"format": "int32"
@ -21,6 +18,9 @@
"items": {
"type": "string"
}
},
"inner": {
"$ref": "#/definitions/MySimpleStruct"
}
},
"required": [

View file

@ -3,12 +3,12 @@
"title": "MixedGenericStruct_for_MyStruct_for_int32_and_null_and_boolean_and_Array_of_string_and_42_and_z",
"type": "object",
"properties": {
"generic": {
"$ref": "#/definitions/MyStruct_for_int32_and_null_and_boolean_and_Array_of_string"
},
"foo": {
"type": "integer",
"format": "int32"
},
"generic": {
"$ref": "#/definitions/MyStruct_for_int32_and_null_and_boolean_and_Array_of_string"
}
},
"required": [
@ -16,24 +16,9 @@
"foo"
],
"definitions": {
"MySimpleStruct": {
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32"
}
},
"required": [
"foo"
]
},
"MyStruct_for_int32_and_null_and_boolean_and_Array_of_string": {
"type": "object",
"properties": {
"inner": {
"$ref": "#/definitions/MySimpleStruct"
},
"t": {
"type": "integer",
"format": "int32"
@ -49,6 +34,9 @@
"items": {
"type": "string"
}
},
"inner": {
"$ref": "#/definitions/MySimpleStruct"
}
},
"required": [
@ -58,6 +46,18 @@
"w",
"inner"
]
},
"MySimpleStruct": {
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32"
}
},
"required": [
"foo"
]
}
}
}

View file

@ -3,6 +3,19 @@
"title": "Outer",
"type": "object",
"properties": {
"int": {
"type": "integer",
"format": "int32",
"examples": [
8,
null
]
},
"values": {
"type": "object",
"additionalProperties": true
},
"value": true,
"inner": {
"anyOf": [
{
@ -12,19 +25,6 @@
"type": "null"
}
]
},
"int": {
"type": "integer",
"format": "int32",
"examples": [
8,
null
]
},
"value": true,
"values": {
"type": "object",
"additionalProperties": true
}
},
"required": [
@ -52,10 +52,10 @@
"properties": {
"ValueNewType": true
},
"additionalProperties": false,
"required": [
"ValueNewType"
]
],
"additionalProperties": false
}
]
}

View file

@ -3,23 +3,23 @@
"title": "Outer",
"type": "object",
"properties": {
"inner": {
"allOf": [
{
"$ref": "#/components/schemas/Inner"
}
],
"nullable": true
},
"int": {
"type": "integer",
"format": "int32",
"example": 8
},
"value": {},
"values": {
"type": "object",
"additionalProperties": true
},
"value": {},
"inner": {
"nullable": true,
"allOf": [
{
"$ref": "#/components/schemas/Inner"
}
]
}
},
"required": [
@ -49,10 +49,10 @@
"properties": {
"ValueNewType": {}
},
"additionalProperties": false,
"required": [
"ValueNewType"
]
],
"additionalProperties": false
}
]
}

View file

@ -3,6 +3,19 @@
"title": "Outer",
"type": "object",
"properties": {
"int": {
"type": "integer",
"format": "int32",
"examples": [
8,
null
]
},
"values": {
"type": "object",
"additionalProperties": true
},
"value": true,
"inner": {
"anyOf": [
{
@ -12,19 +25,6 @@
"type": "null"
}
]
},
"int": {
"type": "integer",
"format": "int32",
"examples": [
8,
null
]
},
"value": true,
"values": {
"type": "object",
"additionalProperties": true
}
},
"required": [
@ -52,10 +52,10 @@
"properties": {
"ValueNewType": true
},
"additionalProperties": false,
"required": [
"ValueNewType"
]
],
"additionalProperties": false
}
]
}

View file

@ -5,6 +5,12 @@
{
"type": "object",
"properties": {
"t": {
"type": "string",
"enum": [
"Struct"
]
},
"c": {
"type": "object",
"properties": {
@ -15,12 +21,6 @@
"required": [
"foo"
]
},
"t": {
"type": "string",
"enum": [
"Struct"
]
}
},
"required": [
@ -31,14 +31,14 @@
{
"type": "object",
"properties": {
"c": {
"type": "boolean"
},
"t": {
"type": "string",
"enum": [
"NewType"
]
},
"c": {
"type": "boolean"
}
},
"required": [
@ -49,6 +49,12 @@
{
"type": "object",
"properties": {
"t": {
"type": "string",
"enum": [
"Tuple"
]
},
"c": {
"type": "array",
"items": [
@ -60,14 +66,8 @@
"format": "int32"
}
],
"maxItems": 2,
"minItems": 2
},
"t": {
"type": "string",
"enum": [
"Tuple"
]
"minItems": 2,
"maxItems": 2
}
},
"required": [
@ -78,14 +78,14 @@
{
"type": "object",
"properties": {
"c": {
"type": "boolean"
},
"t": {
"type": "string",
"enum": [
"Unit"
]
},
"c": {
"type": "boolean"
}
},
"required": [

View file

@ -17,10 +17,10 @@
]
}
},
"additionalProperties": false,
"required": [
"struct"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -29,10 +29,10 @@
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"newType"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -48,14 +48,14 @@
"format": "int32"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}
},
"additionalProperties": false,
"required": [
"tuple"
]
],
"additionalProperties": false
},
{
"type": "object",
@ -64,10 +64,10 @@
"type": "boolean"
}
},
"additionalProperties": false,
"required": [
"unit"
]
],
"additionalProperties": false
}
]
}

View file

@ -27,8 +27,8 @@
"format": "int32"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
},
{
"type": "boolean"

View file

@ -3,15 +3,15 @@
"title": "Struct",
"type": "object",
"properties": {
"foo": {
"type": "boolean"
},
"bar": {
"type": "integer",
"format": "int32"
},
"baz": {
"type": "boolean"
},
"foo": {
"type": "boolean"
}
},
"required": [

View file

@ -14,6 +14,6 @@
"type": "boolean"
}
],
"maxItems": 3,
"minItems": 3
"minItems": 3,
"maxItems": 3
}

View file

@ -16,10 +16,10 @@
"format": "float"
}
},
"additionalProperties": false,
"required": [
"Included1"
]
],
"additionalProperties": false
}
]
}

View file

@ -3,18 +3,18 @@
"title": "MyStruct",
"type": "object",
"properties": {
"included": {
"type": "null"
},
"readable": {
"type": "string",
"default": "",
"readOnly": true
"readOnly": true,
"default": ""
},
"writable": {
"type": "number",
"format": "float",
"writeOnly": true
},
"included": {
"type": "null"
}
},
"required": [

View file

@ -11,6 +11,6 @@
"type": "null"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}

View file

@ -3,6 +3,10 @@
"title": "Struct",
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
},
@ -11,10 +15,6 @@
"string",
"null"
]
},
"foo": {
"type": "integer",
"format": "int32"
}
},
"additionalProperties": false,

View file

@ -3,6 +3,10 @@
"title": "Struct",
"type": "object",
"properties": {
"foo": {
"type": "integer",
"format": "int32"
},
"bar": {
"type": "boolean"
},
@ -11,10 +15,6 @@
"string",
"null"
]
},
"foo": {
"type": "integer",
"format": "int32"
}
},
"required": [

View file

@ -17,6 +17,6 @@
]
}
],
"maxItems": 3,
"minItems": 3
"minItems": 3,
"maxItems": 3
}

View file

@ -26,8 +26,8 @@
"format": "int32"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}
}
}

View file

@ -3,61 +3,17 @@
"title": "Struct",
"type": "object",
"properties": {
"contains_str1": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"contains_str2": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"email_address": {
"type": "string",
"format": "email"
},
"homepage": {
"type": "string",
"format": "uri"
},
"map_contains": {
"type": "object",
"additionalProperties": {
"type": "null"
},
"required": [
"map_key"
]
},
"min_max": {
"type": "number",
"format": "float",
"maximum": 100,
"minimum": 0.01
"minimum": 0.01,
"maximum": 100
},
"min_max2": {
"type": "number",
"format": "float",
"maximum": 1000,
"minimum": 1
},
"non_empty_str": {
"type": "string",
"maxLength": 100,
"minLength": 1
},
"non_empty_str2": {
"type": "string",
"maxLength": 1000,
"minLength": 1
},
"pair": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"maxItems": 2,
"minItems": 2
"minimum": 1,
"maximum": 1000
},
"regex_str1": {
"type": "string",
@ -71,13 +27,57 @@
"type": "string",
"pattern": "^\\d+$"
},
"required_option": {
"type": "boolean"
"contains_str1": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"contains_str2": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"email_address": {
"type": "string",
"format": "email"
},
"tel": {
"type": "string",
"format": "phone"
},
"homepage": {
"type": "string",
"format": "uri"
},
"non_empty_str": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"non_empty_str2": {
"type": "string",
"minLength": 1,
"maxLength": 1000
},
"pair": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"minItems": 2,
"maxItems": 2
},
"map_contains": {
"type": "object",
"additionalProperties": {
"type": "null"
},
"required": [
"map_key"
]
},
"required_option": {
"type": "boolean"
},
"x": {
"type": "integer",
"format": "int32"

View file

@ -7,11 +7,11 @@
"type": "array",
"items": {
"type": "string",
"maxLength": 100,
"minLength": 5
"minLength": 5,
"maxLength": 100
},
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
},
"slice_str_contains": {
"type": "array",
@ -20,33 +20,6 @@
"pattern": "substring\\.\\.\\."
}
},
"vec_i32_range": {
"type": "array",
"items": {
"type": "integer",
"format": "int32",
"maximum": 10,
"minimum": -10
}
},
"vec_str_length": {
"type": "array",
"items": {
"type": "string",
"maxLength": 100,
"minLength": 1
}
},
"vec_str_length2": {
"type": "array",
"items": {
"type": "string",
"maxLength": 100,
"minLength": 1
},
"maxItems": 3,
"minItems": 1
},
"vec_str_regex": {
"type": "array",
"items": {
@ -54,12 +27,39 @@
"pattern": "^[Hh]ello\\b"
}
},
"vec_str_length": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 100
}
},
"vec_str_length2": {
"type": "array",
"items": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"minItems": 1,
"maxItems": 3
},
"vec_str_url": {
"type": "array",
"items": {
"type": "string",
"format": "uri"
}
},
"vec_i32_range": {
"type": "array",
"items": {
"type": "integer",
"format": "int32",
"minimum": -10,
"maximum": 10
}
}
},
"required": [

View file

@ -3,6 +3,6 @@
"title": "NewType",
"type": "integer",
"format": "uint8",
"maximum": 10,
"minimum": 0
"minimum": 0,
"maximum": 10
}

View file

@ -3,61 +3,17 @@
"title": "Struct2",
"type": "object",
"properties": {
"contains_str1": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"contains_str2": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"email_address": {
"type": "string",
"format": "email"
},
"homepage": {
"type": "string",
"format": "uri"
},
"map_contains": {
"type": "object",
"additionalProperties": {
"type": "null"
},
"required": [
"map_key"
]
},
"min_max": {
"type": "number",
"format": "float",
"maximum": 100,
"minimum": 0.01
"minimum": 0.01,
"maximum": 100
},
"min_max2": {
"type": "number",
"format": "float",
"maximum": 1000,
"minimum": 1
},
"non_empty_str": {
"type": "string",
"maxLength": 100,
"minLength": 1
},
"non_empty_str2": {
"type": "string",
"maxLength": 1000,
"minLength": 1
},
"pair": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"maxItems": 2,
"minItems": 2
"minimum": 1,
"maximum": 1000
},
"regex_str1": {
"type": "string",
@ -71,13 +27,57 @@
"type": "string",
"pattern": "^\\d+$"
},
"required_option": {
"type": "boolean"
"contains_str1": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"contains_str2": {
"type": "string",
"pattern": "substring\\.\\.\\."
},
"email_address": {
"type": "string",
"format": "email"
},
"tel": {
"type": "string",
"format": "phone"
},
"homepage": {
"type": "string",
"format": "uri"
},
"non_empty_str": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"non_empty_str2": {
"type": "string",
"minLength": 1,
"maxLength": 1000
},
"pair": {
"type": "array",
"items": {
"type": "integer",
"format": "int32"
},
"minItems": 2,
"maxItems": 2
},
"map_contains": {
"type": "object",
"additionalProperties": {
"type": "null"
},
"required": [
"map_key"
]
},
"required_option": {
"type": "boolean"
},
"x": {
"type": "integer",
"format": "int32"

View file

@ -6,13 +6,13 @@
{
"type": "integer",
"format": "uint8",
"maximum": 10,
"minimum": 0
"minimum": 0,
"maximum": 10
},
{
"type": "boolean"
}
],
"maxItems": 2,
"minItems": 2
"minItems": 2,
"maxItems": 2
}