Skip to content

Commit b509007

Browse files
baywetCopilot
andcommitted
chore(reader): normalize JsonNode variable casing
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8cafa7b commit b509007

116 files changed

Lines changed: 305 additions & 305 deletions

File tree

Some content is hidden

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

src/Microsoft.OpenApi/Interfaces/IOpenApiVersionService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ internal interface IOpenApiVersionService
2525
/// <summary>
2626
/// Converts a generic JsonNode instance into a strongly typed OpenApiDocument
2727
/// </summary>
28-
/// <param name="JsonNode">JsonNode containing the information to be converted into an OpenAPI Document</param>
28+
/// <param name="jsonNode">JsonNode containing the information to be converted into an OpenAPI Document</param>
2929
/// <param name="location">Location of where the document that is getting loaded is saved</param>
3030
/// <param name="context">The current parsing context.</param>
3131
/// <returns>Instance of OpenApiDocument populated with data from JsonNode</returns>
32-
OpenApiDocument LoadDocument(JsonNode JsonNode, Uri location, ParsingContext context);
32+
OpenApiDocument LoadDocument(JsonNode jsonNode, Uri location, ParsingContext context);
3333

3434
/// <summary>
3535
/// Gets the description and summary scalar values in a reference object for V3.1 support
3636
/// </summary>
37-
/// <param name="JsonObject">A Json object.</param>
37+
/// <param name="jsonObject">A Json object.</param>
3838
/// <param name="scalarValue">The scalar value we're parsing.</param>
3939
/// <returns>The resulting node value.</returns>
40-
string? GetReferenceScalarValues(JsonObject JsonObject, string scalarValue);
40+
string? GetReferenceScalarValues(JsonObject jsonObject, string scalarValue);
4141
}
4242
}

src/Microsoft.OpenApi/Models/BaseOpenApiReference.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ internal void EnsureHostDocumentIsSet(OpenApiDocument currentDocument)
302302
/// <param name="key">The key of the property</param>
303303
/// <returns>The property value</returns>
304304
protected internal static string? GetPropertyValueFromNode(JsonObject jsonObject, string key) =>
305-
jsonObject.TryGetPropertyValue(key, out var JsonNode) && JsonNode is JsonValue valueCast && valueCast.TryGetValue<string>(out var strValue) ? strValue : null;
305+
jsonObject.TryGetPropertyValue(key, out var jsonNode) && jsonNode is JsonValue valueCast && valueCast.TryGetValue<string>(out var strValue) ? strValue : null;
306306
internal virtual void SetMetadataFromJsonObject(JsonObject jsonObject)
307307
{
308308
SetAdditional31MetadataFromMapNode(jsonObject);

src/Microsoft.OpenApi/Reader/BaseOpenApiVersionService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected BaseOpenApiVersionService(OpenApiDiagnostic diagnostic)
1919

2020
internal abstract Dictionary<Type, Func<JsonNode, OpenApiDocument, ParsingContext, object?>> Loaders { get; }
2121

22-
public abstract OpenApiDocument LoadDocument(JsonNode JsonNode, Uri location, ParsingContext context);
22+
public abstract OpenApiDocument LoadDocument(JsonNode jsonNode, Uri location, ParsingContext context);
2323

2424
public T? LoadElement<T>(JsonNode node, OpenApiDocument doc, ParsingContext context) where T : IOpenApiElement
2525
{
@@ -29,15 +29,15 @@ protected BaseOpenApiVersionService(OpenApiDiagnostic diagnostic)
2929
}
3030
return default;
3131
}
32-
public virtual string? GetReferenceScalarValues(JsonObject JsonObject, string scalarValue)
32+
public virtual string? GetReferenceScalarValues(JsonObject jsonObject, string scalarValue)
3333
{
34-
if (JsonObject.Any(static x => !"$ref".Equals(x.Key, StringComparison.OrdinalIgnoreCase)) &&
35-
JsonObject
34+
if (jsonObject.Any(static x => !"$ref".Equals(x.Key, StringComparison.OrdinalIgnoreCase)) &&
35+
jsonObject
3636
.Where(x => x.Key.Equals(scalarValue))
3737
.Select(static x => x.Value)
38-
.OfType<JsonValue>().FirstOrDefault() is {} JsonNode)
38+
.OfType<JsonValue>().FirstOrDefault() is {} jsonNode)
3939
{
40-
return JsonNode.GetScalarValue();
40+
return jsonNode.GetScalarValue();
4141
}
4242

4343
return null;

src/Microsoft.OpenApi/Reader/JsonNodeHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ internal static class JsonNodeHelper
1313
{
1414
public static JsonObject CheckMapNode(this JsonNode? node, string nodeName, ParsingContext context)
1515
{
16-
if (node is not JsonObject JsonObject)
16+
if (node is not JsonObject jsonObject)
1717
{
1818
throw new OpenApiReaderException($"{nodeName} must be a map/object", context);
1919
}
2020

21-
return JsonObject;
21+
return jsonObject;
2222
}
2323

2424
public static List<T> CreateList<T>(this JsonNode? node, Func<JsonNode, OpenApiDocument, ParsingContext, T> map, OpenApiDocument hostDocument, ParsingContext context)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;

src/Microsoft.OpenApi/Reader/ParsingContext.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ public OpenApiDocument Parse(JsonNode jsonNode, Uri location)
140140
/// <summary>
141141
/// Gets the version of the Open API document.
142142
/// </summary>
143-
private static string GetVersion(JsonNode JsonNode)
143+
private static string GetVersion(JsonNode jsonNode)
144144
{
145-
var versionNode = new JsonPointer("/openapi").Find(JsonNode);
145+
var versionNode = new JsonPointer("/openapi").Find(jsonNode);
146146

147147
if (versionNode is not null)
148148
{
149149
return versionNode.GetScalarValue()?.Replace("\"", string.Empty)
150150
?? throw new OpenApiException("Version node not found.");
151151
}
152152

153-
versionNode = new JsonPointer("/swagger").Find(JsonNode);
153+
versionNode = new JsonPointer("/swagger").Find(jsonNode);
154154

155155
return versionNode?.GetScalarValue()?.Replace("\"", string.Empty) ?? throw new OpenApiException("Version node not found.");
156156
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ internal static partial class OpenApiV2Deserializer
4343

4444
public static OpenApiContact LoadContact(JsonNode node, OpenApiDocument hostDocument, ParsingContext context)
4545
{
46-
var JsonObject = node as JsonObject;
46+
var jsonObject = node as JsonObject;
4747
var contact = new OpenApiContact();
4848

49-
ParseMap(JsonObject, contact, _contactFixedFields, _contactPatternFields, hostDocument, context);
49+
ParseMap(jsonObject, contact, _contactFixedFields, _contactPatternFields, hostDocument, context);
5050

5151
return contact;
5252
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ internal static partial class OpenApiV2Deserializer
114114
{s => s.StartsWith(OpenApiConstants.ExtensionFieldNamePrefix, StringComparison.OrdinalIgnoreCase), (o, p, n, _, c) => o.AddExtension(p, LoadExtension(p, n, c))}
115115
};
116116

117-
private static void MakeServers(IList<OpenApiServer> servers, ParsingContext context, JsonNode JsonNode)
117+
private static void MakeServers(IList<OpenApiServer> servers, ParsingContext context, JsonNode jsonNode)
118118
{
119119
var host = context.GetFromTempStorage<string>("host");
120120
var basePath = context.GetFromTempStorage<string>("basePath");
@@ -231,14 +231,14 @@ private static string BuildUrl(string? scheme, string? host, string? basePath)
231231
return uriBuilder.ToString();
232232
}
233233

234-
public static OpenApiDocument LoadOpenApi(JsonNode JsonNode, Uri location, ParsingContext context)
234+
public static OpenApiDocument LoadOpenApi(JsonNode jsonNode, Uri location, ParsingContext context)
235235
{
236236
var openApiDoc = new OpenApiDocument
237237
{
238238
BaseUri = location
239239
};
240240

241-
var openApiNode = JsonNode.CheckMapNode("OpenAPI", context);
241+
var openApiNode = jsonNode.CheckMapNode("OpenAPI", context);
242242

243243
ParseMap(openApiNode, openApiDoc, _openApiFixedFields, _openApiPatternFields, openApiDoc, context);
244244

@@ -259,7 +259,7 @@ public static OpenApiDocument LoadOpenApi(JsonNode JsonNode, Uri location, Parsi
259259
openApiDoc.Servers = [];
260260
}
261261

262-
MakeServers(openApiDoc.Servers, context, JsonNode);
262+
MakeServers(openApiDoc.Servers, context, jsonNode);
263263

264264
FixRequestBodyReferences(openApiDoc);
265265

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ internal static partial class OpenApiV2Deserializer
4848

4949
public static OpenApiExternalDocs LoadExternalDocs(JsonNode node, OpenApiDocument hostDocument, ParsingContext context)
5050
{
51-
var JsonObject = node.CheckMapNode("externalDocs", context);
51+
var jsonObject = node.CheckMapNode("externalDocs", context);
5252

5353
var externalDocs = new OpenApiExternalDocs();
5454

55-
ParseMap(JsonObject, externalDocs, _externalDocsFixedFields, _externalDocsPatternFields, hostDocument, context);
55+
ParseMap(jsonObject, externalDocs, _externalDocsFixedFields, _externalDocsPatternFields, hostDocument, context);
5656

5757
return externalDocs;
5858
}

0 commit comments

Comments
 (0)