Details
Flow
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
This looks strange, but it seems like entryQueryInputValidator is calendarQueryValidator with some additional, optional fields. Could you check if clients don't send the additional fields? If they do, we can consider changing the JS types to EntryQueryInput.
No they don't send those additional fields, EntryQueryInput type is hardly used at all. It's used only in fetch_entries endpoint, but:
- the clients send CalendarQuery anyway: https://github.com/CommE2E/comm/blob/master/lib/actions/entry-actions.js#L53
- keyserver expects EntryQueryInput
- the first thing the endpoint does is converting it to calendar query: https://github.com/CommE2E/comm/blob/master/keyserver/src/responders/entry-responders.js#L104
so I think EntryQueryInput is some old type we migrated from
so I think EntryQueryInput is some old type we migrated from
Please don't guess. This type was introduced about 2 years ago, so it isn't recent, but also isn't legacy that we migrated from. Please check a diff where it was introduced and analyze the reason.
It was introduced in this diff: https://phab.comm.dev/D7467 and it was to improve typing of an already existing entryQueryInputValidator. In the diff you can also find newEntryQueryInputValidator that validates CalendarQuery type.
entryQueryInputValidator was introduced long long (7 years) ago https://github.com/CommE2E/comm/commit/44593bbbc0187c2c20b7a940d931d6d7c8309649#diff-ceab430b83d30b638c21e89a6102f8a82710356c5ec6dc36b7b81bfa6b9a02e1R16
newEntryQueryInputValidator was introduced here: https://github.com/CommE2E/comm/commit/885aea0e0ffd2f4b17e7e61c349929929afe286c and here https://phab.comm.dev/D12359 you can see that it's used more and how it turned into calendarQueryValidator.
Great! So it's probably safe to replace the validators. Checked randomly and some types weren't changed at least from 2021, so it's likely we're safe here.