fix: include model name in duplicate-property error message#10196
Merged
fix: include model name in duplicate-property error message#10196
Conversation
Co-authored-by: baywet <[email protected]>
Copilot
AI
changed the title
[WIP] Fix duplicate-property error message to include model name
fix: include model name in duplicate-property error message
Mar 30, 2026
baywet
approved these changes
Mar 30, 2026
commit: |
timotheeguerin
approved these changes
Mar 30, 2026
Member
There was a problem hiding this comment.
ok to have that but I think what we really missing is where is that original property coming from which I think is often the source of confusion here(from a spread or model is).
Also should close #877(dup issue)
Collaborator
|
You can try these changes here
|
msyyc
pushed a commit
that referenced
this pull request
Apr 1, 2026
fixes #10195 fixes #877 The `duplicate-property` diagnostic omitted the model name, making it harder to locate the offending model in large specs. ## Changes - **`messages.ts`**: Added `withModel` message variant to `duplicate-property`: `Model ${"modelName"} already has a property named ${"propName"}` - **`checker.ts`**: `defineProperty` now selects `withModel` when `newProp.model?.name` is non-empty, falling back to the original `default` message for anonymous model expressions - **Tests**: Updated assertions in `model.test.ts` and `check-parse-errors.test.ts` to match the new format ## Before / After ``` // Before error duplicate-property: Model already has a property named id // After error duplicate-property: Model Foo already has a property named id ``` Anonymous model expressions (no name) retain the original message. --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: baywet <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes #10195
fixes #877
The
duplicate-propertydiagnostic omitted the model name, making it harder to locate the offending model in large specs.Changes
messages.ts: AddedwithModelmessage variant toduplicate-property:Model ${"modelName"} already has a property named ${"propName"}checker.ts:definePropertynow selectswithModelwhennewProp.model?.nameis non-empty, falling back to the originaldefaultmessage for anonymous model expressionsmodel.test.tsandcheck-parse-errors.test.tsto match the new formatBefore / After
Anonymous model expressions (no name) retain the original message.