File tree Expand file tree Collapse file tree 3 files changed +26
-0
lines changed
src/AzureOpenAIProxy.ApiApp/Endpoints Expand file tree Collapse file tree 3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -81,3 +81,25 @@ rules:
8181 - field : ' content'
8282 function : truthy
8383 message : Content is required
84+
85+ # Ensure endpoints with path variables define a 404 response
86+ # path에 path variable이 있다면 404 응답 코드가 있어야 함
87+ path-variables-require-404 :
88+ description : Path variables must include a 404 response
89+ severity : error
90+ given : $.paths[*][*].parameters[?(@.in == 'path')]^^
91+ then :
92+ - field : responses.404
93+ function : truthy
94+ message : Response 404 is required
95+
96+ # Ensure POST, PUT, PATCH methods define a 400 response
97+ # verb가 POST, PUT, PATCH일 경우 400 응답코드가 있어야 함
98+ post-put-patch-require-400 :
99+ description : POST, PUT, PATCH methods must include a 400 response
100+ given : $.paths[*][?(@property == 'post' || @property == 'put' || @property == 'patch')]
101+ severity : error
102+ then :
103+ - field : responses.400
104+ function : truthy
105+ message : Response 400 is required
Original file line number Diff line number Diff line change @@ -116,6 +116,7 @@ public static RouteHandlerBuilder AddGetAdminEvent(this WebApplication app)
116116 } )
117117 . Produces < AdminEventDetails > ( statusCode : StatusCodes . Status200OK , contentType : "application/json" )
118118 . Produces ( statusCode : StatusCodes . Status401Unauthorized )
119+ . Produces ( statusCode : StatusCodes . Status404NotFound )
119120 . Produces < string > ( statusCode : StatusCodes . Status500InternalServerError , contentType : "text/plain" )
120121 . WithTags ( "admin" )
121122 . WithName ( "GetAdminEvent" )
@@ -148,6 +149,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvent(this WebApplication app)
148149 } )
149150 . Accepts < AdminEventDetails > ( contentType : "application/json" )
150151 . Produces < AdminEventDetails > ( statusCode : StatusCodes . Status200OK , contentType : "application/json" )
152+ . Produces ( statusCode : StatusCodes . Status400BadRequest )
151153 . Produces ( statusCode : StatusCodes . Status401Unauthorized )
152154 . Produces ( statusCode : StatusCodes . Status404NotFound )
153155 . Produces < string > ( statusCode : StatusCodes . Status500InternalServerError , contentType : "text/plain" )
Original file line number Diff line number Diff line change @@ -57,7 +57,9 @@ public static RouteHandlerBuilder AddChatCompletions(this WebApplication app)
5757 . Accepts < ChatCompletionOptions > ( contentType : "application/json" )
5858 . Produces < CreateChatCompletionResponse > ( statusCode : StatusCodes . Status200OK , contentType : "application/json" )
5959 // TODO: Check both request/response payloads
60+ . Produces ( statusCode : StatusCodes . Status400BadRequest )
6061 . Produces ( statusCode : StatusCodes . Status401Unauthorized )
62+ . Produces ( statusCode : StatusCodes . Status404NotFound )
6163 . Produces < string > ( statusCode : StatusCodes . Status500InternalServerError , contentType : "text/plain" )
6264 . WithTags ( "openai" )
6365 . WithName ( "GetChatCompletions" )
You can’t perform that action at this time.
0 commit comments