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
Originally posted by Jappinen August 29, 2024
Hello,
After updating from 1.1.3 to 1.2.0 my build output lit up like a Xmas tree with nullable property warnings. Take the simples possible Petstore sample for example (on fresh .NET 8 console project with everything as default as Rider sets them up):
petstore.g.cs(626,23): Warning CS8618 : Non-nullable property 'Type' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.
...and continues for 27 lines. The culprit is the new "#nullable enable" line after usings and before namespace that was previously behind a flag (b13015b).
After a little bit of digging I found you discussed this on #435 and as per the docs (the blue box at the end of chapter) for generated code you really need to have that pragma in place to get the benefits.
Discussed in #449
Originally posted by Jappinen August 29, 2024
Hello,
After updating from 1.1.3 to 1.2.0 my build output lit up like a Xmas tree with nullable property warnings. Take the simples possible Petstore sample for example (on fresh .NET 8 console project with everything as default as Rider sets them up):
...and continues for 27 lines. The culprit is the new "#nullable enable" line after usings and before namespace that was previously behind a flag (b13015b).
After a little bit of digging I found you discussed this on #435 and as per the docs (the blue box at the end of chapter) for generated code you really need to have that pragma in place to get the benefits.
In order to tell the underlying NSwag that you want nullables you need to opt-in: RicoSuter/NSwag#2435 (comment)
And like magic all my problems went away with the this:
So I guess what I'm trying to ask is shouldn't that be the default setting from now on or am I missing something blatantly obvious?
The text was updated successfully, but these errors were encountered: