torn-api-codegen 0.8.1

Contains the v2 torn API model descriptions and codegen for the bindings
Documentation
use indexmap::IndexMap;
use serde::Deserialize;

use super::{parameter::OpenApiParameter, path::OpenApiPath, r#type::OpenApiType};

#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
pub struct Components<'a> {
    #[serde(borrow)]
    pub schemas: IndexMap<&'a str, OpenApiType<'a>>,
    #[serde(borrow)]
    pub parameters: IndexMap<&'a str, OpenApiParameter<'a>>,
}

#[derive(Debug, Clone, Deserialize, PartialEq, Eq)]
pub struct OpenApiSchema<'a> {
    #[serde(borrow)]
    pub paths: IndexMap<&'a str, OpenApiPath<'a>>,
    #[serde(borrow)]
    pub components: Components<'a>,
}

#[cfg(test)]
pub(crate) mod test {
    use super::*;

    pub(crate) fn get_schema() -> OpenApiSchema<'static> {
        let s = include_str!("../../../torn-api/openapi.json");
        serde_json::from_str(s).unwrap()
    }
}