Skip to main content

k8s_openapi/v1_36/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(std::vec::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() -> std::borrow::Cow<'static, str> {
24        "io.k8s.apimachinery.pkg.apis.meta.v1.Patch".into()
25    }
26
27    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
28        crate::schemars::json_schema!({
29            "description": "Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.",
30            "type": "object",
31        })
32    }
33}
34
35#[cfg(feature = "schemars08")]
36impl crate::schemars08::JsonSchema for Patch {
37    fn schema_name() -> std::string::String {
38        "io.k8s.apimachinery.pkg.apis.meta.v1.Patch".into()
39    }
40
41    fn json_schema(__gen: &mut crate::schemars08::gen::SchemaGenerator) -> crate::schemars08::schema::Schema {
42        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
43            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
44                description: Some("Patch is provided to give a concrete name and type to the Kubernetes PATCH request body.".into()),
45                ..Default::default()
46            })),
47            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
48            ..Default::default()
49        })
50    }
51}