RocketChat / RocketChat/Rocket.Chat
Fix schema inconsistencies in rooms.ts
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
In packages/rest-typings/src/v1/rooms.ts, two inconsistencies exist between the TypeScript types and their corresponding AJV schemas in RoomsCreateDiscussionSchema and membersOrderedByRoleRolePropsSchema.
Expected Behavior
RoomsCreateDiscussionSchemashould include thetopicfield to match theRoomsCreateDiscussionPropsTypeScript type so clients sendingtopichave it correctly passed through.membersOrderedByRoleRolePropsSchemashould havetype: 'object'at the root level, consistent with all other schemas in the file, so AJV correctly rejects non-object inputs.
Current Behavior
// topic declared in type but missing from schema
type RoomsCreateDiscussionProps = {
...
topic?: string; // exists in type
};
const RoomsCreateDiscussionSchema = {
type: 'object',
properties: {
...
reply: { type: 'string', nullable: true },
// topic missing here — silently stripped by additionalProperties: false
},
required: ['prid', 't_name'],
additionalProperties: false,
};
// missing type: 'object' at root
const membersOrderedByRoleRolePropsSchema = {
// missing type: 'object'
properties: { ... },
oneOf: [{ required: ['roomId'] }, { required: ['roomName'] }],
additionalProperties: false,
};
Steps to Reproduce
See packages/rest-typings/src/v1/rooms.ts
Additional Context
- Every other schema in the file has
type: 'object'at the root making the omission a clear inconsistency additionalProperties: falseactively stripstopicfrom every request silently with no error- Both fixes are purely additive with no runtime behavior changes for any valid existing client
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open packages/rest-typings/src/v1/rooms.ts and compare RoomsCreateDiscussionProps with RoomsCreateDiscussionSchema, then inspect membersOrderedByRoleRolePropsSchema against the other schemas in the file. Add the missing schema definitions and verify that topic is accepted and non-object inputs are rejected as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100