1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::collections::BTreeMap;

use serde::Deserialize;

use crate::{Attribute, EnumSpec, MetaSpec, ParamSpec, StringOrArray, TypeSpec};

/// Definition of a type or file format
#[derive(Deserialize, Debug)]
#[serde(rename_all = "kebab-case")]
pub struct KsySchema {
    /// Metadata
    pub meta: MetaSpec,
    /// Used to give a more detailed description of a user-defined type.
    #[serde(default)]
    pub doc: Option<String>,
    /// Reference to external documentation
    #[serde(default)]
    pub doc_ref: Option<StringOrArray>,
    /// Generic Parameters
    #[serde(default)]
    pub params: Vec<ParamSpec>,
    /// The sequence of attributes
    #[serde(default)]
    pub seq: Vec<Attribute>,
    /// Named, dynamic attributes
    #[serde(default)]
    pub instances: BTreeMap<String, Attribute>,
    /// A sequence of internal types
    #[serde(default)]
    pub types: BTreeMap<String, TypeSpec>,
    /// Enums defined by this schema
    #[serde(default)]
    pub enums: BTreeMap<String, EnumSpec>,
}