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:
parent
38544e514a
commit
ed7552d3e3
14 changed files with 136 additions and 149 deletions
|
@ -3,6 +3,7 @@ use schemars::{JsonSchema, json_schema};
|
|||
use serde::Deserialize;
|
||||
use serde_json_lenient::Value;
|
||||
use std::borrow::Cow;
|
||||
use util::schemars::DefaultDenyUnknownFields;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct VsSnippetsFile {
|
||||
|
@ -13,6 +14,7 @@ pub struct VsSnippetsFile {
|
|||
impl VsSnippetsFile {
|
||||
pub fn generate_json_schema() -> Value {
|
||||
let schema = schemars::generate::SchemaSettings::draft2019_09()
|
||||
.with_transform(DefaultDenyUnknownFields)
|
||||
.into_generator()
|
||||
.root_schema_for::<Self>();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue