feat: Add OpenAPI Support to oauth-apps.get API (#36598)
Co-authored-by: Matheus Cardoso <matheus@cardo.so> Co-authored-by: Guilherme Gazzo <guilherme@gazzo.xyz>omni-integrator-msg
parent
68499d4edc
commit
17bca96ecb
@ -0,0 +1,7 @@ |
||||
--- |
||||
"@rocket.chat/meteor": patch |
||||
"@rocket.chat/core-typings": patch |
||||
"@rocket.chat/rest-typings": patch |
||||
--- |
||||
|
||||
Add OpenAPI support for the Rocket.Chat oauth-apps.get API endpoints by migrating to a modern chained route definition syntax and utilizing shared AJV schemas for validation to enhance API documentation and ensure type safety through response validation. |
||||
@ -1,11 +0,0 @@ |
||||
import type { IOAuthApps } from '@rocket.chat/core-typings'; |
||||
|
||||
import type { OauthAppsGetParams } from './oauthapps/OAuthAppsGetParamsGET'; |
||||
|
||||
export type OAuthAppsEndpoint = { |
||||
'/v1/oauth-apps.get': { |
||||
GET: (params: OauthAppsGetParams) => { |
||||
oauthApp: IOAuthApps; |
||||
}; |
||||
}; |
||||
}; |
||||
@ -1,40 +0,0 @@ |
||||
import { ajv } from '../Ajv'; |
||||
|
||||
export type OauthAppsGetParams = { clientId: string } | { appId: string } | { _id: string }; |
||||
|
||||
const oauthAppsGetParamsSchema = { |
||||
oneOf: [ |
||||
{ |
||||
type: 'object', |
||||
properties: { |
||||
_id: { |
||||
type: 'string', |
||||
}, |
||||
}, |
||||
required: ['_id'], |
||||
additionalProperties: false, |
||||
}, |
||||
{ |
||||
type: 'object', |
||||
properties: { |
||||
clientId: { |
||||
type: 'string', |
||||
}, |
||||
}, |
||||
required: ['clientId'], |
||||
additionalProperties: false, |
||||
}, |
||||
{ |
||||
type: 'object', |
||||
properties: { |
||||
appId: { |
||||
type: 'string', |
||||
}, |
||||
}, |
||||
required: ['appId'], |
||||
additionalProperties: false, |
||||
}, |
||||
], |
||||
}; |
||||
|
||||
export const isOauthAppsGetParams = ajv.compile<OauthAppsGetParams>(oauthAppsGetParamsSchema); |
||||
Loading…
Reference in new issue