Skip to content

ECDb should allow widening array bounds on schema update - #1688

Merged
RohitPtnkr1996 merged 7 commits into
mainfrom
rohitptnkr/allow-windening-array-bounds
Nov 4, 2026
Merged

RohitPtnkr1996 merged 7 commits into
mainfrom
rohitptnkr/allow-windening-array-bounds

Conversation

@RohitPtnkr1996

@RohitPtnkr1996 RohitPtnkr1996 commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Schema differencing in the ecschema-editing treats a change to an array property's minOccurs/maxOccurs as an ordinary, auto-mergeable difference.
This used to contradicts ECDb's behavior which rejects changing array bounds on an existing property during a schema upgrade, leading to the merge passing but the schema import failing during transformations.

This PR relaxes the rule by allowing a schema update to only widen array bounds.
The linked itwinjs PR mirrors this behavior in the schema diff validator which reports a conflict only when array bounds are narrowed on either or both sides.

@RohitPtnkr1996 RohitPtnkr1996 changed the title ECDb should allow widening array bounds on schema import/update ECDb should allow widening array bounds on schema update Nov 3, 2026
@RohitPtnkr1996
RohitPtnkr1996 enabled auto-merge (squash) November 3, 2026 04:51
@khanaffan

Copy link
Copy Markdown
Contributor

@RohitPtnkr1996 though it looks fine but what is the issue? We do not enforce any of these bounds in the first place. For now this fine but I would have no issue if it get narrower or widens.

@RohitPtnkr1996

Copy link
Copy Markdown
Contributor Author

@RohitPtnkr1996 though it looks fine but what is the issue? We do not enforce any of these bounds in the first place. For now this fine but I would have no issue if it get narrower or widens.

The transformer team flagged a discrepancy where the schema diff in ecschema-editing allows array bounds to change without a conflict, however once the schema merges, the update is rejected by ECDb as it does not allow array bounds changing at all.
I originally changed ecschema-editing to mirror ECDb, but after discussion with Julija and Rob, we decided to relax this is ECDb to only allow widening array bounds.
The same behavior is applied to ecschema-editing which now flags narrowing array bounds as a conflict.

@mergify

mergify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@RohitPtnkr1996
RohitPtnkr1996 merged commit e537bbf into main Nov 4, 2026
22 checks passed
@RohitPtnkr1996
RohitPtnkr1996 deleted the rohitptnkr/allow-windening-array-bounds branch November 4, 2026 12:12
@RohitPtnkr1996 RohitPtnkr1996 added the backported to imodel02 The changes in this PR have been backported to imodel02 successfully. label Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backported to imodel02 The changes in this PR have been backported to imodel02 successfully.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants