Skip to content

Commit 2b1613f

Browse files
committed
Make static fields readonly
1 parent 984aa09 commit 2b1613f

16 files changed

+30
-30
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.OpenApi.Readers.V2
1414
/// </summary>
1515
internal static partial class OpenApiV2Deserializer
1616
{
17-
private static FixedFieldMap<OpenApiContact> _contactFixedFields = new FixedFieldMap<OpenApiContact>
17+
private static readonly FixedFieldMap<OpenApiContact> _contactFixedFields = new FixedFieldMap<OpenApiContact>
1818
{
1919
{
2020
"name", (o, n) =>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace Microsoft.OpenApi.Readers.V2
1919
/// </summary>
2020
internal static partial class OpenApiV2Deserializer
2121
{
22-
private static FixedFieldMap<OpenApiDocument> _openApiFixedFields = new FixedFieldMap<OpenApiDocument>
22+
private static readonly FixedFieldMap<OpenApiDocument> _openApiFixedFields = new FixedFieldMap<OpenApiDocument>
2323
{
2424
{
2525
"swagger", (o, n) =>
@@ -125,7 +125,7 @@ internal static partial class OpenApiV2Deserializer
125125
{"externalDocs", (o, n) => o.ExternalDocs = LoadExternalDocs(n)}
126126
};
127127

128-
private static PatternFieldMap<OpenApiDocument> _openApiPatternFields = new PatternFieldMap<OpenApiDocument>
128+
private static readonly PatternFieldMap<OpenApiDocument> _openApiPatternFields = new PatternFieldMap<OpenApiDocument>
129129
{
130130
// We have no semantics to verify X- nodes, therefore treat them as just values.
131131
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p, n))}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.OpenApi.Readers.V2
1414
/// </summary>
1515
internal static partial class OpenApiV2Deserializer
1616
{
17-
private static FixedFieldMap<OpenApiLicense> _licenseFixedFields = new FixedFieldMap<OpenApiLicense>
17+
private static readonly FixedFieldMap<OpenApiLicense> _licenseFixedFields = new FixedFieldMap<OpenApiLicense>
1818
{
1919
{
2020
"name", (o, n) =>
@@ -30,7 +30,7 @@ internal static partial class OpenApiV2Deserializer
3030
},
3131
};
3232

33-
private static PatternFieldMap<OpenApiLicense> _licensePatternFields = new PatternFieldMap<OpenApiLicense>
33+
private static readonly PatternFieldMap<OpenApiLicense> _licensePatternFields = new PatternFieldMap<OpenApiLicense>
3434
{
3535
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p, n))}
3636
};

src/Microsoft.OpenApi.Readers/V2/OpenApiPathsDeserializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace Microsoft.OpenApi.Readers.V2
1313
/// </summary>
1414
internal static partial class OpenApiV2Deserializer
1515
{
16-
private static FixedFieldMap<OpenApiPaths> _pathsFixedFields = new FixedFieldMap<OpenApiPaths>();
16+
private static readonly FixedFieldMap<OpenApiPaths> _pathsFixedFields = new FixedFieldMap<OpenApiPaths>();
1717

18-
private static PatternFieldMap<OpenApiPaths> _pathsPatternFields = new PatternFieldMap<OpenApiPaths>
18+
private static readonly PatternFieldMap<OpenApiPaths> _pathsPatternFields = new PatternFieldMap<OpenApiPaths>
1919
{
2020
{s => s.StartsWith("/"), (o, k, n) => o.Add(k, LoadPathItem(n))},
2121
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p, n))}

src/Microsoft.OpenApi.Readers/V3/OpenApiComponentsDeserializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Microsoft.OpenApi.Readers.V3
1818
/// </summary>
1919
internal static partial class OpenApiV3Deserializer
2020
{
21-
private static FixedFieldMap<OpenApiComponents> _componentsFixedFields = new FixedFieldMap<OpenApiComponents>
21+
private static readonly FixedFieldMap<OpenApiComponents> _componentsFixedFields = new FixedFieldMap<OpenApiComponents>
2222
{
2323
{"schemas", (o, n) => o.Schemas = n.CreateMap(LoadSchema)},
2424
{"responses", (o, n) => o.Responses = n.CreateMapWithReference(ReferenceType.Response, LoadResponse)},
@@ -32,7 +32,7 @@ internal static partial class OpenApiV3Deserializer
3232
{"pathItems", (o, n) => o.PathItems = n.CreateMapWithReference(ReferenceType.PathItem, LoadPathItem)}
3333
};
3434

35-
private static PatternFieldMap<OpenApiComponents> _componentsPatternFields =
35+
private static readonly PatternFieldMap<OpenApiComponents> _componentsPatternFields =
3636
new PatternFieldMap<OpenApiComponents>
3737
{
3838
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p, n))}

