Warn about unknown fields when editing settings json (#33678)
Closes #30017 * While generating the settings JSON schema, defaults all schema definitions to reject unknown fields via `additionalProperties: false`. * Uses `unevaluatedProperties: false` at the top level to check fields that remain after the settings field names + release stage override field names. * Changes json schema version from `draft07` to `draft_2019_09` to have support for `unevaluatedProperties`. Release Notes: - Added warnings for unknown fields when editing `settings.json`.
This commit is contained in:
parent
7609ca7a8d
commit
c74ecb4654
14 changed files with 86 additions and 40 deletions
|
@ -287,7 +287,7 @@ pub struct DebugTaskFile(pub Vec<DebugScenario>);
|
|||
|
||||
impl DebugTaskFile {
|
||||
pub fn generate_json_schema(schemas: &AdapterSchemas) -> serde_json_lenient::Value {
|
||||
let mut generator = schemars::generate::SchemaSettings::draft07().into_generator();
|
||||
let mut generator = schemars::generate::SchemaSettings::draft2019_09().into_generator();
|
||||
let build_task_schema = generator.root_schema_for::<BuildTaskDefinition>();
|
||||
let mut build_task_value =
|
||||
serde_json_lenient::to_value(&build_task_schema).unwrap_or_default();
|
||||
|
|
|
@ -115,7 +115,7 @@ pub struct TaskTemplates(pub Vec<TaskTemplate>);
|
|||
impl TaskTemplates {
|
||||
/// Generates JSON schema of Tasks JSON template format.
|
||||
pub fn generate_json_schema() -> serde_json_lenient::Value {
|
||||
let schema = schemars::generate::SchemaSettings::draft07()
|
||||
let schema = schemars::generate::SchemaSettings::draft2019_09()
|
||||
.into_generator()
|
||||
.root_schema_for::<Self>();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue