diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs index 92643cb92..dad25cae7 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs @@ -21,22 +21,22 @@ internal static partial class OpenApiV2Deserializer private static FixedFieldMap _openApiFixedFields = new() { { - "swagger", (o, n) => + "swagger", (_, _) => { } /* Version is valid field but we already parsed it */ }, {"info", (o, n) => o.Info = LoadInfo(n)}, - {"host", (o, n) => n.Context.SetTempStorage("host", n.GetScalarValue())}, - {"basePath", (o, n) => n.Context.SetTempStorage("basePath", n.GetScalarValue())}, + {"host", (_, n) => n.Context.SetTempStorage("host", n.GetScalarValue())}, + {"basePath", (_, n) => n.Context.SetTempStorage("basePath", n.GetScalarValue())}, { - "schemes", (o, n) => n.Context.SetTempStorage( + "schemes", (_, n) => n.Context.SetTempStorage( "schemes", n.CreateSimpleList( s => s.GetScalarValue())) }, { "consumes", - (o, n) => + (_, n) => { var consumes = n.CreateSimpleList(s => s.GetScalarValue()); if (consumes.Count > 0) @@ -46,7 +46,7 @@ internal static partial class OpenApiV2Deserializer } }, { - "produces", (o, n) => { + "produces", (_, n) => { var produces = n.CreateSimpleList(s => s.GetScalarValue()); if (produces.Count > 0) { diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs index c7a7d723b..151c6b3bb 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs @@ -57,7 +57,7 @@ internal static partial class OpenApiV2Deserializer } }, { - "consumes", (o, n) => { + "consumes", (_, n) => { var consumes = n.CreateSimpleList(s => s.GetScalarValue()); if (consumes.Count > 0) { n.Context.SetTempStorage(TempStorageKeys.OperationConsumes,consumes); @@ -65,7 +65,7 @@ internal static partial class OpenApiV2Deserializer } }, { - "produces", (o, n) => { + "produces", (_, n) => { var produces = n.CreateSimpleList(s => s.GetScalarValue()); if (produces.Count > 0) { n.Context.SetTempStorage(TempStorageKeys.OperationProduces, produces); @@ -185,7 +185,7 @@ private static OpenApiRequestBody CreateFormBody(ParsingContext context, List k, - v => mediaType) + _ => mediaType) }; return formBody; @@ -205,7 +205,7 @@ internal static OpenApiRequestBody CreateRequestBody( Required = bodyParameter.Required, Content = consumes.ToDictionary( k => k, - v => new OpenApiMediaType + _ => new OpenApiMediaType { Schema = bodyParameter.Schema }), diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs index 3cb9efe52..40596cac7 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs @@ -47,27 +47,27 @@ internal static partial class OpenApiV2Deserializer {"name", (o, n) => o.Name = n.GetScalarValue()}, {"in", (o, n) => o.In = n.GetScalarValue().GetEnumFromDisplayName()}, { - "flow", (o, n) => + "flow", (_, n) => { _flowValue = n.GetScalarValue(); } }, { "authorizationUrl", - (o, n) => + (_, n) => { _flow.AuthorizationUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); } }, { "tokenUrl", - (o, n) => + (_, n) => { _flow.TokenUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); } }, { - "scopes", (o, n) => + "scopes", (_, n) => { _flow.Scopes = n.CreateSimpleMap(LoadString); } diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiDocumentDeserializer.cs index a4d16a429..edeca23ad 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiDocumentDeserializer.cs @@ -16,7 +16,7 @@ internal static partial class OpenApiV3Deserializer private static FixedFieldMap _openApiFixedFields = new() { { - "openapi", (o, n) => + "openapi", (_, _) => { } /* Version is valid field but we already parsed it */ }, diff --git a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs index 31b7282f3..fb70a2965 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs @@ -109,7 +109,7 @@ public void SerializeAsV3(IOpenApiWriter writer) writer.WriteOptionalMap( OpenApiConstants.Schemas, Schemas, - (w, key, component) => { + (w, _, component) => { component.SerializeAsV3WithoutReference(w); }); } diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index c2fa42890..27d8e3d25 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -173,7 +173,7 @@ public void SerializeAsV2(IOpenApiWriter writer) writer.WriteOptionalMap( OpenApiConstants.Definitions, openApiSchemas, - (w, key, component) => + (w, _, component) => { component.SerializeAsV2WithoutReference(w); }); diff --git a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs index 94bd995c4..fa1b9911e 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs @@ -304,12 +304,12 @@ private static void ValidateFilters(IDictionary> requestUrl { if (operationIds == "*") { - return (url, operationType, operation) => true; // All operations + return (_, _, _) => true; // All operations } else { var operationIdsArray = operationIds.Split(','); - return (url, operationType, operation) => operationIdsArray.Contains(operation.OperationId); + return (_, _, operation) => operationIdsArray.Contains(operation.OperationId); } } @@ -319,11 +319,11 @@ private static void ValidateFilters(IDictionary> requestUrl if (tagsArray.Length == 1) { var regex = new Regex(tagsArray[0]); - return (url, operationType, operation) => operation.Tags.Any(tag => regex.IsMatch(tag.Name)); + return (_, _, operation) => operation.Tags.Any(tag => regex.IsMatch(tag.Name)); } else { - return (url, operationType, operation) => operation.Tags.Any(tag => tagsArray.Contains(tag.Name)); + return (_, _, operation) => operation.Tags.Any(tag => tagsArray.Contains(tag.Name)); } } @@ -357,7 +357,7 @@ private static void ValidateFilters(IDictionary> requestUrl } // predicate for matching url and operationTypes - return (path, operationType, operation) => operationTypes.Contains(operationType + path); + return (path, operationType, _) => operationTypes.Contains(operationType + path); } private static List GetOperationTypes(IDictionary openApiOperations, List url, string path) diff --git a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs index a0fa62eae..2ebb62071 100644 --- a/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs +++ b/src/Microsoft.OpenApi/Writers/OpenApiWriterExtensions.cs @@ -367,7 +367,7 @@ private static void WriteMapInternal( IDictionary elements, Action action) { - WriteMapInternal(writer, name, elements, (w, k, s) => action(w, s)); + WriteMapInternal(writer, name, elements, (w, _, s) => action(w, s)); } private static void WriteMapInternal( diff --git a/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs b/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs index 50013739c..561cde431 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs @@ -27,7 +27,7 @@ public void ParseCustomExtension() """; var settings = new OpenApiReaderSettings { - ExtensionParsers = { { "x-foo", (a,v) => { + ExtensionParsers = { { "x-foo", (a,_) => { var fooNode = (OpenApiObject)a; return new FooExtension { diff --git a/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs b/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs index b145f9ab9..d2c4a1b70 100644 --- a/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs +++ b/test/Microsoft.OpenApi.Tests/Validations/OpenApiReferenceValidationTests.cs @@ -152,7 +152,7 @@ public void UnresolvedSchemaReferencedShouldNotBeValidated() public class AlwaysFailRule : ValidationRule where T : IOpenApiElement { - public AlwaysFailRule() : base((c, t) => c.CreateError("x", "y")) + public AlwaysFailRule() : base((c, _) => c.CreateError("x", "y")) { } }