src/Microsoft.OpenApi.Readers/V3/OpenApiContactDeserializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.OpenApi.Readers.V3
1414
/// </summary>
1515
internal static partial class OpenApiV3Deserializer
1616
{
17-
private static FixedFieldMap<OpenApiContact> _contactFixedFields = new FixedFieldMap<OpenApiContact>
17+
private static readonly FixedFieldMap<OpenApiContact> _contactFixedFields = new FixedFieldMap<OpenApiContact>
1818
{
1919
{
2020
"name", (o, n) =>
@@ -36,7 +36,7 @@ internal static partial class OpenApiV3Deserializer
3636
},
3737
};
3838

39-
private static PatternFieldMap<OpenApiContact> _contactPatternFields = new PatternFieldMap<OpenApiContact>
39+
private static readonly PatternFieldMap<OpenApiContact> _contactPatternFields = new PatternFieldMap<OpenApiContact>
4040
{
4141
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p,n))}
4242
};

src/Microsoft.OpenApi.Readers/V3/OpenApiDocumentDeserializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Microsoft.OpenApi.Readers.V3
1313
/// </summary>
1414
internal static partial class OpenApiV3Deserializer
1515
{
16-
private static FixedFieldMap<OpenApiDocument> _openApiFixedFields = new FixedFieldMap<OpenApiDocument>
16+
private static readonly FixedFieldMap<OpenApiDocument> _openApiFixedFields = new FixedFieldMap<OpenApiDocument>
1717
{
1818
{
1919
"openapi", (o, n) =>
@@ -38,7 +38,7 @@ internal static partial class OpenApiV3Deserializer
3838
{"security", (o, n) => o.SecurityRequirements = n.CreateList(LoadSecurityRequirement)}
3939
};
4040

41-
private static PatternFieldMap<OpenApiDocument> _openApiPatternFields = new PatternFieldMap<OpenApiDocument>
41+
private static readonly PatternFieldMap<OpenApiDocument> _openApiPatternFields = new PatternFieldMap<OpenApiDocument>
4242
{
4343
// We have no semantics to verify X- nodes, therefore treat them as just values.
4444
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p, n))}

src/Microsoft.OpenApi.Readers/V3/OpenApiInfoDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ internal static partial class OpenApiV3Deserializer
5454
}
5555
};
5656

57-
public static PatternFieldMap<OpenApiInfo> InfoPatternFields = new PatternFieldMap<OpenApiInfo>
57+
public static readonly PatternFieldMap<OpenApiInfo> InfoPatternFields = new PatternFieldMap<OpenApiInfo>
5858
{
5959
{s => s.StartsWith("x-"), (o, k, n) => o.AddExtension(k,LoadExtension(k, n))}
6060
};

src/Microsoft.OpenApi.Readers/V3/OpenApiLicenseDeserializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace Microsoft.OpenApi.Readers.V3
1414
/// </summary>
1515
internal static partial class OpenApiV3Deserializer
1616
{
17-
private static FixedFieldMap<OpenApiLicense> _licenseFixedFields = new FixedFieldMap<OpenApiLicense>
17+
private static readonly FixedFieldMap<OpenApiLicense> _licenseFixedFields = new FixedFieldMap<OpenApiLicense>
1818
{
1919
{
2020
"name", (o, n) =>
@@ -30,7 +30,7 @@ internal static partial class OpenApiV3Deserializer
3030
},
3131
};
3232

33-
private static PatternFieldMap<OpenApiLicense> _licensePatternFields = new PatternFieldMap<OpenApiLicense>
33+
private static readonly PatternFieldMap<OpenApiLicense> _licensePatternFields = new PatternFieldMap<OpenApiLicense>
3434
{
3535
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p,n))}
3636
};

src/Microsoft.OpenApi.Readers/V3/OpenApiPathsDeserializer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ namespace Microsoft.OpenApi.Readers.V3
1313
/// </summary>
1414
internal static partial class OpenApiV3Deserializer
1515
{
16-
private static FixedFieldMap<OpenApiPaths> _pathsFixedFields = new FixedFieldMap<OpenApiPaths>();
16+
private static readonly FixedFieldMap<OpenApiPaths> _pathsFixedFields = new FixedFieldMap<OpenApiPaths>();
1717

18-
private static PatternFieldMap<OpenApiPaths> _pathsPatternFields = new PatternFieldMap<OpenApiPaths>
18+
private static readonly PatternFieldMap<OpenApiPaths> _pathsPatternFields = new PatternFieldMap<OpenApiPaths>
1919
{
2020
{s => s.StartsWith("/"), (o, k, n) => o.Add(k, LoadPathItem(n))},
2121
{s => s.StartsWith("x-"), (o, p, n) => o.AddExtension(p, LoadExtension(p,n))}

0 commit comments

Comments
 (0)