gqty icon indicating copy to clipboard operation
gqty copied to clipboard

Possible feature: validation of data coming from the API to prevent looping

Open PabloSzx opened this issue 4 years ago • 1 comments

Related to #520

Would actually be possible to validate the data coming from the API to prevent situations like #520 where gqty is not the one at fault?

PabloSzx avatar Jan 17 '22 17:01 PabloSzx

We definitely don't want to validate too much (ajv as an extreme case), that defeats the benefits of TypeScript.

I suggest minimal assertions, e.g. invariant or assert, with a message containing enough information for users to start looking at server side.

invariant(data.allMfes0, "Response with alias `allMfes0` expected.");

vicary avatar Jan 17 '22 18:01 vicary