Replies: 1 comment
|
ASP.NET Core obtains the initial JSON Schema from the ASP.NET Core subsequently maps the The important semantic difference is:
In your generated schema, The exporter uses If a particular client generator requires builder.Services.AddOpenApi(options =>
{
options.AddSchemaTransformer((schema, context, cancellationToken) =>
{
if (context.JsonTypeInfo.Type == typeof(Pet) &&
schema.AnyOf is { Count: > 0 })
{
schema.OneOf = schema.AnyOf;
schema.AnyOf = null;
}
return Task.CompletedTask;
});
});Schema transformers are the supported customization point: I would keep the default unless a downstream tool specifically needs If this explains the generated result and solves the interoperability concern, you can mark it as the accepted answer so future readers can find the distinction quickly. |
Uh oh!
There was an error while loading. Please reload this page.
Given the following hierarchy:
it generates:
Wouldn't
oneOfmake more sense here?Petcan be exactlyPigorHorse, but not both.All reactions