-
Notifications
You must be signed in to change notification settings - Fork 77
Resolving type/command/event name clashes #1222
Conversation
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
…ad of erroring out
…uld no longer fail
Corresponding JIRA ticket: https://improbableio.atlassian.net/browse/UTY-1416 |
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
isValid = false; | ||
Console.Error.WriteLine( | ||
$"Error in component \"{componentName}\". " + | ||
$"Command \"{clashingCommand.RawCommandName}\" clashes with component name."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Prefer having a long line over concatentating strings. Also you can use single quotes and get rid of the escaping which aids readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was using single quotes before and I think it's not really that readable in the Editor
...probable.gdk.tools/.CodeGenTemplate/CodeGenerationLib/Model/Details/UnityComponentDetails.cs
Outdated
Show resolved
Hide resolved
...probable.gdk.tools/.CodeGenTemplate/CodeGenerationLib/Model/Details/UnityComponentDetails.cs
Outdated
Show resolved
Hide resolved
...io.improbable.gdk.tools/.CodeGenTemplate/CodeGenerationLib/Model/Details/UnityTypeDetails.cs
Outdated
Show resolved
Hide resolved
...ges/io.improbable.gdk.tools/.CodeGenTemplate/CodeGenerationLib/Model/Details/DetailsStore.cs
Outdated
Show resolved
Hide resolved
...ges/io.improbable.gdk.tools/.CodeGenTemplate/CodeGenerationLib/Model/Details/DetailsStore.cs
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,27 @@ | |||
// Wait, that's illegal! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
...ges/io.improbable.gdk.tools/.CodeGenTemplate/CodeGenerationLib/Model/Details/DetailsStore.cs
Outdated
Show resolved
Hide resolved
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think codegen needs to fail when running into clashes, not skip them.
@@ -12,8 +13,8 @@ public class UnityComponentDetails | |||
public bool IsBlittable { get; } | |||
|
|||
public IReadOnlyList<UnityFieldDetails> FieldDetails { get; private set; } | |||
public IReadOnlyList<UnityCommandDetails> CommandDetails { get; } | |||
public IReadOnlyList<UnityEventDetails> EventDetails { get; } | |||
public IReadOnlyList<UnityCommandDetails> CommandDetails { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these 2 private set now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice spot - these are relics from when the filtering was done in a separate method
return true; | ||
} | ||
|
||
Console.Error.WriteLine($"Error in component \"{ComponentName}\". Command \"{commandDetail.RawCommandName}\" clashes with component name."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should FAIL codegen. It shouldn't be possible to write schema that throws errors but still generates code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolved offline
The problem is until we have a way of surfacing these errors reliably, failing code generation (i.e. - outputting nothing) obscures the problem due to the avalanche of compile errors you will hit. |
Discussed offline Having heard both sides, I've decided to keep the messages as errors without failing the entire codegen step for now, and we can refine the idea further when we have better codegen logging. Once that is in place, we are likely to be able to surface these issues better to users and (maybe) cause the codegen step to fail in a way that doesn't stop users from A) knowing that the error was in codegen and B) knowing where to look to figure out where their error comes from. |
Signed-off-by: Paul Balaji <paulbalaji@improbable.io>
Description
It currently just does a basic log to stderr, and forwarding that to the Editor:
TODO:
add tests for the illegal schema sampleTests
Schema linked in #957 and #958 will no longer cause compilation errors, but codegen will log an error that gets picked up in the Editor
Primary reviewers
If your change will take a long time to review, you can name at most two primary reviewers who are ultimately responsible for reviewing this request. @ mention them.