Zendro-dev / graphql-server-model-codegen

Command line utility to auto-generate the structure files for a graphql server
MIT License
1 stars 2 forks source link

Add validation queries for each data model #195

Closed asishallab closed 3 years ago

asishallab commented 3 years ago

We want to enable the user to ask the GraphQL server whether certain records are valid for the four CRUD cases:

The respective validation functions already exist. What is missing is: 1) Extend the GraphQL Schema created for each data model to hold four root queries 2) Extend the resolvers created for each data model to include the respective resolvers. In this, make sure that the errors returned adhere to the format of our validation errors, so that they can be efficiently parsed by the SPA. Also note, that there is a special case with delete validation (see below).

Delete validation must be done in two steps:

  1. Call the respective resolver function validForDeletion. Catch any errors that function returns and make sure they come in the format the SPA can understand, i.e. our AJV standard validation error format.
  2. Call the validation function validateForDeletion and add its errors to any errors from step one.

For a more detailed spec see this GitBook entry.