File tree Expand file tree Collapse file tree 3 files changed +31
-17
lines changed
apps/meteor/app/api/server/v1
packages/rest-typings/src/v1 Expand file tree Collapse file tree 3 files changed +31
-17
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @rocket.chat/meteor " : minor
3+ " @rocket.chat/rest-typings " : minor
4+ ---
5+
6+ Add OpenAPI support for the Rocket.Chat e2e.fetchMyKeys 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.
Original file line number Diff line number Diff line change @@ -96,6 +96,31 @@ const e2eEndpoints = API.v1
9696 return API . v1 . success ( ) ;
9797 } ,
9898 )
99+ . get (
100+ 'e2e.fetchMyKeys' ,
101+ {
102+ authRequired : true ,
103+ query : undefined ,
104+ response : {
105+ 400 : validateBadRequestErrorResponse ,
106+ 401 : validateUnauthorizedErrorResponse ,
107+ 200 : ajv . compile < { public_key ?: string ; private_key ?: string } > ( {
108+ type : 'object' ,
109+ properties : {
110+ public_key : { type : 'string' } ,
111+ private_key : { type : 'string' } ,
112+ success : { type : 'boolean' , enum : [ true ] } ,
113+ } ,
114+ required : [ 'success' ] ,
115+ } ) ,
116+ } ,
117+ } ,
118+ async function action ( ) {
119+ const result = await Users . fetchKeysByUserId ( this . userId ) ;
120+
121+ return API . v1 . success ( result ) ;
122+ } ,
123+ )
99124 . get (
100125 'e2e.getUsersOfRoomWithoutKey' ,
101126 {
@@ -142,20 +167,6 @@ const e2eEndpoints = API.v1
142167 } ,
143168 ) ;
144169
145- API . v1 . addRoute (
146- 'e2e.fetchMyKeys' ,
147- {
148- authRequired : true ,
149- } ,
150- {
151- async get ( ) {
152- const result = await Users . fetchKeysByUserId ( this . userId ) ;
153-
154- return API . v1 . success ( result ) ;
155- } ,
156- } ,
157- ) ;
158-
159170/**
160171 * @openapi
161172 * /api/v1/e2e.setUserPublicAndPrivateKeys:
Original file line number Diff line number Diff line change @@ -158,9 +158,6 @@ export type E2eEndpoints = {
158158 '/v1/e2e.rejectSuggestedGroupKey' : {
159159 POST : ( params : E2eGetUsersOfRoomWithoutKeyProps ) => void ;
160160 } ;
161- '/v1/e2e.fetchMyKeys' : {
162- GET : ( ) => { public_key : string ; private_key : string } ;
163- } ;
164161 '/v1/e2e.fetchUsersWaitingForGroupKey' : {
165162 GET : ( params : E2EFetchUsersWaitingForGroupKeyProps ) => {
166163 usersWaitingForE2EKeys : Record < IRoom [ '_id' ] , { _id : IUser [ '_id' ] ; public_key : string } [ ] > ;
You can’t perform that action at this time.
0 commit comments