File tree 3 files changed +26
-0
lines changed
src/AzureOpenAIProxy.ApiApp/Endpoints
3 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -81,3 +81,25 @@ rules:
81
81
- field : ' content'
82
82
function : truthy
83
83
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)
116
116
} )
117
117
. Produces < AdminEventDetails > ( statusCode : StatusCodes . Status200OK , contentType : "application/json" )
118
118
. Produces ( statusCode : StatusCodes . Status401Unauthorized )
119
+ . Produces ( statusCode : StatusCodes . Status404NotFound )
119
120
. Produces < string > ( statusCode : StatusCodes . Status500InternalServerError , contentType : "text/plain" )
120
121
. WithTags ( "admin" )
121
122
. WithName ( "GetAdminEvent" )
@@ -148,6 +149,7 @@ public static RouteHandlerBuilder AddUpdateAdminEvent(this WebApplication app)
148
149
} )
149
150
. Accepts < AdminEventDetails > ( contentType : "application/json" )
150
151
. Produces < AdminEventDetails > ( statusCode : StatusCodes . Status200OK , contentType : "application/json" )
152
+ . Produces ( statusCode : StatusCodes . Status400BadRequest )
151
153
. Produces ( statusCode : StatusCodes . Status401Unauthorized )
152
154
. Produces ( statusCode : StatusCodes . Status404NotFound )
153
155
. 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)
57
57
. Accepts < ChatCompletionOptions > ( contentType : "application/json" )
58
58
. Produces < CreateChatCompletionResponse > ( statusCode : StatusCodes . Status200OK , contentType : "application/json" )
59
59
// TODO: Check both request/response payloads
60
+ . Produces ( statusCode : StatusCodes . Status400BadRequest )
60
61
. Produces ( statusCode : StatusCodes . Status401Unauthorized )
62
+ . Produces ( statusCode : StatusCodes . Status404NotFound )
61
63
. Produces < string > ( statusCode : StatusCodes . Status500InternalServerError , contentType : "text/plain" )
62
64
. WithTags ( "openai" )
63
65
. WithName ( "GetChatCompletions" )
You can’t perform that action at this time.
0 commit comments