From 8a6ce551e42915f1b9f3f2de46198b5079ba59aa Mon Sep 17 00:00:00 2001 From: Jeroen Branje Date: Sun, 15 Dec 2024 23:30:21 +0100 Subject: [PATCH] feat: add error message for manifest and domainMetadata Signed-off-by: Jeroen Branje --- apps/envited.ascs.digital/common/constants/errors.ts | 2 ++ apps/envited.ascs.digital/common/validator/shacl/shacl.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/envited.ascs.digital/common/constants/errors.ts b/apps/envited.ascs.digital/common/constants/errors.ts index f0cf20d5..71209937 100644 --- a/apps/envited.ascs.digital/common/constants/errors.ts +++ b/apps/envited.ascs.digital/common/constants/errors.ts @@ -8,6 +8,8 @@ export const ERRORS = { ASSETS_NOT_FOUND: 'Assets not found', ASSET_INVALID: 'Asset validation failed', ASSET_FILE_NOT_FOUND: 'No valid metadata.json found', + DOMAIN_METADATA_INVALID: 'domainMetadata.json validation failed', + MANIFEST_INVALID: 'manifest.json validation failed', FILES_NOT_FOUND: 'File(s) not found', README_FILE_NOT_FOUND: 'README.md file not found', NOT_ALLOWED_TO_DELETE_ASSET: 'Not allowed to delete asset', diff --git a/apps/envited.ascs.digital/common/validator/shacl/shacl.ts b/apps/envited.ascs.digital/common/validator/shacl/shacl.ts index 469408c8..f7b265da 100644 --- a/apps/envited.ascs.digital/common/validator/shacl/shacl.ts +++ b/apps/envited.ascs.digital/common/validator/shacl/shacl.ts @@ -73,11 +73,11 @@ export const _validateShaclFile = const { conforms: domainMetadataConforms, data: domainMetadata } = await validateDomainMetadata(file, manifest) if (!manifestConforms) { - return { isValid: false, data: {}, error: ERRORS.ASSET_INVALID } + return { isValid: false, data: {}, error: ERRORS.MANIFEST_INVALID } } if (!domainMetadataConforms) { - return { isValid: false, data: {}, error: ERRORS.ASSET_INVALID } + return { isValid: false, data: {}, error: ERRORS.DOMAIN_METADATA_INVALID } } return { isValid: true, data: { manifest, domainMetadata } }