[GH-ISSUE #36] Schema definition not enforcing policy on child paths #31

Closed
opened 2026-05-23 08:26:49 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @appy-one on GitHub (Jul 14, 2021).
Original GitHub issue: https://github.com/appy-one/acebase/issues/36

Originally assigned to: @appy-one on GitHub.

When a schema is defined on a certain path, it is not enforcing rules (preventing invalid updates) on target child paths. All works well if data is updated on higher or same paths as the schema definition, but not on deeper paths.

Example:

db.schema.set('clients/*',  { 
   name: 'string',
   contacts: {
      '*': {
         type: 'string',
         name: 'string', 
         email: 'string'
      }
});

let result = db.schema.check('clients/client1', { name: 'Some client', contacts: { contact1: 'invalid contact' } }, false);
// result.ok === false, desired result

result = db.schema.check('clients/client1/contact/contact1', 'invalid contact', false);
// result.ok === true, which is wrong

Fix is on its way

Originally created by @appy-one on GitHub (Jul 14, 2021). Original GitHub issue: https://github.com/appy-one/acebase/issues/36 Originally assigned to: @appy-one on GitHub. When a schema is defined on a certain path, it is not enforcing rules (preventing invalid updates) on target child paths. All works well if data is updated on higher or same paths as the schema definition, but not on deeper paths. Example: ```js db.schema.set('clients/*', { name: 'string', contacts: { '*': { type: 'string', name: 'string', email: 'string' } }); let result = db.schema.check('clients/client1', { name: 'Some client', contacts: { contact1: 'invalid contact' } }, false); // result.ok === false, desired result result = db.schema.check('clients/client1/contact/contact1', 'invalid contact', false); // result.ok === true, which is wrong ``` Fix is on its way
gitea-mirror 2026-05-23 08:26:49 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@appy-one commented on GitHub (Jul 14, 2021):

Fix published with v1.8.0

<!-- gh-comment-id:880185857 --> @appy-one commented on GitHub (Jul 14, 2021): Fix published with v1.8.0
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase#31
No description provided.