-
Notifications
You must be signed in to change notification settings - Fork 280
Closed
Labels
type:bugA broken experienceA broken experience
Milestone
Description
Describe the bug
Reading an OpenAPI document containing an example value of type integer will switch the type to string.
Microsoft.OpenApi.Readers 1.6.3
To Reproduce
Use the following code with Microsoft.OpenApi.Readers 1.6.3.
Open the two files in a compare tool.
Code:
using var stream = new FileStream(readFile, FileMode.Open, FileAccess.Read);
var doc =
new OpenApiStreamReader(
new OpenApiReaderSettings
{
ReferenceResolution = ReferenceResolutionSetting.DoNotResolveReferences
})
.Read(stream, out _);
var sb = new StringBuilder();
var writer = new OpenApiYamlWriter(new StringWriter(sb, new CultureInfo("en_us")));
doc.SerializeAsV3(writer);
File.WriteAllText(writeFile, sb.ToString());
readFile:
openapi: 3.0.1
info:
title: example
description: Sample description
version: 0.1.9
paths:
/foo:
get:
responses:
'200':
description: bla bla
components:
examples:
FooInt:
value: 666
writeFile:
openapi: 3.0.1
info:
title: example
description: Sample description
version: 0.1.9
paths:
/foo:
get:
responses:
'200':
description: bla bla
components:
examples:
FooInt:
value: '666'
Expected behavior
The content of writeFile and readFile should be equal.
Additional context
Metadata
Metadata
Assignees
Labels
type:bugA broken experienceA broken experience
