We want to enable the user to ask the GraphQL server whether certain records are valid for the four CRUD cases:
creation
reading
updating
deletion
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:
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.
Call the validation function validateForDeletion and add its errors to any errors from step one.
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:
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.validateForDeletion
and add its errors to any errors from step one.For a more detailed spec see this GitBook entry.