k8s_openapi/v1_30/apimachinery/pkg/apis/meta/v1/
patch.rs

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