Skip to content

Commit

Permalink
chore: fix JSON schema for biome config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Conaclos committed Jun 7, 2024
1 parent 74074fa commit 1e28dc3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
21 changes: 10 additions & 11 deletions packages/@biomejs/biome/configuration_schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions xtask/codegen/src/generate_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ fn rename_partial_references_in_schema(mut schema: RootSchema) -> RootSchema {
meta.title = Some(stripped.to_string());
} else if title == "RuleWithOptions_for_Null" {
meta.title = Some("RuleWithNoOptions".to_string());
} else if title == "RuleWithFixOptions_for_Null" {
meta.title = Some("RuleWithFixNoOptions".to_string());
} else if title == "RuleConfiguration_for_Null" {
meta.title = Some("RuleConfiguration".to_string());
} else if let Some(stripped) = title.strip_prefix("RuleWithOptions_for_") {
Expand All @@ -57,8 +59,12 @@ fn rename_partial_references_in_schema(mut schema: RootSchema) -> RootSchema {
.map(|(mut key, mut schema)| {
if let Some(stripped) = key.strip_prefix("Partial") {
key = stripped.to_string();
} else if key == "RuleWithOptions_for_Null" {
key = "RuleWithNoOptions".to_string();
} else if key == "RuleWithOptions_for_Null" || key == "RuleWithFixOptions_for_Null" {
key = if key == "RuleWithOptions_for_Null" {
"RuleWithNoOptions".to_string()
} else {
"RuleWithFixNoOptions".to_string()
};
if let Schema::Object(schema_object) = &mut schema {
if let Some(object) = &mut schema_object.object {
object.required.remove("options");
Expand Down Expand Up @@ -101,6 +107,8 @@ fn rename_partial_references_in_schema_object(object: &mut SchemaObject) {
*reference = format!("#/definitions/{stripped}");
} else if reference == "#/definitions/RuleWithOptions_for_Null" {
*reference = "#/definitions/RuleWithNoOptions".to_string();
} else if reference == "#/definitions/RuleWithFixOptions_for_Null" {
*reference = "#/definitions/RuleWithFixNoOptions".to_string();
} else if reference == "#/definitions/RuleConfiguration_for_Null" {
*reference = "#/definitions/RuleConfiguration".to_string();
} else if let Some(stripped) = reference.strip_prefix("#/definitions/RuleWithOptions_for_")
Expand Down

0 comments on commit 1e28dc3

Please sign in to comment.