Page MenuHomePhabricator

[lib] Bind output validators to endpoints on lib
ClosedPublic

Authored by inka on May 14 2024, 5:34 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jul 18, 2:30 PM
Unknown Object (File)
Wed, Jul 3, 2:40 PM
Unknown Object (File)
Jun 23 2024, 9:31 PM
Unknown Object (File)
Jun 22 2024, 8:47 AM
Unknown Object (File)
Jun 21 2024, 1:48 AM
Unknown Object (File)
Jun 19 2024, 5:03 PM
Unknown Object (File)
Jun 19 2024, 9:45 AM
Unknown Object (File)
Jun 19 2024, 9:45 AM
Subscribers

Details

Summary

issue: ENG-8080
As I explained in the issue, I wanted to simply use those objects instead of objects in lib/types/endpoints.js. But this causes very complicated import cycles. I know how to solve them, but it would requre refactoring a lot of files, hundreds possibly.
So instead I am creating a separate file with this mapping endpoint-output validator. The dev will not be able to forget about adding the validator here, because that would cause flow issues in the next diff.

Test Plan

Tested with next diffs - checked a couple of endpoints, and verified that no errors are thrown if outputs are validated with validators specified by endpointValidators for those endpoints.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

inka requested review of this revision.May 14 2024, 5:50 AM
tomek added inline comments.
lib/types/validators/endpoint-validators.js
65–110 ↗(On Diff #40158)

Why do we split these into multiple objects but export a single value?

This revision is now accepted and ready to land.May 14 2024, 8:14 AM
lib/types/validators/endpoint-validators.js
65–110 ↗(On Diff #40158)

I kept them split the way they are split in lib/types/endpoints.js. No reason I suppose, I just found it to be easier to navigate