[API Proposal]: Expose polymorphic base type in JsonSchemaExporterContext
#104046
Labels
api-ready-for-review
API is ready for review, it is NOT ready for implementation
area-System.Text.Json
blocking
Marks issues that we want to fast track in order to unblock other important work
Milestone
Background and motivation
For some derivations of JSON schema (particularly OpenAPI), it is necessary to modify the schemas generated by STJ for polymorphic types to correspond with the constraints of the spec. For example, OpenAPI prohibits subschemas that don't contain a type discriminator for a polymorphic type.
To aid implementers in complying with these constraints, a new property should be added to
JsonSchemaExporterContext
to support resolving the base type a derived type is being generated for. Currently, the only way to determine if we are generating a schema for a derived type is by inspecting theJsonPath
. This doesn't give us any information about the base type that we are associated with.API Proposal
API Usage
Alternative Designs
No response
Risks
No response
The text was updated successfully, but these errors were encountered: