mirror of https://github.com/MingweiSamuel/Riven
59 lines
1.7 KiB
Plaintext
59 lines
1.7 KiB
Plaintext
{{
|
|
const spec = require('./.spec.json');
|
|
const dotUtils = require('./dotUtils.js');
|
|
}}
|
|
// This file is automatically generated.
|
|
// Do not directly edit.
|
|
// Generated on {{= (new Date).toISOString() }}
|
|
|
|
// http://www.mingweisamuel.com/riotapi-schema/tool/
|
|
// Version {{= spec.info.version }}
|
|
|
|
{{
|
|
let schemas = spec.components.schemas;
|
|
let schemaKeyByEndpoint = Object.keys(schemas)
|
|
.filter(schemaKey => 'Error' != schemaKey)
|
|
.groupBy(schemaKey => schemaKey.split('.')[0]);
|
|
|
|
for (let [endpoint, schemaKeyGroup] of schemaKeyByEndpoint) {
|
|
}}
|
|
// {{= endpoint }}
|
|
#[allow(dead_code)]
|
|
pub mod {{= dotUtils.changeCase.snakeCase(endpoint) }} {
|
|
{{
|
|
for (let schemaKey of schemaKeyGroup) {
|
|
let [endpoint, rawSchemaName] = schemaKey.split('.');
|
|
let schemaName = dotUtils.normalizeSchemaName(rawSchemaName);
|
|
let schema = schemas[schemaKey];
|
|
let props = schema.properties;
|
|
}}
|
|
/// {{= schemaName }} data object. This struct is automatically generated.
|
|
{{? schema.description }}
|
|
/// # Description
|
|
/// {{= schema.description }}
|
|
{{?}}
|
|
#[derive(Debug)]
|
|
#[derive(serde::Serialize, serde::Deserialize)]
|
|
pub struct {{= schemaName }} {
|
|
{{
|
|
for (let [ propKey, prop ] of Object.entries(props))
|
|
{
|
|
let name = dotUtils.normalizePropName(propKey, schemaName, prop);
|
|
}}
|
|
{{? prop.description }}
|
|
/// {{= prop.description.split('\n').map(x => x.trim()).join(' \r\n /// ') }}
|
|
{{?}}
|
|
{{= dotUtils.formatJsonProperty(propKey) }}
|
|
pub {{= name }}: {{= dotUtils.stringifyType(prop) }},
|
|
{{
|
|
}
|
|
}}
|
|
}
|
|
{{
|
|
}
|
|
}}
|
|
}
|
|
|
|
{{
|
|
}
|
|
}} |