RocketChat / RocketChat/Rocket.Chat

IModerationAudit defines `ts` as `Date | string` which generates a oneOf in JSON Schema.

Open
#39,551 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

todo type: bug
Dominant language
TypeScript
Stars
46.1k
Forks
13.9k
Avg merge
3d 3h
Merged PRs (30d)
130

Description

When the aggregation returns ts as an ISO date string, it matches both Date (format: "date-time")
and string schemas simultaneously, causing AJV oneOf validation to fail with "passingSchemas: 0,1".
Until the core-typings type is revised (either narrowing ts to string to match what MongoDB
aggregation actually returns, or adjusting the AJV schema generation for union types), we use a
relaxed inline schema here that accepts ts as a string.

📝 Found in 6 location(s):

Commit: 74859602abd1b9471926811769d37ef826b030cc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the six IModerationAudit references listed in apps/meteor/app/api/server/v1/moderation.ts and docs/api-endpoint-migration.md, then inspect how the core-typings union becomes an AJV schema. Verify the affected moderation responses with an ISO date string and confirm the completed scope avoids the oneOf validation failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.