Skip to content

Support nested version arrays in TOML plugins - #215

Open
castrog wants to merge 2 commits into
moonrepo:masterfrom
castrog:feat/manifest-array-key
Open

castrog wants to merge 2 commits into
moonrepo:masterfrom
castrog:feat/manifest-array-key

Conversation

@castrog

@castrog castrog commented Oct 25, 2026

Copy link
Copy Markdown

Summary

We use proto in our projects, and supporting Chrome for Testing's version feed would make a ChromeDriver TOML plugin possible for browser testing. Its known-good-versions.json wraps versions in a versions array, while schema plugins currently expect the response itself to be an array.

Add manifest-array-key (v1) and index_array_key (v2) to select the array:

[resolve]
manifest-url = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions.json"
manifest-array-key = "versions"
manifest-version-key = "version"

Top-level arrays continue to work. Missing keys and values that are not arrays return clear errors. The v2 setting also works in resolve overrides.

Addresses moonrepo/proto#948.

Verification

  • cargo build -p schema_tool --target wasm32-wasip1 --release --locked — passed.
  • cargo nextest run -p schema_tool --no-default-features --no-fail-fast --no-tests=pass --locked — 85 passed.
  • cargo clippy -p schema_tool --target wasm32-wasip1 --release --locked -- -D warnings — passed.
  • cargo fmt --all --check — passed.

Thanks for maintaining proto and its plugins—we use them regularly.

Allow TOML plugins to resolve version manifests that wrap their version list in a JSON object, such as Chrome for Testing.
@milesj

milesj commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@castrog What if we supported xpath-like notation instead? index-version-key = 'versions[0].version'?

@castrog

castrog commented Oct 26, 2026

Copy link
Copy Markdown
Author

That makes sense. Were you thinking JSONPath, like $.versions[*].version to get every version, or a simpler path without the $? I can adjust the PR either way.

@milesj

milesj commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Maybe whatever jq users to keep the syntax familiar?

@castrog

castrog commented Oct 26, 2026

Copy link
Copy Markdown
Author

Thinking more about your suggestion, there are two options for a version query format. Either would replace the array-key setting in this PR, so we’d ship one way to extract versions from the ChromeDriver JSON index:

Option Query Benefit Cost
jq-style syntax with jaq .versions[].version Familiar to jq users Adds ~1.18 MB to schema_tool.wasm in our local build
JMESPath syntax versions[*].version Adds only ~183 KB Less familiar syntax for jq users

Both handle this lookup. On a synthetic index of 2,590 versions, both ran in under 2 ms, so performance doesn’t seem to decide it. I lean toward JMESPath for this narrow version lookup because of the size difference, but jq familiarity is a real benefit. Which tradeoff makes more sense for schema_tool?

@milesj

milesj commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

@castrog JMESPath seems fine to me. In this example, does [*] represent the 0 index?

@castrog

castrog commented Oct 26, 2026 •

Copy link
Copy Markdown
Author

@milesj it represents all, versions[0].version would represent the first entry.

@milesj

milesj commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Sure, works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants