mas_config/schema.rs
1// Copyright 2024, 2025 New Vector Ltd.
2// Copyright 2022-2024 The Matrix.org Foundation C.I.C.
3//
4// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5// Please see LICENSE files in the repository root for full details.
6
7//! Useful JSON Schema definitions
8
9use std::borrow::Cow;
10
11use schemars::{JsonSchema, Schema, SchemaGenerator, json_schema};
12
13/// A network hostname
14pub struct Hostname;
15
16impl JsonSchema for Hostname {
17 fn schema_name() -> Cow<'static, str> {
18 Cow::Borrowed("Hostname")
19 }
20
21 fn json_schema(_generator: &mut SchemaGenerator) -> Schema {
22 json_schema!({
23 "type": "string",
24 "format": "hostname",
25 })
26 }
27}