-
Notifications
You must be signed in to change notification settings - Fork 280
Closed
Labels
priority:p2Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 daysMedium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days
Milestone
Description
Swagger file for reproduction: Microsoft WorkItemTracking Sagger JSON
Hi,
something is wrong with serialization or I am missing something. When you try to serialize an OpenApiSchema instance, with OpenApiSchema.Serialze, OpenApiSchema.SerializeAsV2 or OpenApiSchema.SerializeAsV3 it does not fully resolve references. If you check the parsed OpenApiDocument instance, everthing is resolved and fine.
Code is something like this:
var settings = new OpenApiReaderSettings() { ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences };
var openApiDocument = new OpenApiStringReader(settings).Read(documentAsString, out var diagnostic);
OpenApiSchema schema = GetSchema(); // get response schema instance at line 6453
var sb = new StringBuilder();
var writer = new OpenApiJsonWriter(new StringWriter(sb), new OpenApiWriterSettings { ReferenceInline = ReferenceInlineSetting.InlineLocalReferences });
schema.Serialize(writer, diagnostic.SpecificationVersion);
string serializedSchema = sb.ToString(); // Not fully resolvedWhen I serialize the OpenApiSchema instance with e.g. System.Text.Json.JsonSerializer, it works.
Metadata
Metadata
Assignees
Labels
priority:p2Medium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 daysMedium. Generally has a work-around and a smaller sub-set of customers is affected. SLA <=30 days