Skip to content

fix(schema): validate all schema files with draft2020 and strict mode#9594

Merged
jdx merged 2 commits intojdx:mainfrom
risu729:fix/schema-validation
May 4, 2026
Merged

fix(schema): validate all schema files with draft2020 and strict mode#9594
jdx merged 2 commits intojdx:mainfrom
risu729:fix/schema-validation

Conversation

@risu729
Copy link
Copy Markdown
Contributor

@risu729 risu729 commented May 4, 2026

Summary

  • Validate all schema/ files — previously only a hardcoded subset was validated; now the hk check iterates over all schema/**/*.json files
  • Use draft2020 for all schemas — previously mixed draft-07 (mise-registry-tool.json, mise-settings.json) and draft2019 (mise.json, mise-task.json); now consistently uses draft/2020-12
  • Remove --strict-schema flag — this flag doesn't exist in ajv compile (confirmed via ajv help compile); replaced with --strict-types=true and --strict-tuples=true
  • Replace union type arrays with oneOf — union type syntax like "type": ["string", "boolean"] triggers AJV strictTypes errors; replaced with explicit oneOf constructs in both hand-written schemas and the schema.ts renderer for generated schemas (BoolOrString type)

- validate all schema/ files instead of a hardcoded subset
- use draft2020 for all schemas (previously mixed draft-07, draft2019)
- remove --strict-schema flag which doesn't exist in ajv; enable --strict-types and --strict-tuples instead
- replace union type arrays with oneOf to satisfy AJV strictTypes
@risu729 risu729 marked this pull request as ready for review May 4, 2026 14:55
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 4, 2026

Greptile Summary

This PR standardizes JSON Schema validation across all schema/**/*.json files: schemas are unified to draft/2020-12, the non-existent --strict-schema flag is replaced with --strict-types and --strict-tuples, and union-type arrays are replaced with oneOf constructs throughout both hand-written schemas and the schema.ts renderer.

Confidence Score: 5/5

Safe to merge; all changes are correctness improvements with no P0/P1 issues.

Only P2 findings: one about the hk check validating only changed files rather than all schemas, and the pre-existing Element type inaccuracy in schema.ts. No logic errors, data loss, or security concerns.

hk.pkl — verify whether the intent is to validate all schemas unconditionally or only changed ones per run.

Important Files Changed

Filename Overview
hk.pkl Schema check now iterates all schema/**/*.json via xargs -0 with draft2020 and correct strict flags, but validates only changed files rather than all schemas unconditionally.
xtasks/render/schema.ts BoolOrString handling replaced with bool_or_string sentinel + delete/oneOf injection; works at runtime but Element type still declares type as required and lacks oneOf (pre-existing P2 comment).
schema/mise.json $schema bumped to draft/2020-12; uv_venv_auto union type array replaced with oneOf alongside enum — semantically correct in JSON Schema draft 2020.
schema/mise-registry-tool.json $schema bumped from draft-07 to draft/2020-12; two union type arrays replaced with oneOf constructs.
schema/mise-settings.json $schema bumped from draft-07 to draft/2020-12; oneOf formatting expanded — no functional changes.
schema/mise-task.json $schema bumped from draft/2019-09 to draft/2020-12 — minimal, correct change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["hk check triggered\n(schema/**/*.json changed)"] --> B["files_list piped via stdin\nas null-separated paths"]
    B --> C["xargs -0 -I {}"]
    C --> D["ajv compile -s {file}\n--spec=draft2020\n--strict-types=true\n--strict-tuples=true"]
    D -->|pass| E{more files?}
    D -->|fail| F["xargs exits non-zero\nCI fails"]
    E -->|yes| D
    E -->|no| G["All schemas valid ✓"]

    H["xtasks/render/schema.ts"] --> I{props.type == BoolOrString?}
    I -->|yes| J["Set type = __bool_or_string__\n(sentinel)"]
    J --> K["delete element.type\nadd element.oneOf:\n[boolean, string]"]
    I -->|no| L["Normal typeMap lookup\n(string / boolean / array / object)"]
    K --> M["Write to schema/mise.json"]
    L --> M
Loading

Reviews (2): Last reviewed commit: "chore: simplify with stdin and xargs" | Re-trigger Greptile

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates several JSON schemas to the draft/2020-12 specification and replaces union type arrays with 'oneOf' constructs to comply with AJV strict type checking. It also modifies the schema validation task in 'hk.pkl' and the schema rendering script in 'xtasks/render/schema.ts' to support these changes. A review comment suggests removing unnecessary type casts in the TypeScript rendering script to improve code safety and readability.

Comment thread xtasks/render/schema.ts
@jdx jdx merged commit 8176297 into jdx:main May 4, 2026
34 checks passed
@risu729 risu729 deleted the fix/schema-validation branch May 4, 2026 19:03
mise-en-dev added a commit that referenced this pull request May 5, 2026
### 🚀 Features

- **(backend)** support top-level aqua cosign verification by @risu729
in [#9111](#9111)

### 🐛 Bug Fixes

- **(schema)** validate all schema files with draft2020 and strict mode
by @risu729 in [#9594](#9594)
- **(shim)** skip network resolution for installed tool dirs by @jdx in
[#9599](#9599)

### 📚 Documentation

- **(dev-tools)** clarify vfox metadata depends for install hooks by
@risu729 in [#9573](#9573)
- **(plugins)** remove registry submission guidance by @risu729 in
[#9577](#9577)

### 📦️ Dependency Updates

- lock file maintenance by @renovate[bot] in
[#9586](#9586)

### 📦 Registry

- remove bashly asdf fallback by @risu729 in
[#9578](#9578)
- use github backend for rebar by @risu729 in
[#9576](#9576)
- add wasm-tools
([aqua:bytecodealliance/wasm-tools](https://github.com/bytecodealliance/wasm-tools))
by @2xdevv in [#9596](#9596)
- enable symlink_bins for elixir-ls by @AlternateRT in
[#9592](#9592)

### Chore

- **(release)** always append sponsor block to release notes by @jdx in
[#9580](#9580)
- warn on vendored vfox embedded plugins by @risu729 in
[#9588](#9588)
- prefer registry shorthands over cargo/npm backends in mise.toml by
@risu729 in [#9595](#9595)

## 📦 Aqua Registry Updates

### New Packages (2)

-
[`salesforce/reactive-grpc/protoc-gen-reactor-grpc`](https://github.com/salesforce/reactive-grpc)
- [`spinframework/spin`](https://github.com/spinframework/spin)

### Updated Packages (1)

- [`pnpm/pnpm`](https://github.com/pnpm/pnpm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants