You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A TypeSpec spec contained a model with two properties named fooTime and fooDate. When this model was passed to @azure-tools/typespec-csharp, it failed with this error, since the code generator tries to rename both properties to FooOn.
$ dotnet build /t:generatecode /p:localspecrepo=/foo
NOTE: A path to a local spec was provided, will generate based off of local files...
...
Compiling tsp using @azure-tools/typespec-csharp...
Unhandled exception. System.ArgumentException: An item with the same key has already been added. Key: FooOn
This error message should be improved to:
Identify the properties in the TypeSpec model causing the conflict
Suggest how users can resolve the conflict. Is the only option to rename one of the properties, or could they use something like @@clientName?
We should also consider the following questions:
Could this, or does this, impact the code generators for other languages?
Should detecting conflicting properties fooDate/fooTime be moved upstream, into the TypeSpec Azure Linter, so spec authors get more immediate feedback?
A TypeSpec spec contained a model with two properties named
fooTime
andfooDate
. When this model was passed to@azure-tools/typespec-csharp
, it failed with this error, since the code generator tries to rename both properties toFooOn
.This error message should be improved to:
@@clientName
?We should also consider the following questions:
fooDate/fooTime
be moved upstream, into the TypeSpec Azure Linter, so spec authors get more immediate feedback?Further details: https://teams.microsoft.com/l/message/19:[email protected]/1733189859118?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&parentMessageId=1733189859118&teamName=Azure%20SDK&channelName=Language%20-%20DotNet&createdTime=1733189859118
The text was updated successfully, but these errors were encountered: