Skip to content

Fix schema inconsistencies in rooms.ts #39680

@amitkumarashutosh

Description

@amitkumarashutosh

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

  • RoomsCreateDiscussionSchema should include the topic field to match the RoomsCreateDiscussionProps TypeScript type so clients sending topic have it correctly passed through.
  • membersOrderedByRoleRolePropsSchema should have type: '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: false actively strips topic from every request silently with no error
  • Both fixes are purely additive with no runtime behavior changes for any valid existing client

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions