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
If you generate a C# client with a model that has a property with type: string and format: date, and are using JsonLibrary SystemTextJson then the generated client fails to compile with the following error:
error CS0246: The type or namespace name 'JsonException' could not be found
If you generate a C# client with a model that has a property with type: string and format: date, and are using JsonLibrary SystemTextJson then the generated client fails to compile with the following error:
error CS0246: The type or namespace name 'JsonException' could not be found
The issue is here; the generated DateFormatConverter does not specify the full name for JsonException.
https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema.CodeGeneration.CSharp/Templates/DateFormatConverter.liquid#L10
throw new JsonException("Unexpected JsonTokenType.Null");
This code (PR #1490) comes from issue #1486. In the issue, the proposed code has the correct full name:
throw new System.Text.Json.JsonException("Unexpected JsonTokenType.Null");
So it seems to just have been missed in the PR.
I'm happy to create a PR for the fix if that's helpful.
The text was updated successfully, but these errors were encountered: