Skip to content

Commit 68dc317

Browse files
committed
fix: Use String for Host JsonSchema
1 parent be75dc2 commit 68dc317

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

crates/stackable-operator/src/commons/networking.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,23 @@ impl Deref for Hostname {
5050
}
5151

5252
/// A validated host (either a [`Hostname`] or IP address) type.
53-
#[derive(
54-
Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd, JsonSchema,
55-
)]
53+
#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
5654
#[serde(try_from = "String", into = "String")]
5755
pub enum Host {
5856
IpAddress(IpAddr),
5957
Hostname(Hostname),
6058
}
6159

60+
impl JsonSchema for Host {
61+
fn schema_name() -> String {
62+
"Host".to_owned()
63+
}
64+
65+
fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema {
66+
String::json_schema(gen)
67+
}
68+
}
69+
6270
impl FromStr for Host {
6371
type Err = validation::Error;
6472

0 commit comments

Comments
 (0)