1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#[derive(Clone, Debug, PartialEq)]
pub enum Patch {
Json(Vec<crate::serde_json::Value>),
Merge(crate::serde_json::Value),
StrategicMerge(crate::serde_json::Value),
}
impl crate::serde::Serialize for Patch {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
match self {
Patch::Json(patch) => serializer.serialize_newtype_struct("Patch", patch),
Patch::Merge(patch) |
Patch::StrategicMerge(patch) => serializer.serialize_newtype_struct("Patch", patch),
}
}
}
#[cfg(feature = "schemars")]
impl crate::schemars::JsonSchema for Patch {
fn schema_name() -> String {
"io.k8s.apimachinery.pkg.apis.meta.v1.Patch".to_owned()
}
fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema {
crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
metadata: Some(Box::new(crate::schemars::schema::Metadata {
description: Some("Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.".to_owned()),
..Default::default()
})),
instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))),
..Default::default()
})
}
}