Default `#[schemars(deny_unknown_fields)] for json-language-server schemas (#33883)

Followup to #33678, doing the same thing for all JSON Schema files
provided to json-language-server

Release Notes:

* Added warnings for unknown fields when editing `tasks.json` /
`snippets.json`.
This commit is contained in:
Michael Sloan
2025-07-04 00:57:43 +00:00
committed by GitHub
parent 38544e514a
commit ed7552d3e3
14 changed files with 136 additions and 149 deletions
+2
View File
@@ -4,6 +4,7 @@ use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use std::path::PathBuf;
use util::schemars::DefaultDenyUnknownFields;
use util::serde::default_true;
use util::{ResultExt, truncate_and_remove_front};
@@ -116,6 +117,7 @@ impl TaskTemplates {
/// Generates JSON schema of Tasks JSON template format.
pub fn generate_json_schema() -> serde_json_lenient::Value {
let schema = schemars::generate::SchemaSettings::draft2019_09()
.with_transform(DefaultDenyUnknownFields)
.into_generator()
.root_schema_for::<Self>();