|
1 | 1 | import type { IOAuthApps } from '@rocket.chat/core-typings'; |
2 | 2 | import { OAuthApps } from '@rocket.chat/models'; |
3 | | -import { ajv, isUpdateOAuthAppParams, isOauthAppsGetParams, isDeleteOAuthAppParams } from '@rocket.chat/rest-typings'; |
| 3 | +import { |
| 4 | + ajv, |
| 5 | + isUpdateOAuthAppParams, |
| 6 | + isOauthAppsGetParams, |
| 7 | + isDeleteOAuthAppParams, |
| 8 | + validateUnauthorizedErrorResponse, |
| 9 | + validateBadRequestErrorResponse, |
| 10 | + validateForbiddenErrorResponse, |
| 11 | +} from '@rocket.chat/rest-typings'; |
4 | 12 |
|
5 | 13 | import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; |
6 | 14 | import { apiDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; |
@@ -117,47 +125,9 @@ const oauthAppsCreateEndpoints = API.v1.post( |
117 | 125 | body: isOauthAppsAddParams, |
118 | 126 | permissionsRequired: ['manage-oauth-apps'], |
119 | 127 | response: { |
120 | | - 400: ajv.compile<{ |
121 | | - error?: string; |
122 | | - errorType?: string; |
123 | | - stack?: string; |
124 | | - details?: object; |
125 | | - }>({ |
126 | | - type: 'object', |
127 | | - properties: { |
128 | | - success: { type: 'boolean', enum: [false] }, |
129 | | - stack: { type: 'string' }, |
130 | | - error: { type: 'string' }, |
131 | | - errorType: { type: 'string' }, |
132 | | - details: { type: 'object' }, |
133 | | - }, |
134 | | - required: ['success'], |
135 | | - additionalProperties: false, |
136 | | - }), |
137 | | - 401: ajv.compile({ |
138 | | - type: 'object', |
139 | | - properties: { |
140 | | - success: { type: 'boolean', enum: [false] }, |
141 | | - status: { type: 'string' }, |
142 | | - message: { type: 'string' }, |
143 | | - error: { type: 'string' }, |
144 | | - errorType: { type: 'string' }, |
145 | | - }, |
146 | | - required: ['success'], |
147 | | - additionalProperties: false, |
148 | | - }), |
149 | | - 403: ajv.compile({ |
150 | | - type: 'object', |
151 | | - properties: { |
152 | | - success: { type: 'boolean', enum: [false] }, |
153 | | - status: { type: 'string' }, |
154 | | - message: { type: 'string' }, |
155 | | - error: { type: 'string' }, |
156 | | - errorType: { type: 'string' }, |
157 | | - }, |
158 | | - required: ['success'], |
159 | | - additionalProperties: false, |
160 | | - }), |
| 128 | + 400: validateBadRequestErrorResponse, |
| 129 | + 401: validateUnauthorizedErrorResponse, |
| 130 | + 403: validateForbiddenErrorResponse, |
161 | 131 | 200: ajv.compile<{ application: IOAuthApps }>({ |
162 | 132 | type: 'object', |
163 | 133 | properties: { |
|
0 commit comments