-
Notifications
You must be signed in to change notification settings - Fork 270
Closed
Milestone
Description
I am running into unexpected errors when loading an OpenAPI document from tests via the OpenApiDocument.Load APIs in 2.0.0-preview4.
Repro code:
using Microsoft.OpenApi;
using Microsoft.OpenApi.Models;
using System.IO;
using System.Text;
var contents = """
{
"openapi": "3.1.1",
"info": {
"title": "GetDocumentSample | v1",
"version": "1.0.0"
},
"paths": {
"/hello/{name}": {
"get": {
"tags": [
{
"name": "GetDocumentSample"
}
],
"parameters": [
{
"name": "name",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"text/plain": {
"schema": {
"type": "string"
}
}
}
}
}
}
}
},
"tags": [
{
"name": "GetDocumentSample"
}
]
}
""";
var (Document, Diagnostic) = OpenApiDocument.Load(new MemoryStream(Encoding.UTF8.GetBytes(contents)), "json");
foreach (var error in Diagnostic.Errors)
{
System.Console.WriteLine(error);
}Produces the following error:
Expected a value.
There is no node associated with the error so it's not possible to determine what aspect of the document are incorrect. This document was serialized using the same version of the Microsoft.OpenApi package.
Metadata
Metadata
Assignees
Labels
No labels