|
7 | 7 |
|
8 | 8 | use std::collections::{BTreeMap, HashMap}; |
9 | 9 |
|
10 | | -use schemars::{JsonSchema, Schema, json_schema}; |
| 10 | +use schemars::JsonSchema; |
11 | 11 | use serde::{Deserialize, Serialize}; |
12 | 12 | use snafu::{ResultExt, Snafu}; |
13 | 13 |
|
14 | | -/// Generates a JSON schema that accepts any JSON value. |
15 | | -/// |
16 | | -/// Kubernetes CRDs do not support the `true` schema shorthand that |
17 | | -/// `serde_json::Value` generates by default. Instead we emit a schema |
18 | | -/// with `x-kubernetes-preserve-unknown-fields: true` which tells the |
19 | | -/// API server to store the value as-is. |
20 | | -fn arbitrary_json_value(_gen: &mut schemars::generate::SchemaGenerator) -> Schema { |
21 | | - json_schema!({ |
22 | | - "x-kubernetes-preserve-unknown-fields": true, |
23 | | - }) |
24 | | -} |
25 | | - |
26 | | -/// Generates a JSON schema for a list of JSON patch operation strings (RFC 6902). |
27 | | -fn json_patch_string_list(_gen: &mut schemars::generate::SchemaGenerator) -> Schema { |
28 | | - json_schema!({ |
29 | | - "type": "array", |
30 | | - "items": { |
31 | | - "type": "string", |
32 | | - }, |
33 | | - }) |
34 | | -} |
| 14 | +use crate::utils::crds::arbitrary_json_value; |
35 | 15 |
|
36 | 16 | #[derive(Debug, Snafu)] |
37 | 17 | pub enum Error { |
@@ -122,7 +102,6 @@ pub enum JsonConfigOverrides { |
122 | 102 | /// or |
123 | 103 | /// |
124 | 104 | /// `{"op": "add", "path": "/0/happy", "value": true}` |
125 | | - #[schemars(schema_with = "json_patch_string_list")] |
126 | 105 | JsonPatches(Vec<String>), |
127 | 106 |
|
128 | 107 | /// Override the entire config file with the specified String. |
|
0 commit comments