Skip to content

fix: validate examples through internal refs - #59

Open
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/lint-referenced-examples
Open

fix: validate examples through internal refs#59
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/lint-referenced-examples

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

check_examples compiled each schema node in isolation. A node that inherited its constraints through an internal $ref such as #/$defs/positive therefore lost the root document needed to resolve that reference. Validator compilation failed and the best-effort path skipped the examples, allowing an invalid documented value to pass linting.

Fix: register the root schema as an in-memory resource and validate each examples array through a JSON Pointer to its enclosing schema node. Pointer tokens are escaped before building the reference, and unresolved external references keep the existing best-effort behavior.

The regression test uses a referenced positive-integer schema with examples [0, 2]: only 0 produces E008. The updated linter also passes all 104 JSON documents under the UCP source/ tree with no errors.

Category (Required)

  • Core Protocol: Changes to core protocol specifications. (Requires Technical Council approval)
  • Governance/Contributing: Changes to governance or contributing processes. (Requires Governance Council approval)
  • Capability: New or updated capabilities. (Requires Maintainer approval)
  • Documentation: Documentation-only changes. (Requires Maintainer approval)
  • Infrastructure: Build, CI, or deployment changes. (Requires DevOps Maintainer approval)
  • Maintenance: Dependencies and repository maintenance. (Requires DevOps Maintainer approval)
  • SDK: Language-specific SDK updates and releases. (Requires DevOps Maintainer approval)
  • Samples / Conformance: Maintaining samples and the conformance suite. (Requires Maintainer approval)
  • UCP Schema: Changes to the ucp-schema tool. (Requires Maintainer approval)
  • Community Health (.github): Organization-wide community files. (Requires DevOps Maintainer approval)

Related Issues

N/A

Checklist

  • I have followed the Contributing Guide and Code of Conduct.
  • I have updated the documentation (if applicable).
  • My changes pass all local linting and formatting checks.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.
  • (For Core/Capability) I have included/updated the relevant JSON schemas.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk (not applicable).

Screenshots / Logs (if applicable)

N/A — verified with cargo test --all-targets, cargo clippy --all-targets -- -D warnings, cargo fmt --check, all pre-commit hooks, and a full lint of the UCP source/ tree.

@damaz91 damaz91 added status:needs-triage Signal that the PR is ready for human triage status:under-review and removed status:needs-triage Signal that the PR is ready for human triage labels Aug 16, 2026
@damaz91 damaz91 added status:stale-review Applied if a PR is waiting on a reviewer for too long and removed status:under-review labels Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:stale-review Applied if a PR is waiting on a reviewer for too long

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants