mirror of
https://github.com/starship/starship.git
synced 2024-11-29 19:53:38 +01:00
implement schemars::JsonSchema for StarshipConditionalStyleConfig
thanks for your help david!
This commit is contained in:
parent
1cf8aef297
commit
7a0db3c1fb
17
.github/config-schema.json
vendored
17
.github/config-schema.json
vendored
@ -2259,7 +2259,7 @@
|
||||
],
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/Either_for_StarshipConditionalStyleConfig_and_Array_of_StarshipConditionalStyleConfig"
|
||||
"$ref": "#/definitions/Either_for_Either_for_String_and_StarshipConditionalStyle_and_Array_of_Either_for_String_and_StarshipConditionalStyle"
|
||||
}
|
||||
]
|
||||
},
|
||||
@ -2296,21 +2296,28 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"Either_for_StarshipConditionalStyleConfig_and_Array_of_StarshipConditionalStyleConfig": {
|
||||
"Either_for_Either_for_String_and_StarshipConditionalStyle_and_Array_of_Either_for_String_and_StarshipConditionalStyle": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/StarshipConditionalStyleConfig"
|
||||
"$ref": "#/definitions/Either_for_String_and_StarshipConditionalStyle"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/StarshipConditionalStyleConfig"
|
||||
"$ref": "#/definitions/Either_for_String_and_StarshipConditionalStyle"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"StarshipConditionalStyleConfig": {
|
||||
"Either_for_String_and_StarshipConditionalStyle": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/StarshipConditionalStyle"
|
||||
}
|
||||
]
|
||||
},
|
||||
"StarshipConditionalStyle": {
|
||||
"type": "object",
|
||||
|
@ -77,9 +77,23 @@ impl<'a> StarshipConditionalStyle<'a> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, PartialEq)]
|
||||
#[cfg_attr(feature = "config-schema", derive(schemars::JsonSchema))]
|
||||
pub struct StarshipConditionalStyleConfig<'a>(StarshipConditionalStyle<'a>);
|
||||
|
||||
#[cfg(feature = "config-schema")]
|
||||
impl<'a> schemars::JsonSchema for StarshipConditionalStyleConfig<'a> {
|
||||
fn schema_name() -> String {
|
||||
Either::<String, StarshipConditionalStyle>::schema_name()
|
||||
}
|
||||
|
||||
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
|
||||
Either::<String, StarshipConditionalStyle>::json_schema(gen)
|
||||
}
|
||||
|
||||
fn is_referenceable() -> bool {
|
||||
Either::<String, StarshipConditionalStyle>::is_referenceable()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de: 'a, 'a> Deserialize<'de> for StarshipConditionalStyleConfig<'a> {
|
||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user