Skip to content

Commit

Permalink
fix parsing problem
Browse files Browse the repository at this point in the history
  • Loading branch information
rizen committed Apr 25, 2024
1 parent 338830a commit c548c25
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ving/schema/validator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,8 @@ export const validateOwner = (schema) => {
}
else if (/\$/.test(owner)) {
const found = owner.match(/^\$(.*)$/);
if (!isArray(found) || found.length < 2)
throw ving.ouch(442, `Schema ${schema.kind} owner ${owner} is malformed.`);
const prop = schema.props.find(p => p.name == found[1]);
if (isUndefined(prop))
throw ving.ouch(442, `Schema ${schema.kind} owner ${owner} is not in the props.`);
Expand All @@ -616,7 +618,9 @@ export const validateOwner = (schema) => {
throw ving.ouch(442, `Schema ${schema.kind} owner ${owner} must reference a User.`);
}
else if (/\^/.test(owner)) {
const found = owner.match(/^\$(.*)$/);
const found = owner.match(/^\^(.*)$/);
if (!isArray(found) || found.length < 2)
throw ving.ouch(442, `Schema ${schema.kind} owner ${owner} is malformed.`);
const prop = schema.props.find(p => p.relation?.name == found[1]);
if (isUndefined(prop))
throw ving.ouch(442, `Schema ${schema.kind} owner ${owner} is not in the props.`);
Expand Down

0 comments on commit c548c25

Please sign in to comment.