-
-
Notifications
You must be signed in to change notification settings - Fork 539
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
Make TypeResolverBase.RemoveNullability virtual for extendability #1547
Comments
SamuelBerger
added a commit
to SamuelBerger/NJsonSchema
that referenced
this issue
Aug 7, 2022
…lity This allows to implement different logic e.g. treat JsonSchema.OneOf to have multiple (non nullable) items instead of zero or one.
SamuelBerger
added a commit
to SamuelBerger/NJsonSchema
that referenced
this issue
Aug 7, 2022
…lity This allows to implement different logic e.g. treat JsonSchema.OneOf to have multiple (non nullable) items instead of zero or one.
SamuelBerger
added a commit
to SamuelBerger/NJsonSchema
that referenced
this issue
Aug 7, 2022
This allows to implement different logic e.g. treat JsonSchema.OneOf to have multiple (non nullable) items instead of zero or one.
RicoSuter
pushed a commit
that referenced
this issue
Aug 15, 2022
This allows to implement different logic e.g. treat JsonSchema.OneOf to have multiple (non nullable) items instead of zero or one.
@SamuelBerger @RicoSuter it seems like #1548 resolved this issue but it wasn't closed somehow. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We use JsonSchema.OneOf with multiple JsonSchemas and generate TypeScript union types out of it.
The current implementation of
TypeResolverBase.RemoveNullability
"destroys" the JsonSchema.OneOf collection to the first non nullable item:So we end up with the first non nullable item instead of the whole OneOf collection with multiple non nullable items.
Currently we use an ugly hack in
GetOrGenerateTypeName
to circumvent the problem:IsNullableRaw = true
(so RemoveNullability does not replace our OneOf schema with the first item)GetOrGenerateTypeName
IsNullableRaw = null
Making
TypeResolverBase.RemoveNullability
virtual gives the possibility to override the current behaviour.The text was updated successfully, but these errors were encountered: