-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix error when model property is invalid (#3574)
fix #3504 When unsuitable types are specified in the model property, the invalid code location is now reported instead of throwing an error. When compiling the following tsp file, it is reported as follows ```tsp interface TestInterface1 { get1(prop: TestInterface1): TestInterface1; } ``` ``` Diagnostics were reported during compilation: /projects/typespec/packages/samples/scratch/main.tsp:2:8 - error @typespec/openapi3/invalid-model-property: 'Interface' cannot be specified as a model property. > 2 | get1(prop: TestInterface1): TestInterface1; | ^^^^ Found 1 error. ``` --------- Co-authored-by: Timothee Guerin <tiguerin@microsoft.com> Co-authored-by: Timothee Guerin <timothee.guerin@outlook.com>
- Loading branch information
1 parent
e4c4d2b
commit 147335d
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking | ||
changeKind: fix | ||
packages: | ||
- "@typespec/openapi3" | ||
--- | ||
|
||
Emit diagnostic when an invalid type is used as a property instead of crashing. |
This file contains 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
This file contains 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