diff --git a/lib/resolvers/crud/create.js b/lib/resolvers/crud/create.js index 19e01a3..efa22b3 100644 --- a/lib/resolvers/crud/create.js +++ b/lib/resolvers/crud/create.js @@ -13,15 +13,6 @@ module.exports = async ({ req, res }, service, entity, selection) => { const entries = entriesStructureToEntityStructure(service, entity, astToEntries(input)) query.entries(entries) - if (cds.env.features.cds_validate) { - const assertOptions = { mandatories: true } - const errs = cds.validate(entries, entity, assertOptions) - if (errs) { - if (errs.length === 1) throw errs[0] - throw Object.assign(new Error('MULTIPLE_ERRORS'), { statusCode: 400, details: errs }) - } - } - const result = await service.dispatch(new GraphQLRequest({ req, res, query })) return formatResult(entity, selection, result, false) diff --git a/lib/resolvers/crud/update.js b/lib/resolvers/crud/update.js index 078777b..0a8da06 100644 --- a/lib/resolvers/crud/update.js +++ b/lib/resolvers/crud/update.js @@ -24,15 +24,6 @@ module.exports = async ({ req, res }, service, entity, selection) => { const entries = entriesStructureToEntityStructure(service, entity, astToEntries(input)) query.with(entries) - if (cds.env.features.cds_validate) { - const assertOptions = { mandatories: true } - const errs = cds.validate(entries, entity, assertOptions) - if (errs) { - if (errs.length === 1) throw errs[0] - throw Object.assign(new Error('MULTIPLE_ERRORS'), { statusCode: 400, details: errs }) - } - } - let resultBeforeUpdate const result = await service.tx(async tx => { // read needs to be done before the update, otherwise the where clause might become invalid (case that properties in where clause are updated by the mutation)