1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Improve the configuration schema

This commit is contained in:
Quentin Gliech
2022-01-28 11:49:15 +01:00
parent 2db595b9c0
commit 05f0756c13
12 changed files with 272 additions and 45 deletions

View File

@ -14,7 +14,7 @@
use clap::Parser;
use mas_config::{ConfigurationSection, RootConfig};
use schemars::schema_for;
use schemars::gen::SchemaSettings;
use tracing::info;
use super::RootCommand;
@ -52,7 +52,12 @@ impl ConfigCommand {
Ok(())
}
SC::Schema => {
let schema = schema_for!(RootConfig);
let settings = SchemaSettings::draft07().with(|s| {
s.option_nullable = false;
s.option_add_null_type = false;
});
let gen = settings.into_generator();
let schema = gen.into_root_schema_for::<RootConfig>();
serde_yaml::to_writer(std::io::stdout(), &schema)?;