profile
viewpoint

Ask questionsContextual validations

I'm looking for a way to validate in different ways in different contexts. For example, take a complex object on the client (browser) with foreign-key fields (IDs) that map to other objects on the backend. The client has a mechanism for retrieving these IDs and naturally trusts them. The client also may not have a reasonable mechanism for validating them. On the server, we don't trust these to be valid IDs by default. We need to ensure that they map to real objects.

How would we share most of the schema, but have slightly differing validations in different contexts?

From a high level, I'm thinking of a context object that can be passed down and used in the validators similar to how a lot of GraphQL server implementations work.

vriad/zod

Answer questions chrbala

Okay to just leave this one hanging for a while? I think things may get clearer once more work has been done on a full-stack example for #86. I've been working on that one for some time - it's been going back and forth between that and your work on #100 which my implementation of #86 is dependent on.

useful!

Related questions

No questions were found.
source:https://uonfu.com/
Github User Rank List