Skip to content

Commit 2dd38cf

Browse files
authored
fix(schema): domains and feature kind (#8147)
1 parent 1fbdff5 commit 2dd38cf

File tree

7 files changed

+13
-29
lines changed

7 files changed

+13
-29
lines changed

crates/biome_configuration/src/analyzer/linter/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ impl schemars::JsonSchema for RuleDomains {
7474
schemars::json_schema!({
7575
"type": "object",
7676
"propertyNames": {
77-
"$ref": "#/components/schemas/RuleDomain"
77+
"$ref": "#/$defs/RuleDomain"
7878
},
7979
"additionalProperties": {
80-
"$ref": "#/components/schemas/RuleDomainValue"
80+
"$ref": "#/$defs/RuleDomainValue"
8181
}
8282
})
8383
}

crates/biome_service/src/workspace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,10 +434,10 @@ impl schemars::JsonSchema for FeaturesSupported {
434434
schemars::json_schema!({
435435
"type": "object",
436436
"propertyNames": {
437-
"$ref": "#/components/schemas/FeatureKind"
437+
"$ref": "#/$defs/FeatureKind"
438438
},
439439
"additionalProperties": {
440-
"$ref": "#/components/schemas/SupportKind"
440+
"$ref": "#/$defs/SupportKind"
441441
}
442442
})
443443
}

crates/biome_service/src/workspace_types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,8 @@ impl WorkspaceMethod {
727727
P: JsonSchema,
728728
R: JsonSchema,
729729
{
730-
let params = SchemaGenerator::from(SchemaSettings::openapi3()).root_schema_for::<P>();
731-
let result = SchemaGenerator::from(SchemaSettings::openapi3()).root_schema_for::<R>();
730+
let params = SchemaGenerator::from(SchemaSettings::draft2019_09()).root_schema_for::<P>();
731+
let result = SchemaGenerator::from(SchemaSettings::draft2019_09()).root_schema_for::<R>();
732732
Self {
733733
name,
734734
params,

crates/biome_wasm/build.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use biome_js_formatter::{context::JsFormatOptions, format_node};
77
use biome_rowan::AstNode;
88
use biome_service::workspace_types::{ModuleQueue, generate_type, methods};
99
use quote::{format_ident, quote};
10-
use schemars::generate::{SchemaGenerator, SchemaSettings};
1110
use std::{env, fs, io, path::PathBuf};
1211

1312
fn main() -> io::Result<()> {
@@ -21,11 +20,6 @@ fn main() -> io::Result<()> {
2120
generate_type(&mut items, &mut queue, &method.params);
2221
generate_type(&mut items, &mut queue, &method.result);
2322
}
24-
// HACK: SupportKind doesn't get picked up in the loop above, so we add it manually
25-
let support_kind_schema = SchemaGenerator::from(SchemaSettings::openapi3())
26-
.root_schema_for::<biome_service::workspace::SupportKind>();
27-
28-
generate_type(&mut items, &mut queue, &support_kind_schema);
2923

3024
let module = make::js_module(
3125
make::js_directive_list(None),

justfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,16 @@ gen-all:
2727

2828
# Generates TypeScript types and JSON schema of the configuration
2929
gen-bindings:
30-
cargo codegen-schema
30+
just gen-schema
3131
just gen-types
3232

33+
# Generates TypeScript types
3334
gen-types:
3435
cargo run -p xtask_codegen --features schema -- bindings
3536

37+
# Generates the JSON Schema of the configuration
38+
gen-schema:
39+
cargo codegen-schema
3640

3741
# Generates code generated files for the linter
3842
gen-analyzer:

packages/@biomejs/biome/configuration_schema.json

Lines changed: 2 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

xtask/codegen/src/generate_bindings.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use biome_js_syntax::{
1010
use biome_rowan::AstNode;
1111
use biome_service::workspace_types::{ModuleQueue, generate_type, methods};
1212
use biome_string_case::Case;
13-
use schemars::{SchemaGenerator, generate::SchemaSettings};
1413
use xtask_codegen::update;
1514
use xtask_glue::{Mode, Result, project_root};
1615

@@ -154,17 +153,6 @@ pub(crate) fn generate_workspace_bindings(mode: Mode) -> Result<()> {
154153
.build(),
155154
));
156155
}
157-
// HACK: these types doesn't get picked up in the loop above, so we add it manually
158-
let support_kind_schema = SchemaGenerator::from(SchemaSettings::openapi3())
159-
.root_schema_for::<biome_service::workspace::SupportKind>();
160-
generate_type(&mut declarations, &mut queue, &support_kind_schema);
161-
let rule_domain_schema = SchemaGenerator::from(SchemaSettings::openapi3())
162-
.root_schema_for::<biome_analyze::RuleDomain>();
163-
generate_type(&mut declarations, &mut queue, &rule_domain_schema);
164-
let rule_domain_value_schema = SchemaGenerator::from(SchemaSettings::openapi3())
165-
.root_schema_for::<biome_configuration::analyzer::RuleDomainValue>(
166-
);
167-
generate_type(&mut declarations, &mut queue, &rule_domain_value_schema);
168156

169157
let leading_comment = [
170158
(

0 commit comments

Comments
 (0)