Fix more instances of JSON schema getting clobbered when attaching references (#15339)

This PR extends the fix from #15336 to more places that had the same
issue.

An `add_references_to_properties` helper function has been added to
handle these cases uniformly.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers
2024-07-27 11:44:40 -04:00
committed by GitHub
parent 8b22f09b6f
commit 1ffb34c5fc
7 changed files with 65 additions and 54 deletions
+5 -11
View File
@@ -16,7 +16,7 @@ use serde::{
Deserialize, Deserializer, Serialize,
};
use serde_json::Value;
use settings::{Settings, SettingsLocation, SettingsSources};
use settings::{add_references_to_properties, Settings, SettingsLocation, SettingsSources};
use std::{num::NonZeroU32, path::Path, sync::Arc};
use util::serde::default_true;
@@ -1009,16 +1009,10 @@ impl settings::Settings for AllLanguageSettings {
.definitions
.extend([("Languages".into(), languages_object_schema.into())]);
root_schema
.schema
.object
.as_mut()
.unwrap()
.properties
.extend([(
"languages".to_owned(),
Schema::new_ref("#/definitions/Languages".into()),
)]);
add_references_to_properties(
&mut root_schema,
&[("languages", "#/definitions/Languages")],
);
root_schema
}