diff --git a/src/Microsoft.OpenApi.Hidi/Logger.cs b/src/Microsoft.OpenApi.Hidi/Logger.cs index dec4a5f8e..2dd1a4ee3 100644 --- a/src/Microsoft.OpenApi.Hidi/Logger.cs +++ b/src/Microsoft.OpenApi.Hidi/Logger.cs @@ -17,10 +17,7 @@ public static ILoggerFactory ConfigureLogger(LogLevel logLevel) return LoggerFactory.Create((builder) => { builder - .AddSimpleConsole(c => - { - c.IncludeScopes = true; - }) + .AddSimpleConsole(c => c.IncludeScopes = true) #if DEBUG .AddDebug() #endif diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiContactDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiContactDeserializer.cs index 43824c244..c1cab19f0 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiContactDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiContactDeserializer.cs @@ -17,22 +17,16 @@ internal static partial class OpenApiV2Deserializer private static FixedFieldMap _contactFixedFields = new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "url", (o, n) => - { - o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "url", + (o, n) => o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "email", (o, n) => - { - o.Email = n.GetScalarValue(); - } + "email", + (o, n) => o.Email = n.GetScalarValue() }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs index 3d674832f..07bdcb301 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs @@ -21,9 +21,8 @@ internal static partial class OpenApiV2Deserializer private static FixedFieldMap _openApiFixedFields = new() { { - "swagger", (_, _) => - { - } /* Version is valid field but we already parsed it */ + "swagger", (_, _) => {} + /* Version is valid field but we already parsed it */ }, {"info", (o, n) => o.Info = LoadInfo(n)}, {"host", (_, n) => n.Context.SetTempStorage("host", n.GetScalarValue())}, diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiExternalDocsDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiExternalDocsDeserializer.cs index fd2a8f07d..5297a3a72 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiExternalDocsDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiExternalDocsDeserializer.cs @@ -18,16 +18,12 @@ internal static partial class OpenApiV2Deserializer new() { { - OpenApiConstants.Description, (o, n) => - { - o.Description = n.GetScalarValue(); - } + OpenApiConstants.Description, + (o, n) => o.Description = n.GetScalarValue() }, { - OpenApiConstants.Url, (o, n) => - { - o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + OpenApiConstants.Url, + (o, n) => o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiHeaderDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiHeaderDeserializer.cs index d1d6dab0b..a6c99a2d9 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiHeaderDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiHeaderDeserializer.cs @@ -19,112 +19,76 @@ internal static partial class OpenApiV2Deserializer private static readonly FixedFieldMap _headerFixedFields = new() { { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "type", (o, n) => - { - GetOrCreateSchema(o).Type = n.GetScalarValue(); - } + "type", + (o, n) => GetOrCreateSchema(o).Type = n.GetScalarValue() }, { - "format", (o, n) => - { - GetOrCreateSchema(o).Format = n.GetScalarValue(); - } + "format", + (o, n) => GetOrCreateSchema(o).Format = n.GetScalarValue() }, { - "items", (o, n) => - { - GetOrCreateSchema(o).Items = LoadSchema(n); - } + "items", + (o, n) => GetOrCreateSchema(o).Items = LoadSchema(n) }, { - "collectionFormat", (o, n) => - { - LoadStyle(o, n.GetScalarValue()); - } + "collectionFormat", + (o, n) => LoadStyle(o, n.GetScalarValue()) }, { - "default", (o, n) => - { - GetOrCreateSchema(o).Default = n.CreateAny(); - } + "default", + (o, n) => GetOrCreateSchema(o).Default = n.CreateAny() }, { - "maximum", (o, n) => - { - GetOrCreateSchema(o).Maximum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maximum", + (o, n) => GetOrCreateSchema(o).Maximum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "exclusiveMaximum", (o, n) => - { - GetOrCreateSchema(o).ExclusiveMaximum = bool.Parse(n.GetScalarValue()); - } + "exclusiveMaximum", + (o, n) => GetOrCreateSchema(o).ExclusiveMaximum = bool.Parse(n.GetScalarValue()) }, { - "minimum", (o, n) => - { - GetOrCreateSchema(o).Minimum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minimum", + (o, n) => GetOrCreateSchema(o).Minimum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "exclusiveMinimum", (o, n) => - { - GetOrCreateSchema(o).ExclusiveMinimum = bool.Parse(n.GetScalarValue()); - } + "exclusiveMinimum", + (o, n) => GetOrCreateSchema(o).ExclusiveMinimum = bool.Parse(n.GetScalarValue()) }, { - "maxLength", (o, n) => - { - GetOrCreateSchema(o).MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxLength", + (o, n) => GetOrCreateSchema(o).MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minLength", (o, n) => - { - GetOrCreateSchema(o).MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minLength", + (o, n) => GetOrCreateSchema(o).MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "pattern", (o, n) => - { - GetOrCreateSchema(o).Pattern = n.GetScalarValue(); - } + "pattern", + (o, n) => GetOrCreateSchema(o).Pattern = n.GetScalarValue() }, { - "maxItems", (o, n) => - { - GetOrCreateSchema(o).MaxItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxItems", + (o, n) => GetOrCreateSchema(o).MaxItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minItems", (o, n) => - { - GetOrCreateSchema(o).MinItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minItems", + (o, n) => GetOrCreateSchema(o).MinItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "uniqueItems", (o, n) => - { - GetOrCreateSchema(o).UniqueItems = bool.Parse(n.GetScalarValue()); - } + "uniqueItems", + (o, n) => GetOrCreateSchema(o).UniqueItems = bool.Parse(n.GetScalarValue()) }, { - "multipleOf", (o, n) => - { - GetOrCreateSchema(o).MultipleOf = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "multipleOf", + (o, n) => GetOrCreateSchema(o).MultipleOf = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "enum", (o, n) => - { - GetOrCreateSchema(o).Enum = n.CreateListOfAny(); - } + "enum", + (o, n) => GetOrCreateSchema(o).Enum = n.CreateListOfAny() } }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiInfoDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiInfoDeserializer.cs index ffe9045d3..479eaa5c8 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiInfoDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiInfoDeserializer.cs @@ -17,40 +17,28 @@ internal static partial class OpenApiV2Deserializer private static FixedFieldMap _infoFixedFields = new() { { - "title", (o, n) => - { - o.Title = n.GetScalarValue(); - } + "title", + (o, n) => o.Title = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "termsOfService", (o, n) => - { - o.TermsOfService = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "termsOfService", + (o, n) => o.TermsOfService = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "contact", (o, n) => - { - o.Contact = LoadContact(n); - } + "contact", + (o, n) => o.Contact = LoadContact(n) }, { - "license", (o, n) => - { - o.License = LoadLicense(n); - } + "license", + (o, n) => o.License = LoadLicense(n) }, { - "version", (o, n) => - { - o.Version = n.GetScalarValue(); - } + "version", + (o, n) => o.Version = n.GetScalarValue() } }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiLicenseDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiLicenseDeserializer.cs index 965675143..db394087f 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiLicenseDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiLicenseDeserializer.cs @@ -17,16 +17,12 @@ internal static partial class OpenApiV2Deserializer private static FixedFieldMap _licenseFixedFields = new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "url", (o, n) => - { - o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "url", + (o, n) => o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs index 151c6b3bb..098222299 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiOperationDeserializer.cs @@ -27,34 +27,24 @@ internal static partial class OpenApiV2Deserializer valueNode.GetScalarValue())) }, { - "summary", (o, n) => - { - o.Summary = n.GetScalarValue(); - } + "summary", + (o, n) => o.Summary = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "externalDocs", (o, n) => - { - o.ExternalDocs = LoadExternalDocs(n); - } + "externalDocs", + (o, n) => o.ExternalDocs = LoadExternalDocs(n) }, { - "operationId", (o, n) => - { - o.OperationId = n.GetScalarValue(); - } + "operationId", + (o, n) => o.OperationId = n.GetScalarValue() }, { - "parameters", (o, n) => - { - o.Parameters = n.CreateList(LoadParameter); - } + "parameters", + (o, n) => o.Parameters = n.CreateList(LoadParameter) }, { "consumes", (_, n) => { @@ -73,22 +63,16 @@ internal static partial class OpenApiV2Deserializer } }, { - "responses", (o, n) => - { - o.Responses = LoadResponses(n); - } + "responses", + (o, n) => o.Responses = LoadResponses(n) }, { - "deprecated", (o, n) => - { - o.Deprecated = bool.Parse(n.GetScalarValue()); - } + "deprecated", + (o, n) => o.Deprecated = bool.Parse(n.GetScalarValue()) }, { - "security", (o, n) => - { - o.Security = n.CreateList(LoadSecurityRequirement); - } + "security", + (o, n) => o.Security = n.CreateList(LoadSecurityRequirement) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs index 76926ecc2..1c47a340a 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiParameterDeserializer.cs @@ -20,118 +20,80 @@ internal static partial class OpenApiV2Deserializer new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "in", (o, n) => - { - ProcessIn(o, n); - } + "in", + ProcessIn }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "required", (o, n) => - { - o.Required = bool.Parse(n.GetScalarValue()); - } + "required", + (o, n) => o.Required = bool.Parse(n.GetScalarValue()) }, { - "deprecated", (o, n) => - { - o.Deprecated = bool.Parse(n.GetScalarValue()); - } + "deprecated", + (o, n) => o.Deprecated = bool.Parse(n.GetScalarValue()) }, { - "allowEmptyValue", (o, n) => - { - o.AllowEmptyValue = bool.Parse(n.GetScalarValue()); - } + "allowEmptyValue", + (o, n) => o.AllowEmptyValue = bool.Parse(n.GetScalarValue()) }, { - "type", (o, n) => - { - GetOrCreateSchema(o).Type = n.GetScalarValue(); - } + "type", + (o, n) => GetOrCreateSchema(o).Type = n.GetScalarValue() }, { - "items", (o, n) => - { - GetOrCreateSchema(o).Items = LoadSchema(n); - } + "items", + (o, n) => GetOrCreateSchema(o).Items = LoadSchema(n) }, { - "collectionFormat", (o, n) => - { - LoadStyle(o, n.GetScalarValue()); - } + "collectionFormat", + (o, n) => LoadStyle(o, n.GetScalarValue()) }, { - "format", (o, n) => - { - GetOrCreateSchema(o).Format = n.GetScalarValue(); - } + "format", + (o, n) => GetOrCreateSchema(o).Format = n.GetScalarValue() }, { - "minimum", (o, n) => - { - GetOrCreateSchema(o).Minimum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minimum", + (o, n) => GetOrCreateSchema(o).Minimum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "maximum", (o, n) => - { - GetOrCreateSchema(o).Maximum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maximum", + (o, n) => GetOrCreateSchema(o).Maximum = decimal.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "maxLength", (o, n) => - { - GetOrCreateSchema(o).MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxLength", + (o, n) => GetOrCreateSchema(o).MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minLength", (o, n) => - { - GetOrCreateSchema(o).MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minLength", + (o, n) => GetOrCreateSchema(o).MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "readOnly", (o, n) => - { - GetOrCreateSchema(o).ReadOnly = bool.Parse(n.GetScalarValue()); - } + "readOnly", + (o, n) => GetOrCreateSchema(o).ReadOnly = bool.Parse(n.GetScalarValue()) }, { - "default", (o, n) => - { - GetOrCreateSchema(o).Default = n.CreateAny(); - } + "default", + (o, n) => GetOrCreateSchema(o).Default = n.CreateAny() }, { - "pattern", (o, n) => - { - GetOrCreateSchema(o).Pattern = n.GetScalarValue(); - } + "pattern", + (o, n) => GetOrCreateSchema(o).Pattern = n.GetScalarValue() }, { - "enum", (o, n) => - { - GetOrCreateSchema(o).Enum = n.CreateListOfAny(); - } + "enum", + (o, n) => GetOrCreateSchema(o).Enum = n.CreateListOfAny() }, { - "schema", (o, n) => - { - o.Schema = LoadSchema(n); - } + "schema", + (o, n) => o.Schema = LoadSchema(n) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs index d0dd4af8c..afafe425a 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiPathItemDeserializer.cs @@ -32,10 +32,8 @@ internal static partial class OpenApiV2Deserializer {"head", (o, n) => o.AddOperation(OperationType.Head, LoadOperation(n))}, {"patch", (o, n) => o.AddOperation(OperationType.Patch, LoadOperation(n))}, { - "parameters", (o, n) => - { - LoadPathParameters(o,n); - } + "parameters", + LoadPathParameters }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiResponseDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiResponseDeserializer.cs index 09de8ae0b..2fef353ea 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiResponseDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiResponseDeserializer.cs @@ -17,28 +17,20 @@ internal static partial class OpenApiV2Deserializer private static readonly FixedFieldMap _responseFixedFields = new() { { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "headers", (o, n) => - { - o.Headers = n.CreateMap(LoadHeader); - } + "headers", + (o, n) => o.Headers = n.CreateMap(LoadHeader) }, { - "examples", (o, n) => - { - LoadExamples(o, n); - } + "examples", + LoadExamples }, { - "schema", (o, n) => - { - n.Context.SetTempStorage(TempStorageKeys.ResponseSchema, LoadSchema(n), o); - } + "schema", + (o, n) => n.Context.SetTempStorage(TempStorageKeys.ResponseSchema, LoadSchema(n), o) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiSchemaDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiSchemaDeserializer.cs index f1b787c2d..5fd3ba5c8 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiSchemaDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiSchemaDeserializer.cs @@ -18,125 +18,85 @@ internal static partial class OpenApiV2Deserializer private static readonly FixedFieldMap _schemaFixedFields = new() { { - "title", (o, n) => - { - o.Title = n.GetScalarValue(); - } + "title", + (o, n) => o.Title = n.GetScalarValue() }, { - "multipleOf", (o, n) => - { - o.MultipleOf = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture); - } + "multipleOf", + (o, n) => o.MultipleOf = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture) }, { - "maximum", (o, n) => - { - o.Maximum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture); - } + "maximum", + (o, n) => o.Maximum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture) }, { - "exclusiveMaximum", (o, n) => - { - o.ExclusiveMaximum = bool.Parse(n.GetScalarValue()); - } + "exclusiveMaximum", + (o, n) => o.ExclusiveMaximum = bool.Parse(n.GetScalarValue()) }, { - "minimum", (o, n) => - { - o.Minimum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture); - } + "minimum", + (o, n) => o.Minimum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture) }, { - "exclusiveMinimum", (o, n) => - { - o.ExclusiveMinimum = bool.Parse(n.GetScalarValue()); - } + "exclusiveMinimum", + (o, n) => o.ExclusiveMinimum = bool.Parse(n.GetScalarValue()) }, { - "maxLength", (o, n) => - { - o.MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxLength", + (o, n) => o.MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minLength", (o, n) => - { - o.MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minLength", + (o, n) => o.MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "pattern", (o, n) => - { - o.Pattern = n.GetScalarValue(); - } + "pattern", + (o, n) => o.Pattern = n.GetScalarValue() }, { - "maxItems", (o, n) => - { - o.MaxItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxItems", + (o, n) => o.MaxItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minItems", (o, n) => - { - o.MinItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minItems", + (o, n) => o.MinItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "uniqueItems", (o, n) => - { - o.UniqueItems = bool.Parse(n.GetScalarValue()); - } + "uniqueItems", + (o, n) => o.UniqueItems = bool.Parse(n.GetScalarValue()) }, { - "maxProperties", (o, n) => - { - o.MaxProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxProperties", + (o, n) => o.MaxProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minProperties", (o, n) => - { - o.MinProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minProperties", + (o, n) => o.MinProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "required", (o, n) => - { - o.Required = new HashSet(n.CreateSimpleList(n2 => n2.GetScalarValue())); - } + "required", + (o, n) => o.Required = new HashSet(n.CreateSimpleList(n2 => n2.GetScalarValue())) }, { - "enum", (o, n) => - { - o.Enum = n.CreateListOfAny(); - } + "enum", + (o, n) => o.Enum = n.CreateListOfAny() }, { - "type", (o, n) => - { - o.Type = n.GetScalarValue(); - } + "type", + (o, n) => o.Type = n.GetScalarValue() }, { - "allOf", (o, n) => - { - o.AllOf = n.CreateList(LoadSchema); - } + "allOf", + (o, n) => o.AllOf = n.CreateList(LoadSchema) }, { - "items", (o, n) => - { - o.Items = LoadSchema(n); - } + "items", + (o, n) => o.Items = LoadSchema(n) }, { - "properties", (o, n) => - { - o.Properties = n.CreateMap(LoadSchema); - } + "properties", + (o, n) => o.Properties = n.CreateMap(LoadSchema) }, { "additionalProperties", (o, n) => @@ -152,22 +112,16 @@ internal static partial class OpenApiV2Deserializer } }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "format", (o, n) => - { - o.Format = n.GetScalarValue(); - } + "format", + (o, n) => o.Format = n.GetScalarValue() }, { - "default", (o, n) => - { - o.Default = n.CreateAny(); - } + "default", + (o, n) => o.Default = n.CreateAny() }, { "discriminator", (o, n) => @@ -179,28 +133,20 @@ internal static partial class OpenApiV2Deserializer } }, { - "readOnly", (o, n) => - { - o.ReadOnly = bool.Parse(n.GetScalarValue()); - } + "readOnly", + (o, n) => o.ReadOnly = bool.Parse(n.GetScalarValue()) }, { - "xml", (o, n) => - { - o.Xml = LoadXml(n); - } + "xml", + (o, n) => o.Xml = LoadXml(n) }, { - "externalDocs", (o, n) => - { - o.ExternalDocs = LoadExternalDocs(n); - } + "externalDocs", + (o, n) => o.ExternalDocs = LoadExternalDocs(n) }, { - "example", (o, n) => - { - o.Example = n.CreateAny(); - } + "example", + (o, n) => o.Example = n.CreateAny() }, }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs index 40596cac7..87086690f 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiSecuritySchemeDeserializer.cs @@ -47,30 +47,18 @@ internal static partial class OpenApiV2Deserializer {"name", (o, n) => o.Name = n.GetScalarValue()}, {"in", (o, n) => o.In = n.GetScalarValue().GetEnumFromDisplayName()}, { - "flow", (_, n) => - { - _flowValue = n.GetScalarValue(); - } + "flow", (_, n) => _flowValue = n.GetScalarValue() }, { "authorizationUrl", - (_, n) => - { - _flow.AuthorizationUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + (_, n) => _flow.AuthorizationUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { "tokenUrl", - (_, n) => - { - _flow.TokenUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + (_, n) => _flow.TokenUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "scopes", (_, n) => - { - _flow.Scopes = n.CreateSimpleMap(LoadString); - } + "scopes", (_, n) => _flow.Scopes = n.CreateSimpleMap(LoadString) } }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiTagDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiTagDeserializer.cs index 6bdd60692..388b4fdb5 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiTagDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiTagDeserializer.cs @@ -16,22 +16,16 @@ internal static partial class OpenApiV2Deserializer private static readonly FixedFieldMap _tagFixedFields = new() { { - OpenApiConstants.Name, (o, n) => - { - o.Name = n.GetScalarValue(); - } + OpenApiConstants.Name, + (o, n) => o.Name = n.GetScalarValue() }, { - OpenApiConstants.Description, (o, n) => - { - o.Description = n.GetScalarValue(); - } + OpenApiConstants.Description, + (o, n) => o.Description = n.GetScalarValue() }, { - OpenApiConstants.ExternalDocs, (o, n) => - { - o.ExternalDocs = LoadExternalDocs(n); - } + OpenApiConstants.ExternalDocs, + (o, n) => o.ExternalDocs = LoadExternalDocs(n) } }; diff --git a/src/Microsoft.OpenApi.Readers/V2/OpenApiXmlDeserializer.cs b/src/Microsoft.OpenApi.Readers/V2/OpenApiXmlDeserializer.cs index 3be5bfe7b..d11a51d65 100644 --- a/src/Microsoft.OpenApi.Readers/V2/OpenApiXmlDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V2/OpenApiXmlDeserializer.cs @@ -18,10 +18,8 @@ internal static partial class OpenApiV2Deserializer private static readonly FixedFieldMap _xmlFixedFields = new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { "namespace", (o, n) => @@ -37,22 +35,16 @@ internal static partial class OpenApiV2Deserializer } }, { - "prefix", (o, n) => - { - o.Prefix = n.GetScalarValue(); - } + "prefix", + (o, n) => o.Prefix = n.GetScalarValue() }, { - "attribute", (o, n) => - { - o.Attribute = bool.Parse(n.GetScalarValue()); - } + "attribute", + (o, n) => o.Attribute = bool.Parse(n.GetScalarValue()) }, { - "wrapped", (o, n) => - { - o.Wrapped = bool.Parse(n.GetScalarValue()); - } + "wrapped", + (o, n) => o.Wrapped = bool.Parse(n.GetScalarValue()) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiContactDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiContactDeserializer.cs index 7d9f469f8..cd38440fa 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiContactDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiContactDeserializer.cs @@ -17,22 +17,16 @@ internal static partial class OpenApiV3Deserializer private static FixedFieldMap _contactFixedFields = new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "email", (o, n) => - { - o.Email = n.GetScalarValue(); - } + "email", + (o, n) => o.Email = n.GetScalarValue() }, { - "url", (o, n) => - { - o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "url", + (o, n) => o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiDiscriminatorDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiDiscriminatorDeserializer.cs index 93258cffe..0c3df1536 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiDiscriminatorDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiDiscriminatorDeserializer.cs @@ -16,16 +16,12 @@ internal static partial class OpenApiV3Deserializer new() { { - "propertyName", (o, n) => - { - o.PropertyName = n.GetScalarValue(); - } + "propertyName", + (o, n) => o.PropertyName = n.GetScalarValue() }, { - "mapping", (o, n) => - { - o.Mapping = n.CreateSimpleMap(LoadString); - } + "mapping", + (o, n) => o.Mapping = n.CreateSimpleMap(LoadString) } }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiEncodingDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiEncodingDeserializer.cs index 6a275ff00..c627ea8f5 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiEncodingDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiEncodingDeserializer.cs @@ -16,34 +16,24 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _encodingFixedFields = new() { { - "contentType", (o, n) => - { - o.ContentType = n.GetScalarValue(); - } + "contentType", + (o, n) => o.ContentType = n.GetScalarValue() }, { - "headers", (o, n) => - { - o.Headers = n.CreateMap(LoadHeader); - } + "headers", + (o, n) => o.Headers = n.CreateMap(LoadHeader) }, { - "style", (o, n) => - { - o.Style = n.GetScalarValue().GetEnumFromDisplayName(); - } + "style", + (o, n) => o.Style = n.GetScalarValue().GetEnumFromDisplayName() }, { - "explode", (o, n) => - { - o.Explode = bool.Parse(n.GetScalarValue()); - } + "explode", + (o, n) => o.Explode = bool.Parse(n.GetScalarValue()) }, { - "allowedReserved", (o, n) => - { - o.AllowReserved = bool.Parse(n.GetScalarValue()); - } + "allowedReserved", + (o, n) => o.AllowReserved = bool.Parse(n.GetScalarValue()) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiExampleDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiExampleDeserializer.cs index ea7e44aed..0399ad84d 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiExampleDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiExampleDeserializer.cs @@ -16,28 +16,20 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _exampleFixedFields = new() { { - "summary", (o, n) => - { - o.Summary = n.GetScalarValue(); - } + "summary", + (o, n) => o.Summary = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "value", (o, n) => - { - o.Value = n.CreateAny(); - } + "value", + (o, n) => o.Value = n.CreateAny() }, { - "externalValue", (o, n) => - { - o.ExternalValue = n.GetScalarValue(); - } + "externalValue", + (o, n) => o.ExternalValue = n.GetScalarValue() }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiExternalDocsDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiExternalDocsDeserializer.cs index f742fb1de..e516bcfbc 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiExternalDocsDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiExternalDocsDeserializer.cs @@ -19,16 +19,12 @@ internal static partial class OpenApiV3Deserializer { // $ref { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "url", (o, n) => - { - o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "url", + (o, n) => o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiHeaderDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiHeaderDeserializer.cs index 4b296c046..cd74df4b4 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiHeaderDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiHeaderDeserializer.cs @@ -16,64 +16,44 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _headerFixedFields = new() { { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "required", (o, n) => - { - o.Required = bool.Parse(n.GetScalarValue()); - } + "required", + (o, n) => o.Required = bool.Parse(n.GetScalarValue()) }, { - "deprecated", (o, n) => - { - o.Deprecated = bool.Parse(n.GetScalarValue()); - } + "deprecated", + (o, n) => o.Deprecated = bool.Parse(n.GetScalarValue()) }, { - "allowEmptyValue", (o, n) => - { - o.AllowEmptyValue = bool.Parse(n.GetScalarValue()); - } + "allowEmptyValue", + (o, n) => o.AllowEmptyValue = bool.Parse(n.GetScalarValue()) }, { - "allowReserved", (o, n) => - { - o.AllowReserved = bool.Parse(n.GetScalarValue()); - } + "allowReserved", + (o, n) => o.AllowReserved = bool.Parse(n.GetScalarValue()) }, { - "style", (o, n) => - { - o.Style = n.GetScalarValue().GetEnumFromDisplayName(); - } + "style", + (o, n) => o.Style = n.GetScalarValue().GetEnumFromDisplayName() }, { - "explode", (o, n) => - { - o.Explode = bool.Parse(n.GetScalarValue()); - } + "explode", + (o, n) => o.Explode = bool.Parse(n.GetScalarValue()) }, { - "schema", (o, n) => - { - o.Schema = LoadSchema(n); - } + "schema", + (o, n) => o.Schema = LoadSchema(n) }, { - "examples", (o, n) => - { - o.Examples = n.CreateMap(LoadExample); - } + "examples", + (o, n) => o.Examples = n.CreateMap(LoadExample) }, { - "example", (o, n) => - { - o.Example = n.CreateAny(); - } + "example", + (o, n) => o.Example = n.CreateAny() }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiInfoDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiInfoDeserializer.cs index 11fb88034..042bb5a5e 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiInfoDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiInfoDeserializer.cs @@ -18,40 +18,28 @@ internal static partial class OpenApiV3Deserializer public static FixedFieldMap InfoFixedFields = new() { { - "title", (o, n) => - { - o.Title = n.GetScalarValue(); - } + "title", + (o, n) => o.Title = n.GetScalarValue() }, { - "version", (o, n) => - { - o.Version = n.GetScalarValue(); - } + "version", + (o, n) => o.Version = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "termsOfService", (o, n) => - { - o.TermsOfService = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "termsOfService", + (o, n) => o.TermsOfService = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "contact", (o, n) => - { - o.Contact = LoadContact(n); - } + "contact", + (o, n) => o.Contact = LoadContact(n) }, { - "license", (o, n) => - { - o.License = LoadLicense(n); - } + "license", + (o, n) => o.License = LoadLicense(n) } }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiLicenseDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiLicenseDeserializer.cs index 1582d75b2..bde763454 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiLicenseDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiLicenseDeserializer.cs @@ -17,16 +17,12 @@ internal static partial class OpenApiV3Deserializer private static FixedFieldMap _licenseFixedFields = new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "url", (o, n) => - { - o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "url", + (o, n) => o.Url = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiLinkDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiLinkDeserializer.cs index 6db2a82fb..462bb875e 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiLinkDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiLinkDeserializer.cs @@ -16,34 +16,24 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _linkFixedFields = new() { { - "operationRef", (o, n) => - { - o.OperationRef = n.GetScalarValue(); - } + "operationRef", + (o, n) => o.OperationRef = n.GetScalarValue() }, { - "operationId", (o, n) => - { - o.OperationId = n.GetScalarValue(); - } + "operationId", + (o, n) => o.OperationId = n.GetScalarValue() }, { - "parameters", (o, n) => - { - o.Parameters = n.CreateSimpleMap(LoadRuntimeExpressionAnyWrapper); - } + "parameters", + (o, n) => o.Parameters = n.CreateSimpleMap(LoadRuntimeExpressionAnyWrapper) }, { - "requestBody", (o, n) => - { - o.RequestBody = LoadRuntimeExpressionAnyWrapper(n); - } + "requestBody", + (o, n) => o.RequestBody = LoadRuntimeExpressionAnyWrapper(n) }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, {"server", (o, n) => o.Server = LoadServer(n)} }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiMediaTypeDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiMediaTypeDeserializer.cs index 5ae07962d..a2625f438 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiMediaTypeDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiMediaTypeDeserializer.cs @@ -17,28 +17,20 @@ internal static partial class OpenApiV3Deserializer new() { { - OpenApiConstants.Schema, (o, n) => - { - o.Schema = LoadSchema(n); - } + OpenApiConstants.Schema, + (o, n) => o.Schema = LoadSchema(n) }, { - OpenApiConstants.Examples, (o, n) => - { - o.Examples = n.CreateMap(LoadExample); - } + OpenApiConstants.Examples, + (o, n) => o.Examples = n.CreateMap(LoadExample) }, { - OpenApiConstants.Example, (o, n) => - { - o.Example = n.CreateAny(); - } + OpenApiConstants.Example, + (o, n) => o.Example = n.CreateAny() }, { - OpenApiConstants.Encoding, (o, n) => - { - o.Encoding = n.CreateMap(LoadEncoding); - } + OpenApiConstants.Encoding, + (o, n) => o.Encoding = n.CreateMap(LoadEncoding) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiOAuthFlowDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiOAuthFlowDeserializer.cs index 16fc934a9..77e19ccbc 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiOAuthFlowDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiOAuthFlowDeserializer.cs @@ -18,22 +18,16 @@ internal static partial class OpenApiV3Deserializer new() { { - "authorizationUrl", (o, n) => - { - o.AuthorizationUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "authorizationUrl", + (o, n) => o.AuthorizationUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "tokenUrl", (o, n) => - { - o.TokenUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "tokenUrl", + (o, n) => o.TokenUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "refreshUrl", (o, n) => - { - o.RefreshUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "refreshUrl", + (o, n) => o.RefreshUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, {"scopes", (o, n) => o.Scopes = n.CreateSimpleMap(LoadString)} }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiOperationDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiOperationDeserializer.cs index c3ac122f1..471b3a207 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiOperationDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiOperationDeserializer.cs @@ -24,70 +24,48 @@ internal static partial class OpenApiV3Deserializer valueNode.GetScalarValue())) }, { - "summary", (o, n) => - { - o.Summary = n.GetScalarValue(); - } + "summary", + (o, n) => o.Summary = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "externalDocs", (o, n) => - { - o.ExternalDocs = LoadExternalDocs(n); - } + "externalDocs", + (o, n) => o.ExternalDocs = LoadExternalDocs(n) }, { - "operationId", (o, n) => - { - o.OperationId = n.GetScalarValue(); - } + "operationId", + (o, n) => o.OperationId = n.GetScalarValue() }, { - "parameters", (o, n) => - { - o.Parameters = n.CreateList(LoadParameter); - } + "parameters", + (o, n) => o.Parameters = n.CreateList(LoadParameter) }, { - "requestBody", (o, n) => - { - o.RequestBody = LoadRequestBody(n); - } + "requestBody", + (o, n) => o.RequestBody = LoadRequestBody(n) }, { - "responses", (o, n) => - { - o.Responses = LoadResponses(n); - } + "responses", + (o, n) => o.Responses = LoadResponses(n) }, { - "callbacks", (o, n) => - { - o.Callbacks = n.CreateMap(LoadCallback); - } + "callbacks", + (o, n) => o.Callbacks = n.CreateMap(LoadCallback) }, { - "deprecated", (o, n) => - { - o.Deprecated = bool.Parse(n.GetScalarValue()); - } + "deprecated", + (o, n) => o.Deprecated = bool.Parse(n.GetScalarValue()) }, { - "security", (o, n) => - { - o.Security = n.CreateList(LoadSecurityRequirement); - } + "security", + (o, n) => o.Security = n.CreateList(LoadSecurityRequirement) }, { - "servers", (o, n) => - { - o.Servers = n.CreateList(LoadServer); - } + "servers", + (o, n) => o.Servers = n.CreateList(LoadServer) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiParameterDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiParameterDeserializer.cs index c502d38b0..954cc7109 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiParameterDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiParameterDeserializer.cs @@ -19,10 +19,8 @@ internal static partial class OpenApiV3Deserializer new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { "in", (o, n) => @@ -42,70 +40,48 @@ internal static partial class OpenApiV3Deserializer } }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "required", (o, n) => - { - o.Required = bool.Parse(n.GetScalarValue()); - } + "required", + (o, n) => o.Required = bool.Parse(n.GetScalarValue()) }, { - "deprecated", (o, n) => - { - o.Deprecated = bool.Parse(n.GetScalarValue()); - } + "deprecated", + (o, n) => o.Deprecated = bool.Parse(n.GetScalarValue()) }, { - "allowEmptyValue", (o, n) => - { - o.AllowEmptyValue = bool.Parse(n.GetScalarValue()); - } + "allowEmptyValue", + (o, n) => o.AllowEmptyValue = bool.Parse(n.GetScalarValue()) }, { - "allowReserved", (o, n) => - { - o.AllowReserved = bool.Parse(n.GetScalarValue()); - } + "allowReserved", + (o, n) => o.AllowReserved = bool.Parse(n.GetScalarValue()) }, { - "style", (o, n) => - { - o.Style = n.GetScalarValue().GetEnumFromDisplayName(); - } + "style", + (o, n) => o.Style = n.GetScalarValue().GetEnumFromDisplayName() }, { - "explode", (o, n) => - { - o.Explode = bool.Parse(n.GetScalarValue()); - } + "explode", + (o, n) => o.Explode = bool.Parse(n.GetScalarValue()) }, { - "schema", (o, n) => - { - o.Schema = LoadSchema(n); - } + "schema", + (o, n) => o.Schema = LoadSchema(n) }, { - "content", (o, n) => - { - o.Content = n.CreateMap(LoadMediaType); - } + "content", + (o, n) => o.Content = n.CreateMap(LoadMediaType) }, { - "examples", (o, n) => - { - o.Examples = n.CreateMap(LoadExample); - } + "examples", + (o, n) => o.Examples = n.CreateMap(LoadExample) }, { - "example", (o, n) => - { - o.Example = n.CreateAny(); - } + "example", + (o, n) => o.Example = n.CreateAny() }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiPathItemDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiPathItemDeserializer.cs index fcafcc786..f4ab2ad3b 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiPathItemDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiPathItemDeserializer.cs @@ -22,16 +22,12 @@ internal static partial class OpenApiV3Deserializer } }, { - "summary", (o, n) => - { - o.Summary = n.GetScalarValue(); - } + "summary", + (o, n) => o.Summary = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, {"get", (o, n) => o.AddOperation(OperationType.Get, LoadOperation(n))}, {"put", (o, n) => o.AddOperation(OperationType.Put, LoadOperation(n))}, diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiRequestBodyDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiRequestBodyDeserializer.cs index d65279788..751fd1ac5 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiRequestBodyDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiRequestBodyDeserializer.cs @@ -17,22 +17,16 @@ internal static partial class OpenApiV3Deserializer new() { { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "content", (o, n) => - { - o.Content = n.CreateMap(LoadMediaType); - } + "content", + (o, n) => o.Content = n.CreateMap(LoadMediaType) }, { - "required", (o, n) => - { - o.Required = bool.Parse(n.GetScalarValue()); - } + "required", + (o, n) => o.Required = bool.Parse(n.GetScalarValue()) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiResponseDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiResponseDeserializer.cs index 64515dc3b..4fe97c7e1 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiResponseDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiResponseDeserializer.cs @@ -17,28 +17,20 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _responseFixedFields = new() { { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "headers", (o, n) => - { - o.Headers = n.CreateMap(LoadHeader); - } + "headers", + (o, n) => o.Headers = n.CreateMap(LoadHeader) }, { - "content", (o, n) => - { - o.Content = n.CreateMap(LoadMediaType); - } + "content", + (o, n) => o.Content = n.CreateMap(LoadMediaType) }, { - "links", (o, n) => - { - o.Links = n.CreateMap(LoadLink); - } + "links", + (o, n) => o.Links = n.CreateMap(LoadLink) } }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiSchemaDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiSchemaDeserializer.cs index fd375bfdf..52b79a1f9 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiSchemaDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiSchemaDeserializer.cs @@ -18,142 +18,96 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _schemaFixedFields = new() { { - "title", (o, n) => - { - o.Title = n.GetScalarValue(); - } + "title", + (o, n) => o.Title = n.GetScalarValue() }, { - "multipleOf", (o, n) => - { - o.MultipleOf = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture); - } + "multipleOf", + (o, n) => o.MultipleOf = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture) }, { - "maximum", (o, n) => - { - o.Maximum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture); - } + "maximum", + (o, n) => o.Maximum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture) }, { - "exclusiveMaximum", (o, n) => - { - o.ExclusiveMaximum = bool.Parse(n.GetScalarValue()); - } + "exclusiveMaximum", + (o, n) => o.ExclusiveMaximum = bool.Parse(n.GetScalarValue()) }, { - "minimum", (o, n) => - { - o.Minimum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture); - } + "minimum", + (o, n) => o.Minimum = decimal.Parse(n.GetScalarValue(), NumberStyles.Float, CultureInfo.InvariantCulture) }, { - "exclusiveMinimum", (o, n) => - { - o.ExclusiveMinimum = bool.Parse(n.GetScalarValue()); - } + "exclusiveMinimum", + (o, n) => o.ExclusiveMinimum = bool.Parse(n.GetScalarValue()) }, { - "maxLength", (o, n) => - { - o.MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxLength", + (o, n) => o.MaxLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minLength", (o, n) => - { - o.MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minLength", + (o, n) => o.MinLength = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "pattern", (o, n) => - { - o.Pattern = n.GetScalarValue(); - } + "pattern", + (o, n) => o.Pattern = n.GetScalarValue() }, { - "maxItems", (o, n) => - { - o.MaxItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxItems", + (o, n) => o.MaxItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minItems", (o, n) => - { - o.MinItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minItems", + (o, n) => o.MinItems = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "uniqueItems", (o, n) => - { - o.UniqueItems = bool.Parse(n.GetScalarValue()); - } + "uniqueItems", + (o, n) => o.UniqueItems = bool.Parse(n.GetScalarValue()) }, { - "maxProperties", (o, n) => - { - o.MaxProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "maxProperties", + (o, n) => o.MaxProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "minProperties", (o, n) => - { - o.MinProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture); - } + "minProperties", + (o, n) => o.MinProperties = int.Parse(n.GetScalarValue(), CultureInfo.InvariantCulture) }, { - "required", (o, n) => - { - o.Required = new HashSet(n.CreateSimpleList(n2 => n2.GetScalarValue())); - } + "required", + (o, n) => o.Required = new HashSet(n.CreateSimpleList(n2 => n2.GetScalarValue())) }, { - "enum", (o, n) => - { - o.Enum = n.CreateListOfAny(); - } + "enum", + (o, n) => o.Enum = n.CreateListOfAny() }, { - "type", (o, n) => - { - o.Type = n.GetScalarValue(); - } + "type", + (o, n) => o.Type = n.GetScalarValue() }, { - "allOf", (o, n) => - { - o.AllOf = n.CreateList(LoadSchema); - } + "allOf", + (o, n) => o.AllOf = n.CreateList(LoadSchema) }, { - "oneOf", (o, n) => - { - o.OneOf = n.CreateList(LoadSchema); - } + "oneOf", + (o, n) => o.OneOf = n.CreateList(LoadSchema) }, { - "anyOf", (o, n) => - { - o.AnyOf = n.CreateList(LoadSchema); - } + "anyOf", + (o, n) => o.AnyOf = n.CreateList(LoadSchema) }, { - "not", (o, n) => - { - o.Not = LoadSchema(n); - } + "not", + (o, n) => o.Not = LoadSchema(n) }, { - "items", (o, n) => - { - o.Items = LoadSchema(n); - } + "items", + (o, n) => o.Items = LoadSchema(n) }, { - "properties", (o, n) => - { - o.Properties = n.CreateMap(LoadSchema); - } + "properties", + (o, n) => o.Properties = n.CreateMap(LoadSchema) }, { "additionalProperties", (o, n) => @@ -169,71 +123,48 @@ internal static partial class OpenApiV3Deserializer } }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "format", (o, n) => - { - o.Format = n.GetScalarValue(); - } + "format", + (o, n) => o.Format = n.GetScalarValue() }, { - "default", (o, n) => - { - o.Default = n.CreateAny(); - } + "default", + (o, n) => o.Default = n.CreateAny() }, - { - "nullable", (o, n) => - { - o.Nullable = bool.Parse(n.GetScalarValue()); - } + "nullable", + (o, n) => o.Nullable = bool.Parse(n.GetScalarValue()) }, { - "discriminator", (o, n) => - { - o.Discriminator = LoadDiscriminator(n); - } + "discriminator", + (o, n) => o.Discriminator = LoadDiscriminator(n) }, { - "readOnly", (o, n) => - { - o.ReadOnly = bool.Parse(n.GetScalarValue()); - } + "readOnly", + (o, n) => o.ReadOnly = bool.Parse(n.GetScalarValue()) }, { - "writeOnly", (o, n) => - { - o.WriteOnly = bool.Parse(n.GetScalarValue()); - } + "writeOnly", + (o, n) => o.WriteOnly = bool.Parse(n.GetScalarValue()) }, { - "xml", (o, n) => - { - o.Xml = LoadXml(n); - } + "xml", + (o, n) => o.Xml = LoadXml(n) }, { - "externalDocs", (o, n) => - { - o.ExternalDocs = LoadExternalDocs(n); - } + "externalDocs", + (o, n) => o.ExternalDocs = LoadExternalDocs(n) }, { - "example", (o, n) => - { - o.Example = n.CreateAny(); - } + "example", + (o, n) => o.Example = n.CreateAny() }, { - "deprecated", (o, n) => - { - o.Deprecated = bool.Parse(n.GetScalarValue()); - } + "deprecated", + (o, n) => o.Deprecated = bool.Parse(n.GetScalarValue()) }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiSecuritySchemeDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiSecuritySchemeDeserializer.cs index e2ea91abe..c219d586f 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiSecuritySchemeDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiSecuritySchemeDeserializer.cs @@ -18,52 +18,36 @@ internal static partial class OpenApiV3Deserializer new() { { - "type", (o, n) => - { - o.Type = n.GetScalarValue().GetEnumFromDisplayName(); - } + "type", + (o, n) => o.Type = n.GetScalarValue().GetEnumFromDisplayName() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "in", (o, n) => - { - o.In = n.GetScalarValue().GetEnumFromDisplayName(); - } + "in", + (o, n) => o.In = n.GetScalarValue().GetEnumFromDisplayName() }, { - "scheme", (o, n) => - { - o.Scheme = n.GetScalarValue(); - } + "scheme", + (o, n) => o.Scheme = n.GetScalarValue() }, { - "bearerFormat", (o, n) => - { - o.BearerFormat = n.GetScalarValue(); - } + "bearerFormat", + (o, n) => o.BearerFormat = n.GetScalarValue() }, { - "openIdConnectUrl", (o, n) => - { - o.OpenIdConnectUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute); - } + "openIdConnectUrl", + (o, n) => o.OpenIdConnectUrl = new(n.GetScalarValue(), UriKind.RelativeOrAbsolute) }, { - "flows", (o, n) => - { - o.Flows = LoadOAuthFlows(n); - } + "flows", + (o, n) => o.Flows = LoadOAuthFlows(n) } }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiServerDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiServerDeserializer.cs index b29c3b0bf..cfdb5d3ae 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiServerDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiServerDeserializer.cs @@ -16,22 +16,16 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _serverFixedFields = new() { { - "url", (o, n) => - { - o.Url = n.GetScalarValue(); - } + "url", + (o, n) => o.Url = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, { - "variables", (o, n) => - { - o.Variables = n.CreateMap(LoadServerVariable); - } + "variables", + (o, n) => o.Variables = n.CreateMap(LoadServerVariable) } }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiServerVariableDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiServerVariableDeserializer.cs index c506930d3..e65222dde 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiServerVariableDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiServerVariableDeserializer.cs @@ -17,22 +17,16 @@ internal static partial class OpenApiV3Deserializer new() { { - "enum", (o, n) => - { - o.Enum = n.CreateSimpleList(s => s.GetScalarValue()); - } + "enum", + (o, n) => o.Enum = n.CreateSimpleList(s => s.GetScalarValue()) }, { - "default", (o, n) => - { - o.Default = n.GetScalarValue(); - } + "default", + (o, n) => o.Default = n.GetScalarValue() }, { - "description", (o, n) => - { - o.Description = n.GetScalarValue(); - } + "description", + (o, n) => o.Description = n.GetScalarValue() }, }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiTagDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiTagDeserializer.cs index b78cdfc60..441ab330e 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiTagDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiTagDeserializer.cs @@ -16,22 +16,16 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _tagFixedFields = new() { { - OpenApiConstants.Name, (o, n) => - { - o.Name = n.GetScalarValue(); - } + OpenApiConstants.Name, + (o, n) => o.Name = n.GetScalarValue() }, { - OpenApiConstants.Description, (o, n) => - { - o.Description = n.GetScalarValue(); - } + OpenApiConstants.Description, + (o, n) => o.Description = n.GetScalarValue() }, { - OpenApiConstants.ExternalDocs, (o, n) => - { - o.ExternalDocs = LoadExternalDocs(n); - } + OpenApiConstants.ExternalDocs, + (o, n) => o.ExternalDocs = LoadExternalDocs(n) } }; diff --git a/src/Microsoft.OpenApi.Readers/V3/OpenApiXmlDeserializer.cs b/src/Microsoft.OpenApi.Readers/V3/OpenApiXmlDeserializer.cs index 866f38d01..b88aaade9 100644 --- a/src/Microsoft.OpenApi.Readers/V3/OpenApiXmlDeserializer.cs +++ b/src/Microsoft.OpenApi.Readers/V3/OpenApiXmlDeserializer.cs @@ -17,34 +17,24 @@ internal static partial class OpenApiV3Deserializer private static readonly FixedFieldMap _xmlFixedFields = new() { { - "name", (o, n) => - { - o.Name = n.GetScalarValue(); - } + "name", + (o, n) => o.Name = n.GetScalarValue() }, { - "namespace", (o, n) => - { - o.Namespace = new(n.GetScalarValue(), UriKind.Absolute); - } + "namespace", + (o, n) => o.Namespace = new(n.GetScalarValue(), UriKind.Absolute) }, { - "prefix", (o, n) => - { - o.Prefix = n.GetScalarValue(); - } + "prefix", + (o, n) => o.Prefix = n.GetScalarValue() }, { - "attribute", (o, n) => - { - o.Attribute = bool.Parse(n.GetScalarValue()); - } + "attribute", + (o, n) => o.Attribute = bool.Parse(n.GetScalarValue()) }, { - "wrapped", (o, n) => - { - o.Wrapped = bool.Parse(n.GetScalarValue()); - } + "wrapped", + (o, n) => o.Wrapped = bool.Parse(n.GetScalarValue()) }, }; diff --git a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs index ef8d261a0..5a52c9584 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiComponents.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiComponents.cs @@ -109,9 +109,7 @@ public void SerializeAsV3(IOpenApiWriter writer) writer.WriteOptionalMap( OpenApiConstants.Schemas, Schemas, - (w, _, component) => { - component.SerializeAsV3WithoutReference(w); - }); + (w, _, component) => component.SerializeAsV3WithoutReference(w)); } writer.WriteEndObject(); return; diff --git a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs index 1b9ad7b77..77ccef663 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiDocument.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiDocument.cs @@ -173,10 +173,7 @@ public void SerializeAsV2(IOpenApiWriter writer) writer.WriteOptionalMap( OpenApiConstants.Definitions, openApiSchemas, - (w, _, component) => - { - component.SerializeAsV2WithoutReference(w); - }); + (w, _, component) => component.SerializeAsV2WithoutReference(w)); } } else diff --git a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs index cdf18cddb..11171a7ae 100644 --- a/src/Microsoft.OpenApi/Models/OpenApiOperation.cs +++ b/src/Microsoft.OpenApi/Models/OpenApiOperation.cs @@ -143,10 +143,7 @@ public void SerializeAsV3(IOpenApiWriter writer) writer.WriteOptionalCollection( OpenApiConstants.Tags, Tags, - (w, t) => - { - t.SerializeAsV3(w); - }); + (w, t) => t.SerializeAsV3(w)); // summary writer.WriteProperty(OpenApiConstants.Summary, Summary); @@ -200,10 +197,7 @@ public void SerializeAsV2(IOpenApiWriter writer) writer.WriteOptionalCollection( OpenApiConstants.Tags, Tags, - (w, t) => - { - t.SerializeAsV2(w); - }); + (w, t) => t.SerializeAsV2(w)); // summary writer.WriteProperty(OpenApiConstants.Summary, Summary); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 425f410ba..2844849e0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -180,7 +180,6 @@ public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() OpenApiService.ValidateOpenApiDocument("", _logger)); } - [Fact] public Task ThrowIfURLIsNotResolvableWhenValidating() { diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs index 94518ba0c..94164c3cd 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs @@ -378,28 +378,13 @@ public void AdditionalDataWorks() Assert.Equal(4, rootNode.AdditionalData.Count); Assert.True(rootNode.AdditionalData.ContainsKey("DatePurchased")); Assert.Collection(rootNode.AdditionalData["Location"], - item => - { - Assert.Equal("Seattle, WA", item); - }); + item => Assert.Equal("Seattle, WA", item)); Assert.Collection(rootNode.Children["houses"].AdditionalData["Bedrooms"], - item => - { - Assert.Equal("Five", item); - }); + item => Assert.Equal("Five", item)); Assert.Collection(rootNode.Children["cars"].AdditionalData["Categories"], - item => - { - Assert.Equal("Coupe", item); - }, - item => - { - Assert.Equal("Sedan", item); - }, - item => - { - Assert.Equal("Convertible", item); - }); + item => Assert.Equal("Coupe", item), + item => Assert.Equal("Sedan", item), + item => Assert.Equal("Convertible", item)); } [Fact] diff --git a/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs b/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs index f86295f35..12798779d 100644 --- a/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs @@ -103,7 +103,8 @@ public void OpenApiWorkspacesAllowDocumentsToReferenceEachOther_short() op.CreateResponse("200", re => { re.Description = "Success"; - re.CreateContent("application/json", co => + re.CreateContent("application/json", + co => co.Schema = new() { Reference = new() // Reference