Skip to content
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

Polymorphic Schema Generation #1706

Open
Yoztastic opened this issue Jun 18, 2024 · 0 comments
Open

Polymorphic Schema Generation #1706

Yoztastic opened this issue Jun 18, 2024 · 0 comments

Comments

@Yoztastic
Copy link

https://github.com/RicoSuter/NJsonSchema/wiki/Inheritance

Using System.Text.Json

[JsonConverter(typeof(JsonInheritanceConverter), "discriminator")] as advised above does not compile for the reason JsonConverter constructor takes a single parameter.

It appears more likely it should be something like

[JsonInheritanceConverter(typeof(MyInheritingType), "discriminator")]

However this does not have the desired effect the schema only includes the base type

"$ref": "#/components/schemas/MyBaseType"

Where I would be expecting

"oneOf": [ { "$ref": "#/components/schemas/MyInheritingType" } ]

Or something similar.

Does https://github.com/RicoSuter/NJsonSchema/wiki/Inheritance still represent upto data documentation?

Is there something else I need to get this to work?

BTW I am using NJsonSchema transitively Via FastEndpoints and using .net8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant