Skip to content

Commit 0c8ccf2

Browse files
committed
Merge branch 'dev' into chore/reduce-fluent-assertions-dependency
2 parents faca076 + d7c4621 commit 0c8ccf2

File tree

86 files changed

+183
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+183
-185
lines changed

src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ListNode(ParsingContext context, JsonArray jsonArray) : base(
2121
_nodeList = jsonArray;
2222
}
2323

24-
public override List<T> CreateList<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument = null)
24+
public override List<T> CreateList<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument)
2525
{
2626
if (_nodeList == null)
2727
{

src/Microsoft.OpenApi/Reader/ParseNodes/MapNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public PropertyNode this[string key]
4848
}
4949
}
5050

51-
public override Dictionary<string, T> CreateMap<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument = null)
51+
public override Dictionary<string, T> CreateMap<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument)
5252
{
5353
var jsonMap = _node ?? throw new OpenApiReaderException($"Expected map while parsing {typeof(T).Name}", Context);
5454
var nodes = jsonMap.Select(

src/Microsoft.OpenApi/Reader/ParseNodes/ParseNode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ public static ParseNode Create(ParsingContext context, JsonNode node)
4646
return new ValueNode(context, node as JsonValue);
4747
}
4848

49-
public virtual List<T> CreateList<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument = null)
49+
public virtual List<T> CreateList<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument)
5050
{
5151
throw new OpenApiReaderException("Cannot create list from this type of node.", Context);
5252
}
5353

54-
public virtual Dictionary<string, T> CreateMap<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument = null)
54+
public virtual Dictionary<string, T> CreateMap<T>(Func<MapNode, OpenApiDocument, T> map, OpenApiDocument hostDocument)
5555
{
5656
throw new OpenApiReaderException("Cannot create map from this type of node.", Context);
5757
}

src/Microsoft.OpenApi/Reader/ParseNodes/PropertyNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void ParseField<T>(
2727
T parentInstance,
2828
IDictionary<string, Action<T, ParseNode, OpenApiDocument>> fixedFields,
2929
IDictionary<Func<string, bool>, Action<T, string, ParseNode, OpenApiDocument>> patternFields,
30-
OpenApiDocument hostDocument = null)
30+
OpenApiDocument hostDocument)
3131
{
3232
if (fixedFields.TryGetValue(Name, out var fixedFieldMap))
3333
{

src/Microsoft.OpenApi/Reader/V2/OpenApiContactDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ internal static partial class OpenApiV2Deserializer
3535
{s => s.StartsWith("x-"), (o, p, n, _) => o.AddExtension(p, LoadExtension(p, n))}
3636
};
3737

38-
public static OpenApiContact LoadContact(ParseNode node, OpenApiDocument hostDocument = null)
38+
public static OpenApiContact LoadContact(ParseNode node, OpenApiDocument hostDocument)
3939
{
4040
var mapNode = node as MapNode;
4141
var contact = new OpenApiContact();

src/Microsoft.OpenApi/Reader/V2/OpenApiDocumentDeserializer.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,18 @@ internal static partial class OpenApiV2Deserializer
6464
},
6565
{
6666
"parameters",
67-
(o, n, _) =>
67+
(o, n, doc) =>
6868
{
69-
if (o.Components == null)
70-
{
71-
o.Components = new();
72-
}
69+
o.Components ??= new();
7370

7471
o.Components.Parameters = n.CreateMap(LoadParameter, o);
7572

7673
o.Components.RequestBodies = n.CreateMap((p, d) =>
7774
{
7875
var parameter = LoadParameter(node: p, loadRequestBody: true, hostDocument: d);
7976
return parameter != null ? CreateRequestBody(p.Context, parameter) : null;
80-
}
77+
},
78+
doc
8179
);
8280
}
8381
},

src/Microsoft.OpenApi/Reader/V2/OpenApiExternalDocsDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ internal static partial class OpenApiV2Deserializer
3333
{s => s.StartsWith("x-"), (o, p, n, _) => o.AddExtension(p, LoadExtension(p, n))}
3434
};
3535

36-
public static OpenApiExternalDocs LoadExternalDocs(ParseNode node, OpenApiDocument hostDocument = null)
36+
public static OpenApiExternalDocs LoadExternalDocs(ParseNode node, OpenApiDocument hostDocument)
3737
{
3838
var mapNode = node.CheckMapNode("externalDocs");
3939

src/Microsoft.OpenApi/Reader/V2/OpenApiHeaderDeserializer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal static partial class OpenApiV2Deserializer
3232
},
3333
{
3434
"items",
35-
(o, n, _) => GetOrCreateSchema(o).Items = LoadSchema(n)
35+
(o, n, doc) => GetOrCreateSchema(o).Items = LoadSchema(n, doc)
3636
},
3737
{
3838
"collectionFormat",
@@ -102,14 +102,14 @@ private static OpenApiSchema GetOrCreateSchema(OpenApiHeader p)
102102
return p.Schema ??= new();
103103
}
104104

105-
public static OpenApiHeader LoadHeader(ParseNode node, OpenApiDocument hostDocument = null)
105+
public static OpenApiHeader LoadHeader(ParseNode node, OpenApiDocument hostDocument)
106106
{
107107
var mapNode = node.CheckMapNode("header");
108108
var header = new OpenApiHeader();
109109

110110
foreach (var property in mapNode)
111111
{
112-
property.ParseField(header, _headerFixedFields, _headerPatternFields);
112+
property.ParseField(header, _headerFixedFields, _headerPatternFields, hostDocument);
113113
}
114114

115115
var schema = node.Context.GetFromTempStorage<OpenApiSchema>("schema");

src/Microsoft.OpenApi/Reader/V2/OpenApiInfoDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ internal static partial class OpenApiV2Deserializer
4747
{s => s.StartsWith("x-"), (o, p, n, _) => o.AddExtension(p, LoadExtension(p, n))}
4848
};
4949

50-
public static OpenApiInfo LoadInfo(ParseNode node, OpenApiDocument hostDocument = null)
50+
public static OpenApiInfo LoadInfo(ParseNode node, OpenApiDocument hostDocument)
5151
{
5252
var mapNode = node.CheckMapNode("Info");
5353

src/Microsoft.OpenApi/Reader/V2/OpenApiLicenseDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal static partial class OpenApiV2Deserializer
3131
{s => s.StartsWith("x-"), (o, p, n, _) => o.AddExtension(p, LoadExtension(p, n))}
3232
};
3333

34-
public static OpenApiLicense LoadLicense(ParseNode node, OpenApiDocument hostDocument = null)
34+
public static OpenApiLicense LoadLicense(ParseNode node, OpenApiDocument hostDocument)
3535
{
3636
var mapNode = node.CheckMapNode("OpenApiLicense");
3737

0 commit comments

Comments
 (0)