RocketChat / RocketChat/Rocket.Chat
IModerationAudit defines `ts` as `Date | string` which generates a oneOf in JSON Schema.
Nobody has claimed this yet.
- 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):
apps/meteor/app/api/server/v1/moderation.ts#L24apps/meteor/app/api/server/v1/moderation.ts#L62apps/meteor/app/api/server/v1/moderation.ts#L118apps/meteor/app/api/server/v1/moderation.ts#L151apps/meteor/app/api/server/v1/moderation.ts#L506docs/api-endpoint-migration.md#L433
Commit: 74859602abd1b9471926811769d37ef826b030cc
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
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