Validating year in
Should Graph QL talk to an ORM like mongoose, or does it go straight to the database? Imagine building a universal app that concurrently builds the client and server bundles & then maybe starts up the server.
Do you create a library of custom scalars for passwords, paragraphs, and titles, or do you use external validation? It’s like asking the last person out to close the door, but you can’t see or hear anyone. To avoid the headache, I only establish the connection when necessary: function does nothing but resolves. In production, you have attackers calling your Graph QL endpoints trying to query documents that don’t belong to them.
Other types of validation include applying patterns to data to enforce business rules, such as a credit card, phone number, or email address.Most of the properties are required and several string properties have length requirements.Additionally, there is a numeric range restriction in place for the for validation purposes. There may be instances where you need more features than built-in attributes provide.While the correct answer is always “it depends”, I like to default to larger, more powerful mutations because it lets you iterate faster. If your form gets a new field, you add it to the front-end, you add it to your Graph QL schema, your validation schema, and you’re good to go. If you want a deep dive into auth and error handling in Graph QL, you can always check out my Graph QL Field Guide to Auth.