Skip to content

Commit f7e34be

Browse files
authored
fix: typo in allowReserved property name for deserialization
1 parent 43282ec commit f7e34be

File tree

1 file changed

+52
-54
lines changed

1 file changed

+52
-54
lines changed
Lines changed: 52 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,74 @@
11
using System;
22

3-
namespace Microsoft.OpenApi.Reader.V31
3+
namespace Microsoft.OpenApi.Reader.V31;
4+
/// <summary>
5+
/// Class containing logic to deserialize Open API V31 document into
6+
/// runtime Open API object model.
7+
/// </summary>
8+
internal static partial class OpenApiV31Deserializer
49
{
5-
/// <summary>
6-
/// Class containing logic to deserialize Open API V31 document into
7-
/// runtime Open API object model.
8-
/// </summary>
9-
internal static partial class OpenApiV31Deserializer
10+
private static readonly FixedFieldMap<OpenApiEncoding> _encodingFixedFields = new()
1011
{
11-
private static readonly FixedFieldMap<OpenApiEncoding> _encodingFixedFields = new()
1212
{
13+
"contentType", (o, n, _) =>
1314
{
14-
"contentType", (o, n, _) =>
15-
{
16-
o.ContentType = n.GetScalarValue();
17-
}
18-
},
15+
o.ContentType = n.GetScalarValue();
16+
}
17+
},
18+
{
19+
"headers", (o, n, t) =>
1920
{
20-
"headers", (o, n, t) =>
21-
{
22-
o.Headers = n.CreateMap(LoadHeader, t);
23-
}
24-
},
21+
o.Headers = n.CreateMap(LoadHeader, t);
22+
}
23+
},
24+
{
25+
"style", (o, n, _) =>
2526
{
26-
"style", (o, n, _) =>
27+
if(!n.GetScalarValue().TryGetEnumFromDisplayName<ParameterStyle>(n.Context, out var style))
2728
{
28-
if(!n.GetScalarValue().TryGetEnumFromDisplayName<ParameterStyle>(n.Context, out var style))
29-
{
30-
return;
31-
}
32-
o.Style = style;
29+
return;
3330
}
34-
},
31+
o.Style = style;
32+
}
33+
},
34+
{
35+
"explode", (o, n, _) =>
3536
{
36-
"explode", (o, n, _) =>
37+
var explode = n.GetScalarValue();
38+
if (explode is not null)
3739
{
38-
var explode = n.GetScalarValue();
39-
if (explode is not null)
40-
{
41-
o.Explode = bool.Parse(explode);
42-
}
43-
}
44-
},
40+
o.Explode = bool.Parse(explode);
41+
}
42+
}
43+
},
44+
{
45+
"allowReserved", (o, n, _) =>
4546
{
46-
"allowReserved", (o, n, _) =>
47+
var allowReserved = n.GetScalarValue();
48+
if (allowReserved is not null)
4749
{
48-
var allowReserved = n.GetScalarValue();
49-
if (allowReserved is not null)
50-
{
51-
o.AllowReserved = bool.Parse(allowReserved);
52-
}
50+
o.AllowReserved = bool.Parse(allowReserved);
5351
}
54-
},
55-
};
56-
57-
private static readonly PatternFieldMap<OpenApiEncoding> _encodingPatternFields =
58-
new()
59-
{
60-
{s => s.StartsWith(OpenApiConstants.ExtensionFieldNamePrefix, StringComparison.OrdinalIgnoreCase), (o, p, n, _) => o.AddExtension(p, LoadExtension(p,n))}
61-
};
52+
}
53+
},
54+
};
6255

63-
public static OpenApiEncoding LoadEncoding(ParseNode node, OpenApiDocument hostDocument)
56+
private static readonly PatternFieldMap<OpenApiEncoding> _encodingPatternFields =
57+
new()
6458
{
65-
var mapNode = node.CheckMapNode("encoding");
59+
{s => s.StartsWith(OpenApiConstants.ExtensionFieldNamePrefix, StringComparison.OrdinalIgnoreCase), (o, p, n, _) => o.AddExtension(p, LoadExtension(p,n))}
60+
};
6661

67-
var encoding = new OpenApiEncoding();
68-
foreach (var property in mapNode)
69-
{
70-
property.ParseField(encoding, _encodingFixedFields, _encodingPatternFields, hostDocument);
71-
}
62+
public static OpenApiEncoding LoadEncoding(ParseNode node, OpenApiDocument hostDocument)
63+
{
64+
var mapNode = node.CheckMapNode("encoding");
7265

73-
return encoding;
66+
var encoding = new OpenApiEncoding();
67+
foreach (var property in mapNode)
68+
{
69+
property.ParseField(encoding, _encodingFixedFields, _encodingPatternFields, hostDocument);
7470
}
71+
72+
return encoding;
7573
}
7674
}

0 commit comments

Comments
 (0)