diff --git a/typify/tests/schemas/reflexive.json b/typify/tests/schemas/reflexive.json
index 7eb4e6e4..605e3eaf 100644
--- a/typify/tests/schemas/reflexive.json
+++ b/typify/tests/schemas/reflexive.json
@@ -1,17 +1,242 @@
{
- "$comment": "validate references to the whole",
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "node",
- "type": "object",
- "properties": {
- "value": {
- "type": "integer"
+ "$comment": "tests reflexive schemas with the json schema draft 7 schema",
+ "$schema": "http://json-schema.org/draft-07/schema",
+ "$id": "http://json-schema.org/draft-07/schema",
+ "title": "Core schema meta-schema",
+ "definitions": {
+ "schemaArray": {
+ "type": "array",
+ "minItems": 1,
+ "items": {
+ "$ref": "#"
+ }
+ },
+ "nonNegativeInteger": {
+ "type": "integer",
+ "minimum": 0
+ },
+ "nonNegativeIntegerDefault0": {
+ "allOf": [
+ {
+ "$ref": "#/definitions/nonNegativeInteger"
+ },
+ {
+ "default": 0
+ }
+ ]
},
- "children": {
+ "simpleTypes": {
+ "enum": [
+ "array",
+ "boolean",
+ "integer",
+ "null",
+ "number",
+ "object",
+ "string"
+ ]
+ },
+ "stringArray": {
"type": "array",
"items": {
+ "type": "string"
+ },
+ "uniqueItems": true,
+ "default": []
+ }
+ },
+ "type": [
+ "object",
+ "boolean"
+ ],
+ "properties": {
+ "$id": {
+ "type": "string",
+ "format": "uri-reference"
+ },
+ "$schema": {
+ "type": "string",
+ "format": "uri"
+ },
+ "$ref": {
+ "type": "string",
+ "format": "uri-reference"
+ },
+ "$comment": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "description": {
+ "type": "string"
+ },
+ "default": true,
+ "readOnly": {
+ "type": "boolean",
+ "default": false
+ },
+ "examples": {
+ "type": "array",
+ "items": true
+ },
+ "multipleOf": {
+ "type": "number",
+ "exclusiveMinimum": 0
+ },
+ "maximum": {
+ "type": "number"
+ },
+ "exclusiveMaximum": {
+ "type": "number"
+ },
+ "minimum": {
+ "type": "number"
+ },
+ "exclusiveMinimum": {
+ "type": "number"
+ },
+ "maxLength": {
+ "$ref": "#/definitions/nonNegativeInteger"
+ },
+ "minLength": {
+ "$ref": "#/definitions/nonNegativeIntegerDefault0"
+ },
+ "pattern": {
+ "type": "string",
+ "format": "regex"
+ },
+ "additionalItems": {
+ "$ref": "#"
+ },
+ "items": {
+ "anyOf": [
+ {
+ "$ref": "#"
+ },
+ {
+ "$ref": "#/definitions/schemaArray"
+ }
+ ],
+ "default": true
+ },
+ "maxItems": {
+ "$ref": "#/definitions/nonNegativeInteger"
+ },
+ "minItems": {
+ "$ref": "#/definitions/nonNegativeIntegerDefault0"
+ },
+ "uniqueItems": {
+ "type": "boolean",
+ "default": false
+ },
+ "contains": {
+ "$ref": "#"
+ },
+ "maxProperties": {
+ "$ref": "#/definitions/nonNegativeInteger"
+ },
+ "minProperties": {
+ "$ref": "#/definitions/nonNegativeIntegerDefault0"
+ },
+ "required": {
+ "$ref": "#/definitions/stringArray"
+ },
+ "additionalProperties": {
+ "$ref": "#"
+ },
+ "definitions": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#"
+ },
+ "default": {}
+ },
+ "properties": {
+ "type": "object",
+ "additionalProperties": {
"$ref": "#"
+ },
+ "default": {}
+ },
+ "patternProperties": {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#"
+ },
+ "propertyNames": {
+ "format": "regex"
+ },
+ "default": {}
+ },
+ "dependencies": {
+ "type": "object",
+ "additionalProperties": {
+ "anyOf": [
+ {
+ "$ref": "#"
+ },
+ {
+ "$ref": "#/definitions/stringArray"
+ }
+ ]
}
+ },
+ "propertyNames": {
+ "$ref": "#"
+ },
+ "const": true,
+ "enum": {
+ "type": "array",
+ "items": true,
+ "minItems": 1,
+ "uniqueItems": true
+ },
+ "type": {
+ "anyOf": [
+ {
+ "$ref": "#/definitions/simpleTypes"
+ },
+ {
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/simpleTypes"
+ },
+ "minItems": 1,
+ "uniqueItems": true
+ }
+ ]
+ },
+ "format": {
+ "type": "string"
+ },
+ "contentMediaType": {
+ "type": "string"
+ },
+ "contentEncoding": {
+ "type": "string"
+ },
+ "if": {
+ "$ref": "#"
+ },
+ "then": {
+ "$ref": "#"
+ },
+ "else": {
+ "$ref": "#"
+ },
+ "allOf": {
+ "$ref": "#/definitions/schemaArray"
+ },
+ "anyOf": {
+ "$ref": "#/definitions/schemaArray"
+ },
+ "oneOf": {
+ "$ref": "#/definitions/schemaArray"
+ },
+ "not": {
+ "$ref": "#"
}
- }
+ },
+ "default": true
}
\ No newline at end of file
diff --git a/typify/tests/schemas/reflexive.rs b/typify/tests/schemas/reflexive.rs
index 7cf7c6c4..b4d01285 100644
--- a/typify/tests/schemas/reflexive.rs
+++ b/typify/tests/schemas/reflexive.rs
@@ -25,107 +25,895 @@ pub mod error {
}
}
}
-#[doc = "Node"]
+#[doc = "CoreSchemaMetaSchema"]
#[doc = r""]
#[doc = r" JSON schema
"]
#[doc = r""]
#[doc = r" ```json"]
#[doc = "{"]
-#[doc = " \"title\": \"node\","]
-#[doc = " \"type\": \"object\","]
+#[doc = " \"$id\": \"http://json-schema.org/draft-07/schema\","]
+#[doc = " \"title\": \"Core schema meta-schema\","]
+#[doc = " \"default\": true,"]
+#[doc = " \"type\": ["]
+#[doc = " \"object\","]
+#[doc = " \"boolean\""]
+#[doc = " ],"]
#[doc = " \"properties\": {"]
-#[doc = " \"children\": {"]
+#[doc = " \"$comment\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"$id\": {"]
+#[doc = " \"type\": \"string\","]
+#[doc = " \"format\": \"uri-reference\""]
+#[doc = " },"]
+#[doc = " \"$ref\": {"]
+#[doc = " \"type\": \"string\","]
+#[doc = " \"format\": \"uri-reference\""]
+#[doc = " },"]
+#[doc = " \"$schema\": {"]
+#[doc = " \"type\": \"string\","]
+#[doc = " \"format\": \"uri\""]
+#[doc = " },"]
+#[doc = " \"additionalItems\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"additionalProperties\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"allOf\": {"]
+#[doc = " \"$ref\": \"#/definitions/schemaArray\""]
+#[doc = " },"]
+#[doc = " \"anyOf\": {"]
+#[doc = " \"$ref\": \"#/definitions/schemaArray\""]
+#[doc = " },"]
+#[doc = " \"const\": true,"]
+#[doc = " \"contains\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"contentEncoding\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"contentMediaType\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"default\": true,"]
+#[doc = " \"definitions\": {"]
+#[doc = " \"default\": {},"]
+#[doc = " \"type\": \"object\","]
+#[doc = " \"additionalProperties\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " }"]
+#[doc = " },"]
+#[doc = " \"dependencies\": {"]
+#[doc = " \"type\": \"object\","]
+#[doc = " \"additionalProperties\": {"]
+#[doc = " \"anyOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/stringArray\""]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = " }"]
+#[doc = " },"]
+#[doc = " \"description\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"else\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"enum\": {"]
#[doc = " \"type\": \"array\","]
-#[doc = " \"items\": {"]
+#[doc = " \"items\": true,"]
+#[doc = " \"minItems\": 1,"]
+#[doc = " \"uniqueItems\": true"]
+#[doc = " },"]
+#[doc = " \"examples\": {"]
+#[doc = " \"type\": \"array\","]
+#[doc = " \"items\": true"]
+#[doc = " },"]
+#[doc = " \"exclusiveMaximum\": {"]
+#[doc = " \"type\": \"number\""]
+#[doc = " },"]
+#[doc = " \"exclusiveMinimum\": {"]
+#[doc = " \"type\": \"number\""]
+#[doc = " },"]
+#[doc = " \"format\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"if\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"items\": {"]
+#[doc = " \"default\": true,"]
+#[doc = " \"anyOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/schemaArray\""]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = " },"]
+#[doc = " \"maxItems\": {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeInteger\""]
+#[doc = " },"]
+#[doc = " \"maxLength\": {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeInteger\""]
+#[doc = " },"]
+#[doc = " \"maxProperties\": {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeInteger\""]
+#[doc = " },"]
+#[doc = " \"maximum\": {"]
+#[doc = " \"type\": \"number\""]
+#[doc = " },"]
+#[doc = " \"minItems\": {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeIntegerDefault0\""]
+#[doc = " },"]
+#[doc = " \"minLength\": {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeIntegerDefault0\""]
+#[doc = " },"]
+#[doc = " \"minProperties\": {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeIntegerDefault0\""]
+#[doc = " },"]
+#[doc = " \"minimum\": {"]
+#[doc = " \"type\": \"number\""]
+#[doc = " },"]
+#[doc = " \"multipleOf\": {"]
+#[doc = " \"type\": \"number\","]
+#[doc = " \"exclusiveMinimum\": 0.0"]
+#[doc = " },"]
+#[doc = " \"not\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"oneOf\": {"]
+#[doc = " \"$ref\": \"#/definitions/schemaArray\""]
+#[doc = " },"]
+#[doc = " \"pattern\": {"]
+#[doc = " \"type\": \"string\","]
+#[doc = " \"format\": \"regex\""]
+#[doc = " },"]
+#[doc = " \"patternProperties\": {"]
+#[doc = " \"default\": {},"]
+#[doc = " \"type\": \"object\","]
+#[doc = " \"additionalProperties\": {"]
#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"propertyNames\": {"]
+#[doc = " \"format\": \"regex\""]
#[doc = " }"]
#[doc = " },"]
-#[doc = " \"value\": {"]
-#[doc = " \"type\": \"integer\""]
+#[doc = " \"properties\": {"]
+#[doc = " \"default\": {},"]
+#[doc = " \"type\": \"object\","]
+#[doc = " \"additionalProperties\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " }"]
+#[doc = " },"]
+#[doc = " \"propertyNames\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"readOnly\": {"]
+#[doc = " \"default\": false,"]
+#[doc = " \"type\": \"boolean\""]
+#[doc = " },"]
+#[doc = " \"required\": {"]
+#[doc = " \"$ref\": \"#/definitions/stringArray\""]
+#[doc = " },"]
+#[doc = " \"then\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"title\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"type\": {"]
+#[doc = " \"anyOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/simpleTypes\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"type\": \"array\","]
+#[doc = " \"items\": {"]
+#[doc = " \"$ref\": \"#/definitions/simpleTypes\""]
+#[doc = " },"]
+#[doc = " \"minItems\": 1,"]
+#[doc = " \"uniqueItems\": true"]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = " },"]
+#[doc = " \"uniqueItems\": {"]
+#[doc = " \"default\": false,"]
+#[doc = " \"type\": \"boolean\""]
#[doc = " }"]
#[doc = " },"]
-#[doc = " \"$comment\": \"validate references to the whole\""]
+#[doc = " \"$comment\": \"tests reflexive schemas with the json schema draft 7 schema\""]
#[doc = "}"]
#[doc = r" ```"]
#[doc = r" "]
#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
-pub struct Node {
- #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
- pub children: ::std::vec::Vec,
- #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
- pub value: ::std::option::Option,
-}
-impl ::std::convert::From<&Node> for Node {
- fn from(value: &Node) -> Self {
+#[serde(untagged)]
+pub enum CoreSchemaMetaSchema {
+ Boolean(bool),
+ Object {
+ #[serde(
+ rename = "additionalItems",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ additional_items: ::std::option::Option<::std::boxed::Box>,
+ #[serde(
+ rename = "additionalProperties",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ additional_properties: ::std::option::Option<::std::boxed::Box>,
+ #[serde(
+ rename = "allOf",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ all_of: ::std::option::Option,
+ #[serde(
+ rename = "anyOf",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ any_of: ::std::option::Option,
+ #[serde(
+ rename = "$comment",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ comment: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "const",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ const_: ::std::option::Option<::serde_json::Value>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ contains: ::std::option::Option<::std::boxed::Box>,
+ #[serde(
+ rename = "contentEncoding",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ content_encoding: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "contentMediaType",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ content_media_type: ::std::option::Option<::std::string::String>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ default: ::std::option::Option<::serde_json::Value>,
+ #[serde(
+ default,
+ skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
+ )]
+ definitions: ::std::collections::HashMap<::std::string::String, CoreSchemaMetaSchema>,
+ #[serde(
+ default,
+ skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
+ )]
+ dependencies: ::std::collections::HashMap<
+ ::std::string::String,
+ CoreSchemaMetaSchemaObjectDependenciesValue,
+ >,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ description: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "else",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ else_: ::std::option::Option<::std::boxed::Box>,
+ #[serde(
+ rename = "enum",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ enum_: ::std::option::Option>,
+ #[serde(default, skip_serializing_if = "::std::vec::Vec::is_empty")]
+ examples: ::std::vec::Vec<::serde_json::Value>,
+ #[serde(
+ rename = "exclusiveMaximum",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ exclusive_maximum: ::std::option::Option,
+ #[serde(
+ rename = "exclusiveMinimum",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ exclusive_minimum: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ format: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "$id",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ id: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "if",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ if_: ::std::option::Option<::std::boxed::Box>,
+ #[serde(default = "defaults::core_schema_meta_schema_object_items")]
+ items: CoreSchemaMetaSchemaObjectItems,
+ #[serde(
+ rename = "maxItems",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ max_items: ::std::option::Option,
+ #[serde(
+ rename = "maxLength",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ max_length: ::std::option::Option,
+ #[serde(
+ rename = "maxProperties",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ max_properties: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ maximum: ::std::option::Option,
+ #[serde(
+ rename = "minItems",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ min_items: ::std::option::Option,
+ #[serde(
+ rename = "minLength",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ min_length: ::std::option::Option,
+ #[serde(
+ rename = "minProperties",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ min_properties: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ minimum: ::std::option::Option,
+ #[serde(
+ rename = "multipleOf",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ multiple_of: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ not: ::std::option::Option<::std::boxed::Box>,
+ #[serde(
+ rename = "oneOf",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ one_of: ::std::option::Option,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ pattern: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "patternProperties",
+ default,
+ skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
+ )]
+ pattern_properties:
+ ::std::collections::HashMap<::std::string::String, CoreSchemaMetaSchema>,
+ #[serde(
+ default,
+ skip_serializing_if = ":: std :: collections :: HashMap::is_empty"
+ )]
+ properties: ::std::collections::HashMap<::std::string::String, CoreSchemaMetaSchema>,
+ #[serde(
+ rename = "propertyNames",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ property_names: ::std::option::Option<::std::boxed::Box>,
+ #[serde(rename = "readOnly", default)]
+ read_only: bool,
+ #[serde(
+ rename = "$ref",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ ref_: ::std::option::Option<::std::string::String>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ required: ::std::option::Option,
+ #[serde(
+ rename = "$schema",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ schema: ::std::option::Option<::std::string::String>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ then: ::std::option::Option<::std::boxed::Box>,
+ #[serde(default, skip_serializing_if = "::std::option::Option::is_none")]
+ title: ::std::option::Option<::std::string::String>,
+ #[serde(
+ rename = "type",
+ default,
+ skip_serializing_if = "::std::option::Option::is_none"
+ )]
+ type_: ::std::option::Option,
+ #[serde(rename = "uniqueItems", default)]
+ unique_items: bool,
+ },
+}
+impl ::std::convert::From<&Self> for CoreSchemaMetaSchema {
+ fn from(value: &CoreSchemaMetaSchema) -> Self {
value.clone()
}
}
-impl ::std::default::Default for Node {
+impl ::std::default::Default for CoreSchemaMetaSchema {
fn default() -> Self {
- Self {
- children: Default::default(),
- value: Default::default(),
- }
+ CoreSchemaMetaSchema::Boolean(true)
}
}
-impl Node {
- pub fn builder() -> builder::Node {
- Default::default()
+impl ::std::convert::From for CoreSchemaMetaSchema {
+ fn from(value: bool) -> Self {
+ Self::Boolean(value)
}
}
-#[doc = r" Types for composing complex structures."]
-pub mod builder {
- #[derive(Clone, Debug)]
- pub struct Node {
- children: ::std::result::Result<::std::vec::Vec, ::std::string::String>,
- value: ::std::result::Result<::std::option::Option, ::std::string::String>,
+#[doc = "CoreSchemaMetaSchemaObjectDependenciesValue"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"anyOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/stringArray\""]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum CoreSchemaMetaSchemaObjectDependenciesValue {
+ Variant0(CoreSchemaMetaSchema),
+ Variant1(StringArray),
+}
+impl ::std::convert::From<&Self> for CoreSchemaMetaSchemaObjectDependenciesValue {
+ fn from(value: &CoreSchemaMetaSchemaObjectDependenciesValue) -> Self {
+ value.clone()
}
- impl ::std::default::Default for Node {
- fn default() -> Self {
- Self {
- children: Ok(Default::default()),
- value: Ok(Default::default()),
- }
- }
+}
+impl ::std::convert::From for CoreSchemaMetaSchemaObjectDependenciesValue {
+ fn from(value: CoreSchemaMetaSchema) -> Self {
+ Self::Variant0(value)
}
- impl Node {
- pub fn children(mut self, value: T) -> Self
- where
- T: ::std::convert::TryInto<::std::vec::Vec>,
- T::Error: ::std::fmt::Display,
- {
- self.children = value
- .try_into()
- .map_err(|e| format!("error converting supplied value for children: {}", e));
- self
- }
- pub fn value(mut self, value: T) -> Self
- where
- T: ::std::convert::TryInto<::std::option::Option>,
- T::Error: ::std::fmt::Display,
- {
- self.value = value
- .try_into()
- .map_err(|e| format!("error converting supplied value for value: {}", e));
- self
- }
+}
+impl ::std::convert::From for CoreSchemaMetaSchemaObjectDependenciesValue {
+ fn from(value: StringArray) -> Self {
+ Self::Variant1(value)
+ }
+}
+#[doc = "CoreSchemaMetaSchemaObjectItems"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"default\": true,"]
+#[doc = " \"anyOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/schemaArray\""]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum CoreSchemaMetaSchemaObjectItems {
+ Variant0(::std::boxed::Box),
+ Variant1(SchemaArray),
+}
+impl ::std::convert::From<&Self> for CoreSchemaMetaSchemaObjectItems {
+ fn from(value: &CoreSchemaMetaSchemaObjectItems) -> Self {
+ value.clone()
+ }
+}
+impl ::std::default::Default for CoreSchemaMetaSchemaObjectItems {
+ fn default() -> Self {
+ CoreSchemaMetaSchemaObjectItems::Variant0(::std::boxed::Box::new(
+ CoreSchemaMetaSchema::Boolean(true),
+ ))
+ }
+}
+impl ::std::convert::From<::std::boxed::Box>
+ for CoreSchemaMetaSchemaObjectItems
+{
+ fn from(value: ::std::boxed::Box) -> Self {
+ Self::Variant0(value)
+ }
+}
+impl ::std::convert::From for CoreSchemaMetaSchemaObjectItems {
+ fn from(value: SchemaArray) -> Self {
+ Self::Variant1(value)
+ }
+}
+#[doc = "CoreSchemaMetaSchemaObjectType"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"anyOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/simpleTypes\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"type\": \"array\","]
+#[doc = " \"items\": {"]
+#[doc = " \"$ref\": \"#/definitions/simpleTypes\""]
+#[doc = " },"]
+#[doc = " \"minItems\": 1,"]
+#[doc = " \"uniqueItems\": true"]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(untagged)]
+pub enum CoreSchemaMetaSchemaObjectType {
+ Variant0(SimpleTypes),
+ Variant1(Vec),
+}
+impl ::std::convert::From<&Self> for CoreSchemaMetaSchemaObjectType {
+ fn from(value: &CoreSchemaMetaSchemaObjectType) -> Self {
+ value.clone()
+ }
+}
+impl ::std::convert::From for CoreSchemaMetaSchemaObjectType {
+ fn from(value: SimpleTypes) -> Self {
+ Self::Variant0(value)
+ }
+}
+impl ::std::convert::From> for CoreSchemaMetaSchemaObjectType {
+ fn from(value: Vec) -> Self {
+ Self::Variant1(value)
+ }
+}
+#[doc = "NonNegativeInteger"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"type\": \"integer\","]
+#[doc = " \"minimum\": 0.0"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct NonNegativeInteger(pub u64);
+impl ::std::ops::Deref for NonNegativeInteger {
+ type Target = u64;
+ fn deref(&self) -> &u64 {
+ &self.0
+ }
+}
+impl ::std::convert::From for u64 {
+ fn from(value: NonNegativeInteger) -> Self {
+ value.0
+ }
+}
+impl ::std::convert::From<&NonNegativeInteger> for NonNegativeInteger {
+ fn from(value: &NonNegativeInteger) -> Self {
+ value.clone()
+ }
+}
+impl ::std::convert::From for NonNegativeInteger {
+ fn from(value: u64) -> Self {
+ Self(value)
+ }
+}
+impl ::std::str::FromStr for NonNegativeInteger {
+ type Err = ::Err;
+ fn from_str(value: &str) -> ::std::result::Result {
+ Ok(Self(value.parse()?))
+ }
+}
+impl ::std::convert::TryFrom<&str> for NonNegativeInteger {
+ type Error = ::Err;
+ fn try_from(value: &str) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::convert::TryFrom<&String> for NonNegativeInteger {
+ type Error = ::Err;
+ fn try_from(value: &String) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::convert::TryFrom for NonNegativeInteger {
+ type Error = ::Err;
+ fn try_from(value: String) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::fmt::Display for NonNegativeInteger {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ self.0.fmt(f)
+ }
+}
+#[doc = "NonNegativeIntegerDefault0"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"allOf\": ["]
+#[doc = " {"]
+#[doc = " \"$ref\": \"#/definitions/nonNegativeInteger\""]
+#[doc = " },"]
+#[doc = " {"]
+#[doc = " \"default\": 0"]
+#[doc = " }"]
+#[doc = " ]"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct NonNegativeIntegerDefault0(pub NonNegativeInteger);
+impl ::std::ops::Deref for NonNegativeIntegerDefault0 {
+ type Target = NonNegativeInteger;
+ fn deref(&self) -> &NonNegativeInteger {
+ &self.0
+ }
+}
+impl ::std::convert::From for NonNegativeInteger {
+ fn from(value: NonNegativeIntegerDefault0) -> Self {
+ value.0
+ }
+}
+impl ::std::convert::From<&NonNegativeIntegerDefault0> for NonNegativeIntegerDefault0 {
+ fn from(value: &NonNegativeIntegerDefault0) -> Self {
+ value.clone()
+ }
+}
+impl ::std::convert::From for NonNegativeIntegerDefault0 {
+ fn from(value: NonNegativeInteger) -> Self {
+ Self(value)
}
- impl ::std::convert::TryFrom for super::Node {
- type Error = super::error::ConversionError;
- fn try_from(value: Node) -> ::std::result::Result {
- Ok(Self {
- children: value.children?,
- value: value.value?,
- })
+}
+impl ::std::str::FromStr for NonNegativeIntegerDefault0 {
+ type Err = ::Err;
+ fn from_str(value: &str) -> ::std::result::Result {
+ Ok(Self(value.parse()?))
+ }
+}
+impl ::std::convert::TryFrom<&str> for NonNegativeIntegerDefault0 {
+ type Error = ::Err;
+ fn try_from(value: &str) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::convert::TryFrom<&String> for NonNegativeIntegerDefault0 {
+ type Error = ::Err;
+ fn try_from(value: &String) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::convert::TryFrom for NonNegativeIntegerDefault0 {
+ type Error = ::Err;
+ fn try_from(value: String) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::fmt::Display for NonNegativeIntegerDefault0 {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ self.0.fmt(f)
+ }
+}
+#[doc = "SchemaArray"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"type\": \"array\","]
+#[doc = " \"items\": {"]
+#[doc = " \"$ref\": \"#\""]
+#[doc = " },"]
+#[doc = " \"minItems\": 1"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct SchemaArray(pub ::std::vec::Vec);
+impl ::std::ops::Deref for SchemaArray {
+ type Target = ::std::vec::Vec;
+ fn deref(&self) -> &::std::vec::Vec {
+ &self.0
+ }
+}
+impl ::std::convert::From for ::std::vec::Vec {
+ fn from(value: SchemaArray) -> Self {
+ value.0
+ }
+}
+impl ::std::convert::From<&SchemaArray> for SchemaArray {
+ fn from(value: &SchemaArray) -> Self {
+ value.clone()
+ }
+}
+impl ::std::convert::From<::std::vec::Vec> for SchemaArray {
+ fn from(value: ::std::vec::Vec) -> Self {
+ Self(value)
+ }
+}
+#[doc = "SimpleTypes"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"enum\": ["]
+#[doc = " \"array\","]
+#[doc = " \"boolean\","]
+#[doc = " \"integer\","]
+#[doc = " \"null\","]
+#[doc = " \"number\","]
+#[doc = " \"object\","]
+#[doc = " \"string\""]
+#[doc = " ]"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(
+ :: serde :: Deserialize,
+ :: serde :: Serialize,
+ Clone,
+ Copy,
+ Debug,
+ Eq,
+ Hash,
+ Ord,
+ PartialEq,
+ PartialOrd,
+)]
+pub enum SimpleTypes {
+ #[serde(rename = "array")]
+ Array,
+ #[serde(rename = "boolean")]
+ Boolean,
+ #[serde(rename = "integer")]
+ Integer,
+ #[serde(rename = "null")]
+ Null,
+ #[serde(rename = "number")]
+ Number,
+ #[serde(rename = "object")]
+ Object,
+ #[serde(rename = "string")]
+ String,
+}
+impl ::std::convert::From<&Self> for SimpleTypes {
+ fn from(value: &SimpleTypes) -> Self {
+ value.clone()
+ }
+}
+impl ::std::fmt::Display for SimpleTypes {
+ fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
+ match *self {
+ Self::Array => write!(f, "array"),
+ Self::Boolean => write!(f, "boolean"),
+ Self::Integer => write!(f, "integer"),
+ Self::Null => write!(f, "null"),
+ Self::Number => write!(f, "number"),
+ Self::Object => write!(f, "object"),
+ Self::String => write!(f, "string"),
}
}
- impl ::std::convert::From for Node {
- fn from(value: super::Node) -> Self {
- Self {
- children: Ok(value.children),
- value: Ok(value.value),
- }
+}
+impl ::std::str::FromStr for SimpleTypes {
+ type Err = self::error::ConversionError;
+ fn from_str(value: &str) -> ::std::result::Result {
+ match value {
+ "array" => Ok(Self::Array),
+ "boolean" => Ok(Self::Boolean),
+ "integer" => Ok(Self::Integer),
+ "null" => Ok(Self::Null),
+ "number" => Ok(Self::Number),
+ "object" => Ok(Self::Object),
+ "string" => Ok(Self::String),
+ _ => Err("invalid value".into()),
}
}
}
+impl ::std::convert::TryFrom<&str> for SimpleTypes {
+ type Error = self::error::ConversionError;
+ fn try_from(value: &str) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::convert::TryFrom<&::std::string::String> for SimpleTypes {
+ type Error = self::error::ConversionError;
+ fn try_from(
+ value: &::std::string::String,
+ ) -> ::std::result::Result {
+ value.parse()
+ }
+}
+impl ::std::convert::TryFrom<::std::string::String> for SimpleTypes {
+ type Error = self::error::ConversionError;
+ fn try_from(
+ value: ::std::string::String,
+ ) -> ::std::result::Result {
+ value.parse()
+ }
+}
+#[doc = "StringArray"]
+#[doc = r""]
+#[doc = r" JSON schema
"]
+#[doc = r""]
+#[doc = r" ```json"]
+#[doc = "{"]
+#[doc = " \"default\": [],"]
+#[doc = " \"type\": \"array\","]
+#[doc = " \"items\": {"]
+#[doc = " \"type\": \"string\""]
+#[doc = " },"]
+#[doc = " \"uniqueItems\": true"]
+#[doc = "}"]
+#[doc = r" ```"]
+#[doc = r" "]
+#[derive(:: serde :: Deserialize, :: serde :: Serialize, Clone, Debug)]
+#[serde(transparent)]
+pub struct StringArray(pub Vec<::std::string::String>);
+impl ::std::ops::Deref for StringArray {
+ type Target = Vec<::std::string::String>;
+ fn deref(&self) -> &Vec<::std::string::String> {
+ &self.0
+ }
+}
+impl ::std::convert::From for Vec<::std::string::String> {
+ fn from(value: StringArray) -> Self {
+ value.0
+ }
+}
+impl ::std::convert::From<&StringArray> for StringArray {
+ fn from(value: &StringArray) -> Self {
+ value.clone()
+ }
+}
+impl ::std::convert::From> for StringArray {
+ fn from(value: Vec<::std::string::String>) -> Self {
+ Self(value)
+ }
+}
+#[doc = r" Generation of default values for serde."]
+pub mod defaults {
+ pub(super) fn default_bool() -> bool {
+ V
+ }
+ pub(super) fn core_schema_meta_schema_object_items() -> super::CoreSchemaMetaSchemaObjectItems {
+ super::CoreSchemaMetaSchemaObjectItems::Variant0(::std::boxed::Box::new(
+ super::CoreSchemaMetaSchema::Boolean(true),
+ ))
+ }
+}
fn main() {}