OpenAPIDocument with schemaType=OpenApi3 uses Newtonsoft.Json static serializer with default settings.
Expected behavior: Serialization is performed with System.Text.Json serializer and Mvc.JsonOptions \ Http.Json.JsonOptions are used during serialization.
Or provide a way to configure the serialization settings - so we can add custom JsonConverter's, null value handling, etc. Also it will help to get expected serialized content for custom Examples for operation responses \ request parameters.
OpenApiDocument.cs
/// <summary>Converts the description object to JSON.</summary>
/// <param name="schemaType">The schema type.</param>
/// <param name="formatting">The formatting.</param>
/// <returns>The JSON string.</returns>
public string ToJson(SchemaType schemaType, Formatting formatting)
{
GenerateOperationIds();
var contractResolver = GetJsonSerializerContractResolver(schemaType);
return JsonSchemaSerialization.ToJson(this, schemaType, contractResolver, formatting);
}
OpenAPIDocument with schemaType=OpenApi3 uses Newtonsoft.Json static serializer with default settings. Expected behavior: Serialization is performed with System.Text.Json serializer and Mvc.JsonOptions \ Http.Json.JsonOptions are used during serialization. Or provide a way to configure the serialization settings - so we can add custom JsonConverter's, null value handling, etc. Also it will help to get expected serialized content for custom Examples for operation responses \ request parameters.
OpenApiDocument.cs
JsonSchemaSerialization.cs