Skip to content

58 validator should check for params with nested values#62

Merged
abrown-RV merged 11 commits into
developfrom
58-validator-should-check-for-params-with-nested-values
Jul 7, 2026
Merged

58 validator should check for params with nested values#62
abrown-RV merged 11 commits into
developfrom
58-validator-should-check-for-params-with-nested-values

Conversation

@abrown-RV

Copy link
Copy Markdown
Collaborator

refactored the ad-hoc mandatory checks out of the validator into a checks/ directory with a generic registry (getChecks/runChecks). each check is its own module with its own disable flag.

added a new check that warns about:

  • nested values on sub-params that aren't referenced by any template_oid
  • top-level params with no value that aren't templates

warnings don't fail validation, only errors do. showErrors now prefixes output with ERROR: or WARNING: accordingly.

also fixed validate.sh so it runs from anywhere, and added copyright headers to test files.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors the existing validator to use a modular “checks” registry (getChecks / runChecks), adds a nested-values warning check for device descriptors, and updates the validator output formatting to distinguish errors vs warnings.

Changes:

  • Replaced the ad-hoc mandatory validation call with a generic check registry and per-check disable flags.
  • Added a new nested-values check that emits warnings (non-fatal) for unreferenced nested values and for top-level non-template params without values.
  • Updated test suite + coverage collection, and adjusted examples/validate.sh to be runnable from any working directory.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tools/validator.js Integrates checks.runChecks and prefixes output with ERROR: / WARNING:.
tools/tests/validator.test.js Updates validator tests to mock runChecks and to assert new log prefixes.
tools/jest.config.cjs Switches coverage collection from mandatory.js to checks/*.js.
tools/checks/nested-values.js Implements the new nested-values warning check.
tools/checks/nested-values.test.js Adds unit tests for nested-values warning behavior and disable flag.
tools/checks/mandatory.js Refactors mandatory validation into the checks framework (opts + disable flag).
tools/checks/mandatory.test.js Updates mandatory check tests to pass opts and adds additional cases.
tools/checks/index.js Introduces the check registry and exports WARNING/ERROR constants.
tools/checks/index.test.js Adds tests locking in the check registry contents and aggregation behavior.
tools/checks/constants.js Defines WARNING / ERROR constants shared by checks and validator.
examples/validate.sh Ensures schema build + validation works regardless of where the script is invoked from.
Comments suppressed due to low confidence (2)

tools/checks/mandatory.js:119

  • The value-validation errors use instancePaths like /params/product/params/<key>/value, but the actual values live under /params/product/value/struct_value/fields/<key>/string_value (see examples/device.example.yaml). This makes the reported path misleading and prevents sourceMap.pointers[instancePath] from resolving line numbers.
    tools/checks/mandatory.test.js:2
  • The copyright header uses a Roman numeral year that doesn’t match the numeric year (MMXXV is 2025, but the line says 2026). Other repo files keep these in sync (e.g., interface/schemata/client-hints.yaml uses “MMXXV 2025”).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/tests/validator.test.js Outdated
Comment thread tools/checks/nested-values.test.js Outdated
Comment thread tools/checks/nested-values.js Outdated
Comment thread tools/checks/index.test.js Outdated
Comment thread tools/checks/index.js Outdated
Comment thread tools/checks/constants.js Outdated
Comment thread tools/checks/nested-values.js Outdated
Comment thread tools/checks/index.js Outdated
@abrown-RV
abrown-RV merged commit 8ea5962 into develop Jul 7, 2026
4 checks passed
@abrown-RV
abrown-RV deleted the 58-validator-should-check-for-params-with-nested-values branch July 7, 2026 19:33
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.

3 participants