Skip to content

fix:resolving NO GENERATED CLASS FOUND error from tip.json - #108

Closed
ryanmco wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
ryanmco:fix/food-models-post-process
Closed

ryanmco wants to merge 1 commit into
Universal-Commerce-Protocol:mainfrom
ryanmco:fix/food-models-post-process

Conversation

@ryanmco

@ryanmco ryanmco commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Resolve error forbidden keys ['custom_amount', 'selected_option_id'] on 'Tip' -> NO GENERATED CLASS FOUND

Description

fix: map anyOf/oneOf forbidden-key rules to union variant classes

find_forbidden_keys() previously walked anyOf and oneOf branches with the
enclosing current_class_name, treating unions identically to allOf. For
schemas like tip.json—where a oneOf union defines per-branch not
constraints—datamodel-code-generator emits the parent (Tip) as a
TypeAliasType union and emits each branch as a separate BaseModel class
(Tip1, Tip2, Tip3). Attributing all branches to Tip both merged
conflicting branch rules together and failed in _patch_forbidden_keys() with
NO GENERATED CLASS FOUND because class Tip does not exist.

Split anyOf/oneOf handling from allOf so each union branch resolves to its
generated variant class under --use-title-as-name:

  • Untitled branches, or branches that repeat the parent's title (e.g. "Tip"
    inherited from tip.json), map to {current_class_name}{idx} (Tip1,
    Tip2, Tip3) since the parent union alias already claims Tip. Passing
    is_def=True prevents walk() from resetting {current_class_name}{idx}
    back to the inherited parent title.
  • Branches with a distinct title of their own map to _alias_name(title) to
    match --use-title-as-name.

Category (Required)

Please select one or more categories that apply to this change.

  • Core Protocol: Changes to the base communication layer, global context, or breaking refactors. (Requires Technical Council approval)
  • Governance/Contributing: Updates to GOVERNANCE.md, CONTRIBUTING.md, or CODEOWNERS. (Requires Governance Council approval)
  • Capability: New schemas (Discovery, Cart, etc.) or extensions. (Requires Maintainer approval)
  • Documentation: Updates to README, or documentations regarding schema or capabilities. (Requires Maintainer approval)
  • Infrastructure: CI/CD, Linters, or build scripts. (Requires DevOps Maintainer approval)
  • Maintenance: Version bumps, lockfile updates, or minor bug fixes. (Requires DevOps Maintainer approval)
  • [ x] 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 (resolver, linter, validator). (Requires Maintainer approval)
  • Community Health (.github): Updates to templates, workflows, or org-level configs. (Requires DevOps Maintainer approval)

Related Issues

Checklist

  • [x ] I have followed the Contributing Guide (including Conventional Commits title requirements and ! for breaking changes).
  • 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.
  • (For Breaking Schema Changes / Deprecations) I have used the transition annotation rather than changing field visibility or removing a field directly.
  • I have regenerated Python Pydantic models by running generate_models.sh under python_sdk.

Screenshots / Logs (if applicable)

@damaz91 damaz91 added the status:needs-triage Signal that the PR is ready for human triage label Nov 17, 2026
@damaz91

damaz91 commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Hello @ryanmco - we completely removed postprocessing so I'm closing this PR.

@damaz91 damaz91 closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:needs-triage Signal that the PR is ready for human triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants