Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions tasks/website/src/linter/json_schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,36 @@ impl Renderer {
})
.collect::<Vec<Section>>();
}
if let Some(schemas) = &subschemas.any_of {
// For anyOf, render as a union type description
let type_descriptions: Vec<String> = schemas
.iter()
.filter_map(|subschema| {
let subschema = Self::get_schema_object(subschema);
let subschema = self.get_referenced_schema(subschema);
subschema
.instance_type
.as_ref()
.map(|t| serde_json::to_string(t).unwrap().replace('"', ""))
})
.collect();

if !type_descriptions.is_empty() {
let union_type = type_descriptions.join(" | ");
return vec![Section {
level: "#".repeat(depth),
title: key.into(),
instance_type: Some(union_type),
default: Self::render_default(schema),
description: schema
.metadata
.as_ref()
.and_then(|m| m.description.clone())
.unwrap_or_default(),
sections: vec![],
}];
}
}
vec![]
}

Expand All @@ -212,6 +242,14 @@ impl Renderer {
let ref_schema = schema;
let schema = self.get_referenced_schema(schema);

// Handle subschemas (anyOf, allOf, etc.) at the top level
if let Some(subschemas) = &schema.subschemas {
let subsections = self.render_sub_schema(depth, key, subschemas, schema);
if !subsections.is_empty() {
return subsections.into_iter().next().unwrap();
}
}

let (instance_type, sections) = if let Some(item) = as_primitive_array(schema) {
// e.g. "string[]" instead of "array"
let instance_type = serde_json::to_string_pretty(item.instance_type.as_ref().unwrap())
Expand Down
43 changes: 43 additions & 0 deletions tasks/website/src/linter/snapshots/schema_markdown.snap
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ type: `object`



### overrides[n].env

type: `object | null`


Environments enable and disable collections of global variables.


#### overrides[n].files

type: `string[]`
Expand All @@ -231,6 +239,14 @@ type: `string[]`
A set of glob patterns.


### overrides[n].globals

type: `object | null`


Enabled or disabled specific global variables.


#### overrides[n].jsPlugins

type: `string[]`
Expand All @@ -242,6 +258,16 @@ Note: JS plugins are experimental and not subject to semver.
They are not supported in language server at present.


### overrides[n].plugins

type: `array | null`

default: `null`

Optionally change what plugins are enabled for this override. When
omitted, the base config's plugins are used.


#### overrides[n].rules

type: `object`
Expand All @@ -250,6 +276,20 @@ type: `object`
See [Oxlint Rules](https://oxc.rs/docs/guide/usage/linter/rules.html)


# plugins

type: `array | null`

default: `null`

Enabled built-in plugins for Oxlint.
You can view the list of available plugins on
[the website](https://oxc.rs/docs/guide/usage/linter/plugins.html#supported-plugins).

NOTE: Setting the `plugins` field will overwrite the base set of plugins.
The `plugins` array should reflect all of the plugins you want to use.


## rules

type: `object`
Expand Down Expand Up @@ -465,6 +505,7 @@ Configure Next.js plugin rules.

#### settings.next.rootDir

type: `string | array`



Expand Down Expand Up @@ -509,6 +550,7 @@ Example:

##### settings.react.formComponents[n]

type: `string | object | object`



Expand Down Expand Up @@ -544,6 +586,7 @@ Example:

##### settings.react.linkComponents[n]

type: `string | object | object`



Expand Down
Loading