Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2: Top-level tags property incorrectly serialized in document writing #1991

Closed
captainsafia opened this issue Dec 16, 2024 · 1 comment
Closed

Comments

@captainsafia
Copy link
Member

In 2.0.0-preview2, it appears that the tags property in the OpenAPI document isn't serialized correctly as a list of objects. For example, the following code:

using System;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Writers;
using System.IO;
using System.Globalization;

var document = new OpenApiDocument();

document.Tags = [new OpenApiTag { Name = "test" }];

var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture);
var writer = new OpenApiJsonWriter(outputStringWriter);
document.SerializeAsV2(writer);
Console.WriteLine(outputStringWriter.ToString());

Produces the following document:

{
  "swagger": "2.0",
  "info": { },
  "paths": { },
  "tags": [
    "test"
  ]
}

Which in turn cannot be loaded by the serialization APIs without errors. This happens across all OpenAPI versions (SerializeAsV3, SerializeAsV31).

@MaggieKimani1
Copy link
Contributor

MaggieKimani1 commented Dec 19, 2024

This issue has now been fixed by this PR #1939

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants