Skip to content

fix: skip example instances during lint traversal - #60

Closed
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/skip-example-instance-recursion
Closed

fix: skip example instances during lint traversal#60
FanouZeng-TT wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
FanouZeng-TT:fix/skip-example-instance-recursion

Conversation

@FanouZeng-TT

Copy link
Copy Markdown
Contributor

Description

check_examples validated each schema node's examples array and then recursively walked into that same array. Example values are instance data, not nested schemas. A valid object example containing business fields named type and examples was therefore reinterpreted as a schema and produced a false E008 at /examples/0/examples/0.

Fix: stop schema traversal at the examples keyword after validating its entries. Other schema containers such as properties, items, composition branches, and $defs continue to be visited.

The regression test uses a valid object example whose own examples field contains the number 123; linting now passes without diagnostics, while the existing invalid schema-level example test continues to report E008.

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 the CLI regression fixture.

@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
@igrigorik

Copy link
Copy Markdown
Contributor

Thanks @FanouZeng-TT — real bug, correct repro, and it still reproduces on merged main today.

Closing in favour of #64 rather than as fixed: #64 covers the same traversal defect and extends it to default, const, enum, and example, so landing both would conflict for no gain. The fix is still wanted, just in that PR.

@igrigorik igrigorik closed this Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants