Add JSON Schema support (#3046)
## Summary This PR adds JSON Schema support. The setup mirrors Ruff's own.
This commit is contained in:
@@ -41,6 +41,17 @@ impl FromStr for PythonVersion {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "schemars")]
|
||||
impl schemars::JsonSchema for PythonVersion {
|
||||
fn schema_name() -> String {
|
||||
String::from("PythonVersion")
|
||||
}
|
||||
|
||||
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
|
||||
<String>::json_schema(gen)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
impl<'de> serde::Deserialize<'de> for PythonVersion {
|
||||
fn deserialize<D: serde::Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
|
||||
Reference in New Issue
Block a user