diff --git a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/DummyHttpTrigger.cs b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/DummyHttpTrigger.cs index f68aca25..452e8cc8 100644 --- a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/DummyHttpTrigger.cs +++ b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/DummyHttpTrigger.cs @@ -22,9 +22,9 @@ public static class DummyHttpTrigger [OpenApiParameter(name: "name", In = ParameterLocation.Query, Required = true, Type = typeof(string), Summary = "Dummy name", Description = "Dummy name", Visibility = OpenApiVisibilityType.Important)] [OpenApiParameter(name: "switch", In = ParameterLocation.Query, Required = true, Type = typeof(bool), Summary = "Dummy switch", Description = "Dummy switch", Visibility = OpenApiVisibilityType.Important, Deprecated = true)] [OpenApiParameter(name: "onoff", In = ParameterLocation.Path, Required = true, Type = typeof(StringEnum), Summary = "Dummy switch", Description = "Dummy switch", Visibility = OpenApiVisibilityType.Important)] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "List of the dummy responses", Description = "This returns the list of dummy responses", HeaderType = typeof(DummyResponseHeaderType))] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Name not found", Description = "Name parameter is not found", HeaderType = typeof(DummyResponseHeaderType))] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid switch", Description = "Switch parameter is not valid", HeaderType = typeof(DummyResponseHeaderType))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "List of the dummy responses", Description = "This returns the list of dummy responses", CustomHeaderType = typeof(DummyResponseHeader))] + [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.NotFound, Summary = "Name not found", Description = "Name parameter is not found", CustomHeaderType = typeof(DummyResponseHeader))] + [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid switch", Description = "Switch parameter is not valid", CustomHeaderType = typeof(DummyResponseHeader))] public static async Task GetDummies( [HttpTrigger(AuthorizationLevel.Anonymous, "GET", Route = "dummies/{onoff}")] HttpRequest req, string onoff, @@ -43,8 +43,8 @@ public static async Task GetDummies( [OpenApiOperation(operationId: "addDummy", tags: new[] { "dummy" }, Summary = "Adds a dummy", Description = "This adds a dummy.", Visibility = OpenApiVisibilityType.Advanced, Deprecated = true)] [OpenApiSecurity("openid_auth", SecuritySchemeType.OpenIdConnect, OpenIdConnectUrl = "https://example.com/.well-known/openid-configuration", OpenIdConnectScopes = "pets_read, pets_write, admin")] [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(DummyRequestModel), Required = true, Description = "Dummy request model")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DummyResponseModel), Summary = "Dummy response", Description = "This returns the dummy response", HeaderType = typeof(DummyResponseHeaderType))] - [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid request payload", Description = "Request payload is not valid", HeaderType = typeof(DummyResponseHeaderType))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DummyResponseModel), Summary = "Dummy response", Description = "This returns the dummy response", CustomHeaderType = typeof(DummyResponseHeader))] + [OpenApiResponseWithoutBody(statusCode: HttpStatusCode.BadRequest, Summary = "Invalid request payload", Description = "Request payload is not valid", CustomHeaderType = typeof(DummyResponseHeader))] public static async Task AddDummy( [HttpTrigger(AuthorizationLevel.Anonymous, "POST", Route = "dummies")] HttpRequest req, ILogger log) @@ -59,8 +59,8 @@ public static async Task AddDummy( [OpenApiOperation(operationId: "updateDummies", tags: new[] { "dummy" }, Summary = "Updates a list of dummies", Description = "This updates a list of dummies.", Visibility = OpenApiVisibilityType.Advanced)] [OpenApiSecurity("function_key", SecuritySchemeType.ApiKey, Name = "code", In = OpenApiSecurityLocationType.Query)] [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(DummyListModel), Required = true, Description = "Dummy list model")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "Dummy response", Description = "This returns the dummy response", HeaderType = typeof(DummyResponseHeaderType))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DummyStringModel), Summary = "Dummy response", Description = "This returns the dummy response", Deprecated = true, HeaderType = typeof(DummyResponseHeaderType))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "Dummy response", Description = "This returns the dummy response", CustomHeaderType = typeof(DummyResponseHeader))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(DummyStringModel), Summary = "Dummy response", Description = "This returns the dummy response", Deprecated = true, CustomHeaderType = typeof(DummyResponseHeader))] public static async Task UpdateDummies( [HttpTrigger(AuthorizationLevel.Function, "PUT", Route = "dummies")] HttpRequest req, ILogger log) diff --git a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/ResponseHeaders/DummyResponseHeaderType.cs b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/ResponseHeaders/DummyResponseHeader.cs similarity index 74% rename from samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/ResponseHeaders/DummyResponseHeaderType.cs rename to samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/ResponseHeaders/DummyResponseHeader.cs index 548cc7f4..b44157b6 100644 --- a/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/ResponseHeaders/DummyResponseHeaderType.cs +++ b/samples/Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static/ResponseHeaders/DummyResponseHeader.cs @@ -1,11 +1,11 @@ using System.Collections.Generic; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations; +using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core; using Microsoft.OpenApi.Models; namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.FunctionApp.V3Static.ResponseHeaders { - public class DummyResponseHeaderType : IOpenApiResponseHeaderType + public class DummyResponseHeader : IOpenApiCustomResponseHeader { public Dictionary Headers { get; set; } = new Dictionary() { diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs index d555932d..0210f050 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithBodyAttribute.cs @@ -30,7 +30,7 @@ public OpenApiResponseWithBodyAttribute(HttpStatusCode statusCode, string conten /// /// Gets or sets the type containing the collection of the additional response headers. /// - public virtual Type HeaderType { get; set; } + public virtual Type CustomHeaderType { get; set; } /// /// Gets or sets the summary. diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs index cd30173b..49bb83dc 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Attributes/OpenApiResponseWithoutBodyAttribute.cs @@ -26,7 +26,7 @@ public OpenApiResponseWithoutBodyAttribute(HttpStatusCode statusCode) /// /// Gets or sets the type containing the collection of the additional response headers. /// - public virtual Type HeaderType { get; set; } + public virtual Type CustomHeaderType { get; set; } /// /// Gets or sets the summary. diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithBodyAttributeExtensions.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithBodyAttributeExtensions.cs index 550c11d9..cb630b5b 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithBodyAttributeExtensions.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithBodyAttributeExtensions.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Visitors; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; @@ -41,9 +40,9 @@ public static OpenApiResponse ToOpenApiResponse(this OpenApiResponseWithBodyAttr Content = content, }; - if (attribute.HeaderType.HasInterface()) + if (attribute.CustomHeaderType.HasInterface()) { - var header = Activator.CreateInstance(attribute.HeaderType) as IOpenApiResponseHeaderType; + var header = Activator.CreateInstance(attribute.CustomHeaderType) as IOpenApiCustomResponseHeader; response.Headers = header.Headers; } diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithoutBodyAttributeExtensions.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithoutBodyAttributeExtensions.cs index ac89cad2..9343cb45 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithoutBodyAttributeExtensions.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Extensions/OpenApiResponseWithoutBodyAttributeExtensions.cs @@ -1,7 +1,6 @@ using System; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Attributes; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; @@ -39,9 +38,9 @@ public static OpenApiResponse ToOpenApiResponse(this OpenApiResponseWithoutBodyA response.Extensions.Add("x-ms-summary", summary); } - if (attribute.HeaderType.HasInterface()) + if (attribute.CustomHeaderType.HasInterface()) { - var header = Activator.CreateInstance(attribute.HeaderType) as IOpenApiResponseHeaderType; + var header = Activator.CreateInstance(attribute.CustomHeaderType) as IOpenApiCustomResponseHeader; response.Headers = header.Headers; } diff --git a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Configurations/IOpenApiResponseHeaderType.cs b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/IOpenApiCustomResponseHeader.cs similarity index 76% rename from src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Configurations/IOpenApiResponseHeaderType.cs rename to src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/IOpenApiCustomResponseHeader.cs index e72e62cb..6f8eb916 100644 --- a/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/Configurations/IOpenApiResponseHeaderType.cs +++ b/src/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core/IOpenApiCustomResponseHeader.cs @@ -2,12 +2,12 @@ using Microsoft.OpenApi.Models; -namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations +namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.Core { /// /// This provides interfaces to classes implementing OpenAPI response object. /// - public interface IOpenApiResponseHeaderType + public interface IOpenApiCustomResponseHeader { /// /// Gets or sets the collection of the instances. diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs index da499613..0fa131d1 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeFunctions.cs @@ -8,20 +8,20 @@ namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes { public static class FakeFunctions { - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "List of the fake responses", Description = "This returns the list of fake responses", HeaderType = typeof(FakeResponseHeaderType))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "List of the fake responses", Description = "This returns the list of fake responses", CustomHeaderType = typeof(FakeResponseHeader))] public static void GetFakes() { } [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(FakeClassModel), Required = true, Description = "Fake request model")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeClassModel), Summary = "Fake response", Description = "This returns the fake response", HeaderType = typeof(FakeResponseHeaderType))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeClassModel), Summary = "Fake response", Description = "This returns the fake response", CustomHeaderType = typeof(FakeResponseHeader))] public static void AddFakes() { } [OpenApiRequestBody(contentType: "application/json", bodyType: typeof(FakeListModel), Required = true, Description = "Fake list model")] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "Fake response", Description = "This returns the fake response", HeaderType = typeof(FakeResponseHeaderType))] - [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeStringModel), Summary = "Fake response", Description = "This returns the fake response", Deprecated = true, HeaderType = typeof(FakeResponseHeaderType))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(List), Summary = "Fake response", Description = "This returns the fake response", CustomHeaderType = typeof(FakeResponseHeader))] + [OpenApiResponseWithBody(statusCode: HttpStatusCode.OK, contentType: "application/json", bodyType: typeof(FakeStringModel), Summary = "Fake response", Description = "This returns the fake response", Deprecated = true, CustomHeaderType = typeof(FakeResponseHeader))] public static void UpdateFakes() { } diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeResponseHeaderType.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeResponseHeader.cs similarity index 74% rename from test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeResponseHeaderType.cs rename to test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeResponseHeader.cs index 1734cf9a..52422441 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeResponseHeaderType.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes/FakeResponseHeader.cs @@ -1,11 +1,10 @@ using System.Collections.Generic; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations; using Microsoft.OpenApi.Models; namespace Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes { - public class FakeResponseHeaderType : IOpenApiResponseHeaderType + public class FakeResponseHeader : IOpenApiCustomResponseHeader { /// public Dictionary Headers { get; set; } = new Dictionary() diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs index dfb970da..7bff63b8 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithBodyAttributeTests.cs @@ -36,8 +36,8 @@ public void Given_Parameters_When_Instantiated_Then_It_Should_Return_Value(HttpS } [DataTestMethod] - [DataRow("Lorem Ipsum", "Hello World", true, typeof(FakeResponseHeaderType))] - [DataRow("Lorem Ipsum", "Hello World", false, typeof(FakeResponseHeaderType))] + [DataRow("Lorem Ipsum", "Hello World", true, typeof(FakeResponseHeader))] + [DataRow("Lorem Ipsum", "Hello World", false, typeof(FakeResponseHeader))] public void Given_Properties_When_Instantiated_Then_It_Should_Return_Value(string summary, string description, bool deprecated, Type headerType) { var statusCode = HttpStatusCode.OK; @@ -48,13 +48,13 @@ public void Given_Properties_When_Instantiated_Then_It_Should_Return_Value(strin Summary = summary, Description = description, Deprecated = deprecated, - HeaderType = headerType, + CustomHeaderType = headerType, }; attribute.Summary.Should().Be(summary); attribute.Description.Should().Be(description); attribute.Deprecated.Should().Be(deprecated); - attribute.HeaderType.Should().Be(headerType); + attribute.CustomHeaderType.Should().Be(headerType); } } } diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs index 061d6060..e25e3949 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Attributes/OpenApiResponseWithoutBodyAttributeTests.cs @@ -24,7 +24,7 @@ public void Given_Parameters_When_Instantiated_Then_It_Should_Return_Value() } [DataTestMethod] - [DataRow("Hello World", "Lorem Ipsum", typeof(FakeResponseHeaderType))] + [DataRow("Hello World", "Lorem Ipsum", typeof(FakeResponseHeader))] public void Given_Properties_When_Instantiated_Then_It_Should_Return_Value(string summary, string description, Type headerType) { var statusCode = HttpStatusCode.OK; @@ -32,12 +32,12 @@ public void Given_Properties_When_Instantiated_Then_It_Should_Return_Value(strin { Summary = summary, Description = description, - HeaderType = headerType, + CustomHeaderType = headerType, }; attribute.Summary.Should().Be(summary); attribute.Description.Should().Be(description); - attribute.HeaderType.Should().Be(headerType); + attribute.CustomHeaderType.Should().Be(headerType); } } } diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs index 6fbc3dbf..a334b3a9 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithBodyAttributeExtensionsTests.cs @@ -23,7 +23,7 @@ public void Given_Null_When_ToOpenApiResponse_Invoked_Then_It_Should_Throw_Excep } [DataTestMethod] - [DataRow("Lorem Ipsum", "Hello World", typeof(FakeResponseHeaderType))] + [DataRow("Lorem Ipsum", "Hello World", typeof(FakeResponseHeader))] public void Given_Properties_When_ToOpenApiResponse_Invoked_Then_It_Should_Return_Value(string summary, string description, Type headerType) { var statusCode = HttpStatusCode.OK; @@ -33,7 +33,7 @@ public void Given_Properties_When_ToOpenApiResponse_Invoked_Then_It_Should_Retur { Summary = summary, Description = description, - HeaderType = headerType, + CustomHeaderType = headerType, }; var result = OpenApiResponseWithBodyAttributeExtensions.ToOpenApiResponse(attribute); diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs index ddf1e91f..fa241216 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/OpenApiResponseWithoutBodyAttributeExtensionsTests.cs @@ -23,7 +23,7 @@ public void Given_Null_When_ToOpenApiResponse_Invoked_Then_It_Should_Throw_Excep } [DataTestMethod] - [DataRow("Lorem Ipsum", "Hello World", typeof(FakeResponseHeaderType))] + [DataRow("Lorem Ipsum", "Hello World", typeof(FakeResponseHeader))] public void Given_Properties_When_ToOpenApiResponse_Invoked_Then_It_Should_Return_Value(string summary, string description, Type headerType) { var statusCode = HttpStatusCode.OK; @@ -31,7 +31,7 @@ public void Given_Properties_When_ToOpenApiResponse_Invoked_Then_It_Should_Retur { Summary = summary, Description = description, - HeaderType = headerType, + CustomHeaderType = headerType, }; var result = OpenApiResponseWithoutBodyAttributeExtensions.ToOpenApiResponse(attribute); diff --git a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/TypeExtensionsTests.cs b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/TypeExtensionsTests.cs index 62eed12c..4bcd2a86 100644 --- a/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/TypeExtensionsTests.cs +++ b/test/Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests/Extensions/TypeExtensionsTests.cs @@ -3,7 +3,6 @@ using FluentAssertions; -using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Configurations; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Extensions; using Microsoft.Azure.WebJobs.Extensions.OpenApi.Core.Tests.Fakes; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -142,17 +141,17 @@ public void Given_Type_When_IsReferentialType_Invoked_Then_It_Should_Return_Resu [TestMethod] public void Given_Null_When_HasInterface_Invoked_Then_It_Should_Return_False() { - var result = TypeExtensions.HasInterface(null); + var result = TypeExtensions.HasInterface(null); result.Should().BeFalse(); - result = TypeExtensions.HasInterface(null, "IOpenApiResponseHeaderType"); + result = TypeExtensions.HasInterface(null, "IOpenApiCustomResponseHeader"); result.Should().BeFalse(); } [TestMethod] public void Given_Invalid_TypeReference_When_HasInterface_Invoked_Then_It_Should_Return_Result() { - var result = TypeExtensions.HasInterface(typeof(FakeModel)); + var result = TypeExtensions.HasInterface(typeof(FakeModel)); result.Should().BeFalse(); } @@ -160,17 +159,17 @@ public void Given_Invalid_TypeReference_When_HasInterface_Invoked_Then_It_Should [TestMethod] public void Given_Valid_TypeReference_When_HasInterface_Invoked_Then_It_Should_Return_Result() { - var result = TypeExtensions.HasInterface(typeof(FakeResponseHeaderType)); + var result = TypeExtensions.HasInterface(typeof(FakeResponseHeader)); result.Should().BeTrue(); } [DataTestMethod] [DataRow(typeof(FakeModel), false)] - [DataRow(typeof(FakeResponseHeaderType), true)] + [DataRow(typeof(FakeResponseHeader), true)] public void Given_Type_When_HasInterface_Invoked_Then_It_Should_Return_Result(Type type, bool expected) { - var result = TypeExtensions.HasInterface(type, "IOpenApiResponseHeaderType"); + var result = TypeExtensions.HasInterface(type, "IOpenApiCustomResponseHeader"); result.Should().Be(expected); }