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
3 changes: 2 additions & 1 deletion hk.pkl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ fi
}
["schema"] {
glob = List("schema/**/*.json")
check = "ajv compile -s schema/mise.json --spec=draft2019 --strict-schema=true && ajv compile -s schema/mise-task.json --spec=draft2019 --strict-schema=true && ajv compile -s schema/mise.plugin.json --spec=draft2020 --strict-schema=true && ajv compile -s schema/mise-registry-tool.json --spec=draft7 --strict-schema=true"
stdin = "{{ files_list | join(sep='\u{0}') }}"
check = "xargs -0 -I {} ajv compile -s {} --spec=draft2020 --strict-types=true --strict-tuples=true"
}
}

Expand Down
6 changes: 3 additions & 3 deletions schema/mise-registry-tool.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://mise.en.dev/schema/mise-registry-tool.json",
"title": "mise registry tool schema",
"description": "Schema for individual tool files in the mise registry",
Expand Down Expand Up @@ -56,13 +56,13 @@
"type": "object",
"description": "Platform-specific configuration",
"additionalProperties": {
"type": ["string", "boolean"]
"oneOf": [{ "type": "string" }, { "type": "boolean" }]
}
}
}
},
"additionalProperties": {
"type": ["string", "boolean"]
"oneOf": [{ "type": "string" }, { "type": "boolean" }]
}
}
},
Expand Down
14 changes: 10 additions & 4 deletions schema/mise-settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://mise.en.dev/schema/mise-settings.json",
"title": "Mise Settings Schema",
"description": "JSON schema for mise settings.toml configuration file",
Expand Down Expand Up @@ -84,9 +84,15 @@
"properties": {
"value": {
"oneOf": [
{ "type": "string" },
{ "type": "boolean" },
{ "type": "integer" }
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "integer"
}
],
"description": "The enum value"
},
Expand Down
2 changes: 1 addition & 1 deletion schema/mise-task.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$id": "https://mise.en.dev/schema/mise-task.json",
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "mise-task-schema",
"type": "object",
"$defs": {
Expand Down
13 changes: 10 additions & 3 deletions schema/mise.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$id": "https://mise.en.dev/schema/mise.json",
"$schema": "https://json-schema.org/draft/2019-09/schema#",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "mise",
"type": "object",
"$defs": {
Expand Down Expand Up @@ -1324,8 +1324,15 @@
"uv_venv_auto": {
"default": false,
"description": "Integrate with uv to manage project venvs when uv.lock is present.",
"type": ["boolean", "string"],
"enum": [false, "source", "create|source", true]
"enum": [false, "source", "create|source", true],
"oneOf": [
{
"type": "boolean"
},
{
"type": "string"
}
]
},
"uv_venv_create_args": {
"description": "Arguments to pass to uv when creating a venv.",
Expand Down
12 changes: 11 additions & 1 deletion xtasks/render/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function buildElement(key: string, props: Props): Element {
ListPath: "string[]",
SetString: "string[]",
"IndexMap<String, String>": "object",
BoolOrString: ["boolean", "string"],
BoolOrString: "__bool_or_string__",
};
const type = props.type ? typeMap[props.type] : undefined;
if (!type) {
Expand Down Expand Up @@ -93,6 +93,16 @@ function buildElement(key: string, props: Props): Element {
};
}

// BoolOrString: use oneOf instead of union type array for AJV strictTypes
if (type === "__bool_or_string__") {
delete (element as Record<string, unknown>).type;
const oneOfTypes: Array<{ type: string }> = [
{ type: "boolean" },
{ type: "string" },
];
(element as Record<string, unknown>).oneOf = oneOfTypes;
Comment thread
risu729 marked this conversation as resolved.
}

return element;
}

Expand Down
Loading