Skip to content

Commit 0600002

Browse files
committed
Serialize type array in v31
1 parent a124aa2 commit 0600002

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Microsoft.OpenApi/Models/OpenApiSchema.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ public OpenApiSchema(OpenApiSchema schema)
339339
V31ExclusiveMaximum = schema?.V31ExclusiveMaximum ?? V31ExclusiveMaximum;
340340
V31ExclusiveMinimum = schema?.V31ExclusiveMinimum ?? V31ExclusiveMinimum;
341341
Type = schema?.Type ?? Type;
342+
TypeArray = schema.TypeArray != null ? new string[schema.TypeArray.Length] : null;
342343
Format = schema?.Format ?? Format;
343344
Description = schema?.Description ?? Description;
344345
Maximum = schema?.Maximum ?? Maximum;
@@ -575,6 +576,7 @@ public void SerializeAsV2(IOpenApiWriter writer)
575576
internal void WriteV31Properties(IOpenApiWriter writer)
576577
{
577578
writer.WriteProperty(OpenApiConstants.DollarSchema, Schema);
579+
writer.WriteOptionalCollection(OpenApiConstants.TypeArray, TypeArray, (w, s) => w.WriteRaw(s));
578580
writer.WriteProperty(OpenApiConstants.Id, Id);
579581
writer.WriteProperty(OpenApiConstants.Comment, Comment);
580582
writer.WriteProperty(OpenApiConstants.Vocabulary, Vocabulary);

0 commit comments

Comments
 (0)