-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
AdditionalProperties JsonExtensionData repeated for subclasses in generated C# contracts #2818
Comments
This is a serious bug i’d say. |
It appears to be an issue with using |
AlwaysAllowAdditionalObjectProperties Is for the schema generator - and the schema is correct i’d say. The problem is the code generator: it should not generate the property if it already exists on the base class. |
But yes, if you have the option to disable AlwaysAllowAdditionalObjectProperties it might fix it, but not fix the root cause. |
I believe this may be the root cause of some runtime errors I'm seeing in a generated C# client. The error is:
I have one endpoint that returns ValidationProblemDetails whilst the rest return ProblemDetails |
I ran into this issue with problem details as wel. @RicoSuter I'm thinking of having a crack at fixing this, is there any specific branch i should start from? |
FYI I was able to get around this by using the services.AddOpenApiDocument(settings =>
{
settings.FlattenInheritanceHierarchy = true;
// ...rest of the settings
}); |
Given:
The generated contracts for
ProblemDetails
andValidationProblemDetails
both generateAdditionalProperties
which could be a problem with the properties conflicting:My guess is that the disabling of
CS0108
is hiding the warning.#pragma warning disable 108
Wouldn't it make sense that NJsonSchema or NSwag see the inherited property/configuration for
JsonExtensionData
and not generate it?The text was updated successfully, but these errors were encountered: