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
Update JsonInheritanceConverter.liquid #1502
Conversation
The InheritanceConverters needs to be made public so downstream NSwag Generator can get the DiscriminatorName (i.e. wrapping Client classes in another generated client class) Error below: 6> ---> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Text.Json.Serialization.JsonConverter<BaseClass>' does not contain a definition for 'DiscriminatorName'
I dont think that it needs to be public (as in reflection internal is the same as public I think) |
I'm using the latest NSwag.msbuild which is still affected. After manually modifying the accessor to public the problem went away. |
I have created a repo replicating the problem using latest NSwag.AspNetCore as well as NSwag.Build. I think the issue is when client codes are from different projects, NJsonSchema.OpenApiDiscriminator.AddMapping is unable to get the method through reflection due to JsonInheritanceConverter being an internal class from a different project |
Alternatively we can use InternalsVisibleTo("NJsonSchema") |
Also updated DateFormatConverter.liquid due to missing namespace. |
Can you also fix the tests? |
Done. |
The JsonInheritanceConverters need to be made public so downstream NSwag Generator can get the DiscriminatorName (i.e. wrapping Client classes in another generated client class)
Error below:
6> ---> Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'System.Text.Json.Serialization.JsonConverter' does not contain a definition for 'DiscriminatorName'