diff --git a/ving/docs/change-log.md b/ving/docs/change-log.md index 7b5f2d56..7cb45280 100644 --- a/ving/docs/change-log.md +++ b/ving/docs/change-log.md @@ -9,7 +9,8 @@ outline: deep * Fix a bug in redis client where it wouldn't connect to the AWS valkey/redis cluster. * Fix a hydration mismatch in form inputs subtext. * Fix a hydration mismatch in markdown inputs. - * Added error hanlding to verifyExtension() in S3File. + * Added error handling to verifyExtension() in S3File. + * Added validation for acceptedFileExtensions in ving schemas being in the wrong place. ### 2024-10-24 * Installed dotenv for environment variables. diff --git a/ving/schema/validator.mjs b/ving/schema/validator.mjs index 121630da..55859a55 100644 --- a/ving/schema/validator.mjs +++ b/ving/schema/validator.mjs @@ -116,6 +116,8 @@ export const validateRelationAcceptedFileExtensions = (prop, schema) => { throw ving.ouch(442, `${formatPropPath(prop, schema)}.relation.acceptedFileExtensions should not exist.`); return; } + if (('acceptedFileExtensions' in prop)) // should not be a prop, if it exists it should be on relation + throw ving.ouch(442, `${formatPropPath(prop, schema)}.acceptedFileExtensions should be in the relation object, not the prop object.`); if (!('acceptedFileExtensions' in prop.relation)) // optional return; if (!isArray(prop.relation.acceptedFileExtensions))