diff --git a/crates/cargo-util-schemas/manifest.schema.json b/crates/cargo-util-schemas/manifest.schema.json index 37f84f4f7..8fe710d5d 100644 --- a/crates/cargo-util-schemas/manifest.schema.json +++ b/crates/cargo-util-schemas/manifest.schema.json @@ -621,40 +621,7 @@ } ] }, - "TomlValue": { - "type": "object", - "properties": { - "string": { - "type": "string" - }, - "integer": { - "type": "integer", - "format": "int64" - }, - "float": { - "type": "number", - "format": "double" - }, - "boolean": { - "type": "boolean" - }, - "datetime": { - "type": "string" - }, - "array": { - "type": "array", - "items": { - "$ref": "#/definitions/TomlValue" - } - }, - "table": { - "type": "object", - "additionalProperties": { - "$ref": "#/definitions/TomlValue" - } - } - } - }, + "TomlValue": true, "TomlTarget": { "type": "object", "properties": { diff --git a/crates/cargo-util-schemas/src/schema.rs b/crates/cargo-util-schemas/src/schema.rs index f9ce16baa..400997d2b 100644 --- a/crates/cargo-util-schemas/src/schema.rs +++ b/crates/cargo-util-schemas/src/schema.rs @@ -2,7 +2,6 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; use std::string::String; use toml::Value as TomlValue; @@ -16,39 +15,7 @@ impl JsonSchema for TomlValueWrapper { } fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - use schemars::schema::*; - - SchemaObject { - instance_type: Some(InstanceType::Object.into()), - object: Some(Box::new(ObjectValidation { - properties: [ - ( - "string".to_string(), - gen.subschema_for::(), - ), - ("integer".to_string(), gen.subschema_for::()), - ("float".to_string(), gen.subschema_for::()), - ("boolean".to_string(), gen.subschema_for::()), - ( - "datetime".to_string(), - gen.subschema_for::(), - ), // Assuming datetime is represented as a string - ( - "array".to_string(), - gen.subschema_for::>(), - ), - ( - "table".to_string(), - gen.subschema_for::>(), - ), - ] - .iter() - .cloned() - .collect(), - ..Default::default() - })), - ..Default::default() - } - .into() + // HACK: this is both more and less permissive than `TomlValue` but its close + gen.subschema_for::().into() } }