Skip to content

model: keep the first value list when several annotations target one property - #333

Open
MaxonT wants to merge 1 commit into
SAP:masterfrom
MaxonT:contrib/142-auto
Open

MaxonT wants to merge 1 commit into
SAP:masterfrom
MaxonT:contrib/142-auto

Conversation

@MaxonT

@MaxonT MaxonT commented Nov 24, 2026

Copy link
Copy Markdown

Hello maintainers, I'd like to help with issue #142 by offering a change for you to review that handles multiple annotations on the same target without reporting an invalid schema.

Metadata that carries more than one unqualified ValueList annotation for the same property made the parser raise Cannot replace value helper ..., so the schema was reported invalid (and a strict error policy aborted). A property can only hold one value helper here, so the first one is now kept and each later one is logged as ignored; the schema stays valid.

Fixes #142. Thanks for attaching the metadata file and reproduce.py; with your files the is_valid result went from False to True on this change.

Tests: new test_annot_v_l_duplicate_target in tests/test_model_v2.py (two ValueList annotations on one property: schema valid, first one kept, warning logged). It fails with the original RuntimeError when the change in model.py is reverted. The full tests directory ran with pytest on Python 3.14: 319 passed. I did not run pylint (it crashes in my environment on this Python version) or the older Python versions from the CI matrix.

I took the "keep one and warn" route rather than ignoring all annotations (option B in the issue), because value helpers are used by the model today. Happy to change it if you prefer the other.

…property

Signed-off-by: Ym <173550318+MaxonT@users.noreply.github.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.

False invalid schema status + invalid errors thrown for service with multiple annotations to same target

1 participant