Skip to content

fix(yaml_model): robust anyOf/oneOf handling in schema comments#732

Open
scottstanie wants to merge 1 commit into
isce-framework:mainfrom
scottstanie:fix-yaml-model-unions
Open

fix(yaml_model): robust anyOf/oneOf handling in schema comments#732
scottstanie wants to merge 1 commit into
isce-framework:mainfrom
scottstanie:fix-yaml-model-unions

Conversation

@scottstanie

Copy link
Copy Markdown
Contributor

Summary

YamlModel's comment generator crashes on some valid config schemas.

  • For every entry under a schema's anyOf, it read d["type"], which raises
    KeyError when an entry has no type key -- e.g. a $ref to a nested model,
    or a discriminated union member.
  • It ignored oneOf entirely (produced by discriminated unions).

Change

  • Handle both anyOf and oneOf.
  • Fall back gracefully for entries without a type key instead of raising.

This lets to_yaml() run on configs that use nested-model unions / discriminated
unions.

🤖 Generated with Claude Code

The YAML comment generator read `d["type"]` for every entry under a
schema's `anyOf`, which raises KeyError when an entry has no `type` key
(e.g. a `$ref` to a nested model, or a discriminated union). It also
ignored `oneOf` entirely.

Handle both `anyOf` and `oneOf`, and fall back gracefully for entries
without a `type` key instead of crashing.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant