-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.NET Generator/Runtime: primitive types should all be nullables in props object #715
Comments
This needs more discussion. If datatype class A implements interface B, and interface B does not have its properties flagged as optional, then we can not mark them as nullable in A, as this would go against interface B contract. We would have to alter interface B contract to only carry optional properties because it is implemented by datatype class A. |
This definitely warrants more discussion as well as some experimentation on our part. For the purpose of my own understanding, let me restate. When defining an interface/class/whatever in DotNet, and it has a required primitive type property which is not set by the user during construction, the value will default to whatever the types default value is? So we can't actually tell if it was passed by the user, or just defaulted? Right now it seems that the Node process would fail and throw an error because the required property is missing. Obviously it would be ideal to catch this before that. However, making this change would mean that though we could catch this in the DotNet runtime, it still would not be detectable at compile time. Does that seem correct to you @assyadh ? |
This issue has not received any attention in 2 years. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
The reasoning is that in the case of primitives, there is no way to tell if a required primitive was actually set by the customer (ex: a required int will default to 0).
If we set it to int? then the customer has to set a value, and we can then check for the absence of null values in the runtime.
The text was updated successfully, but these errors were encountered: