From 9ffee77190e4b5b7c88459b82c074a04c992da4a Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Thu, 22 Aug 2024 16:58:33 +0900 Subject: [PATCH 1/8] Revert and fix update endpoint specs to meet current task --- .../Endpoints/AdminEventEndpoints.cs | 31 ++++ src/AzureOpenAIProxy.ApiApp/Program.cs | 1 + .../AdminUpdateEventDetailsOpenApiTests.cs | 166 ++++++++++++++++++ 3 files changed, 198 insertions(+) create mode 100644 test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index d64ac5f0..28a3538a 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -40,4 +40,35 @@ public static RouteHandlerBuilder AddAdminEvents(this WebApplication app) return builder; } + + /// + /// Adds the update event details by admin endpoint + /// + /// instance. + /// Returns instance. + public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) + { + // Todo: Issue #19 https://github.com/aliencube/azure-openai-sdk-proxy/issues/19 + // Need authorization by admin + var builder = app.MapPut(AdminEndpointUrls.AdminEventDetails, ( + [FromRoute] string eventId) => + { + // Todo: Issue #203 https://github.com/aliencube/azure-openai-sdk-proxy/issues/203 + return Results.Ok(); + }) + .Produces(statusCode: StatusCodes.Status200OK) + .Produces(statusCode: StatusCodes.Status401Unauthorized) + .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") + .WithTags("admin") + .WithName("UpdateAdminEventDetails") + .WithOpenApi(operation => + { + operation.Summary = "Updates event details by the given event ID"; + operation.Description = "This endpoint updates event details by event id, api for admin users"; + + return operation; + }); + + return builder; + } } diff --git a/src/AzureOpenAIProxy.ApiApp/Program.cs b/src/AzureOpenAIProxy.ApiApp/Program.cs index 2331dc75..a8836286 100644 --- a/src/AzureOpenAIProxy.ApiApp/Program.cs +++ b/src/AzureOpenAIProxy.ApiApp/Program.cs @@ -41,5 +41,6 @@ // Admin Endpoints app.AddAdminEvents(); +app.AddUpdateAdminEvents(); await app.RunAsync(); diff --git a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs new file mode 100644 index 00000000..f400a599 --- /dev/null +++ b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs @@ -0,0 +1,166 @@ +using System.Text.Json; + +using FluentAssertions; + +using AzureOpenAIProxy.AppHost.Tests.Fixtures; + +namespace AzureOpenAIProxy.AppHost.Tests.ApiApp.Endpoints; + +public class AdminUpdateEventDetailsOpenApiTests(AspireAppHostFixture host) : IClassFixture +{ + [Fact] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Path() + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .TryGetProperty("/admin/events/{eventId}", out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Object); + } + + [Fact] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Verb() + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .TryGetProperty("put", out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Object); + } + + [Theory] + [InlineData("admin")] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Tags(string tag) + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .GetProperty("put") + .TryGetProperty("tags", out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Array); + result.EnumerateArray().Select(p => p.GetString()).Should().Contain(tag); + } + + [Theory] + [InlineData("summary")] + [InlineData("description")] + [InlineData("operationId")] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Value(string attribute) + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .GetProperty("put") + .TryGetProperty(attribute, out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.String); + } + + [Theory] + [InlineData("parameters")] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Array(string attribute) + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .GetProperty("put") + .TryGetProperty(attribute, out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Array); + } + + [Theory] + [InlineData("eventId")] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Path_Parameter(string name) + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .GetProperty("put") + .GetProperty("parameters") + .EnumerateArray() + .Where(p => p.GetProperty("in").GetString() == "path") + .Select(p => p.GetProperty("name").ToString()); + result.Should().Contain(name); + } + + [Theory] + [InlineData("responses")] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Object(string attribute) + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .GetProperty("put") + .TryGetProperty(attribute, out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Object); + } + + [Theory] + [InlineData("200")] + [InlineData("401")] + [InlineData("500")] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Response(string attribute) + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("paths") + .GetProperty("/admin/events/{eventId}") + .GetProperty("put") + .GetProperty("responses") + .TryGetProperty(attribute, out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Object); + } +} From fef3cd39db74de03118fc3e6a59ef76fff0c96a4 Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Sat, 24 Aug 2024 17:08:04 +0900 Subject: [PATCH 2/8] Add request and response body spec with test --- .../Endpoints/AdminEventEndpoints.cs | 7 ++-- .../AdminUpdateEventDetailsOpenApiTests.cs | 37 ++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index 28a3538a..4a20c791 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -56,15 +56,16 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) // Todo: Issue #203 https://github.com/aliencube/azure-openai-sdk-proxy/issues/203 return Results.Ok(); }) - .Produces(statusCode: StatusCodes.Status200OK) + .Accepts(contentType: "application/json") + .Produces(statusCode: StatusCodes.Status204NoContent) .Produces(statusCode: StatusCodes.Status401Unauthorized) .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") .WithTags("admin") .WithName("UpdateAdminEventDetails") .WithOpenApi(operation => { - operation.Summary = "Updates event details by the given event ID"; - operation.Description = "This endpoint updates event details by event id, api for admin users"; + operation.Summary = "Updates event details from the given event ID"; + operation.Description = "This endpoint updates the event details from the given event ID."; return operation; }); diff --git a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs index f400a599..8e3a5f4b 100644 --- a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs +++ b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs @@ -124,6 +124,7 @@ public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Pat } [Theory] + [InlineData("requestBody")] [InlineData("responses")] public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Object(string attribute) { @@ -142,8 +143,9 @@ public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Obj result.ValueKind.Should().Be(JsonValueKind.Object); } + [Theory] - [InlineData("200")] + [InlineData("204")] [InlineData("401")] [InlineData("500")] public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Response(string attribute) @@ -163,4 +165,37 @@ public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Res .TryGetProperty(attribute, out var property) ? property : default; result.ValueKind.Should().Be(JsonValueKind.Object); } + + [Fact] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Schemas() + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("components") + .TryGetProperty("schemas", out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Object); + } + + [Fact] + public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Model() + { + // Arrange + using var httpClient = host.App!.CreateHttpClient("apiapp"); + + // Act + var json = await httpClient.GetStringAsync("/swagger/v1.0.0/swagger.json"); + var openapi = JsonSerializer.Deserialize(json); + + // Assert + var result = openapi!.RootElement.GetProperty("components") + .GetProperty("schemas") + .TryGetProperty("AdminEventDetails", out var property) ? property : default; + result.ValueKind.Should().Be(JsonValueKind.Object); + } } From 3aeddb1e7f118fa4349899ff007d4c00404e95db Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Sat, 24 Aug 2024 17:55:19 +0900 Subject: [PATCH 3/8] Change response to 200 to solve linting error --- src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs | 2 +- .../ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index c6be4785..38ddf884 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -88,7 +88,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) return Results.Ok(); }) .Accepts(contentType: "application/json") - .Produces(statusCode: StatusCodes.Status204NoContent) + .Produces(statusCode: StatusCodes.Status200OK, contentType: "application/json") .Produces(statusCode: StatusCodes.Status401Unauthorized) .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") .WithTags("admin") diff --git a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs index 8e3a5f4b..1e1a582c 100644 --- a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs +++ b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs @@ -145,7 +145,7 @@ public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Obj [Theory] - [InlineData("204")] + [InlineData("200")] [InlineData("401")] [InlineData("500")] public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Response(string attribute) From 34dd090cbc8a3c2b23e9e2c913ece1503c3a0874 Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Sat, 24 Aug 2024 22:12:40 +0900 Subject: [PATCH 4/8] Add NotFound for response with test adjustment --- src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs | 2 ++ .../ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs | 1 + 2 files changed, 3 insertions(+) diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index 38ddf884..68368eaa 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -82,6 +82,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) // Todo: Issue #19 https://github.com/aliencube/azure-openai-sdk-proxy/issues/19 // Need authorization by admin var builder = app.MapPut(AdminEndpointUrls.AdminEventDetails, ( + [FromBody] AdminEventDetails payload, [FromRoute] string eventId) => { // Todo: Issue #203 https://github.com/aliencube/azure-openai-sdk-proxy/issues/203 @@ -90,6 +91,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) .Accepts(contentType: "application/json") .Produces(statusCode: StatusCodes.Status200OK, contentType: "application/json") .Produces(statusCode: StatusCodes.Status401Unauthorized) + .Produces(statusCode: StatusCodes.Status404NotFound) .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") .WithTags("admin") .WithName("UpdateAdminEventDetails") diff --git a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs index 1e1a582c..039fb187 100644 --- a/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs +++ b/test/AzureOpenAIProxy.AppHost.Tests/ApiApp/Endpoints/AdminUpdateEventDetailsOpenApiTests.cs @@ -147,6 +147,7 @@ public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Obj [Theory] [InlineData("200")] [InlineData("401")] + [InlineData("404")] [InlineData("500")] public async Task Given_Resource_When_Invoked_Endpoint_Then_It_Should_Return_Response(string attribute) { From 170c4c6ad1d76308854f9ed883e2e94eaff968e1 Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Sat, 24 Aug 2024 22:16:26 +0900 Subject: [PATCH 5/8] Add payload of NotFound for linting --- src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index 68368eaa..86777cf5 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -91,7 +91,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) .Accepts(contentType: "application/json") .Produces(statusCode: StatusCodes.Status200OK, contentType: "application/json") .Produces(statusCode: StatusCodes.Status401Unauthorized) - .Produces(statusCode: StatusCodes.Status404NotFound) + .Produces(statusCode: StatusCodes.Status404NotFound, contentType: "text/plain") .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") .WithTags("admin") .WithName("UpdateAdminEventDetails") From 698f262332016990b30c93c7ace9c6301f8fe7ee Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Sun, 25 Aug 2024 00:17:08 +0900 Subject: [PATCH 6/8] Organize parameter order and remove unused content --- .../Endpoints/AdminEventEndpoints.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index 86777cf5..04422626 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -82,8 +82,8 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) // Todo: Issue #19 https://github.com/aliencube/azure-openai-sdk-proxy/issues/19 // Need authorization by admin var builder = app.MapPut(AdminEndpointUrls.AdminEventDetails, ( - [FromBody] AdminEventDetails payload, - [FromRoute] string eventId) => + [FromRoute] string eventId, + [FromBody] AdminEventDetails payload) => { // Todo: Issue #203 https://github.com/aliencube/azure-openai-sdk-proxy/issues/203 return Results.Ok(); @@ -91,7 +91,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) .Accepts(contentType: "application/json") .Produces(statusCode: StatusCodes.Status200OK, contentType: "application/json") .Produces(statusCode: StatusCodes.Status401Unauthorized) - .Produces(statusCode: StatusCodes.Status404NotFound, contentType: "text/plain") + .Produces(statusCode: StatusCodes.Status404NotFound, contentType: "text/plain") .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") .WithTags("admin") .WithName("UpdateAdminEventDetails") From 3f70144ba904523214ccc89d8fa5ceb3e875aba2 Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Sun, 25 Aug 2024 16:12:53 +0900 Subject: [PATCH 7/8] Remove unused content type definition --- src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs index 04422626..4e68de6b 100644 --- a/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs +++ b/src/AzureOpenAIProxy.ApiApp/Endpoints/AdminEventEndpoints.cs @@ -91,7 +91,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvents(this WebApplication app) .Accepts(contentType: "application/json") .Produces(statusCode: StatusCodes.Status200OK, contentType: "application/json") .Produces(statusCode: StatusCodes.Status401Unauthorized) - .Produces(statusCode: StatusCodes.Status404NotFound, contentType: "text/plain") + .Produces(statusCode: StatusCodes.Status404NotFound) .Produces(statusCode: StatusCodes.Status500InternalServerError, contentType: "text/plain") .WithTags("admin") .WithName("UpdateAdminEventDetails") From 54744c530e64ee417436abd346e7352462cec331 Mon Sep 17 00:00:00 2001 From: SeungHu Lee Date: Mon, 26 Aug 2024 16:14:23 +0900 Subject: [PATCH 8/8] Add spectral linting exception for 400 and 404 --- .spectral.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.spectral.yaml b/.spectral.yaml index c69bf5d4..99107fa4 100644 --- a/.spectral.yaml +++ b/.spectral.yaml @@ -72,10 +72,10 @@ rules: function: truthy message: Response 500 is required - # 401을 제외한 모든 응답 코드는 content를 포함해야함 + # 400, 401, 404를 제외한 모든 응답 코드는 content를 포함해야함 operation-responsedetail-content-convention: - description: All Operation response might include content, except 401 - given: $.paths[*][*].responses[?(@property != '401')] + description: All Operation response might include content, except 400, 401 and 404 + given: $.paths[*][*].responses[?(@property != '400' && @property != '401' && @property != '404')] severity: error then: - field: 'content'