Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

DataItem::access() being recursive causes problems #5

Open
joachim-n opened this issue Jul 14, 2021 · 0 comments
Open

DataItem::access() being recursive causes problems #5

joachim-n opened this issue Jul 14, 2021 · 0 comments

Comments

@joachim-n
Copy link
Owner

DataItem::access() recurses down into complex properties, so calling access() on root calls it on everything.

This causes problems with certain structures and default values, particularly with single-valued complex data. Consider the following property structure:

- root
  - scalar_default
  - complex_single
    - child_scalar_default

When the data is first instantiated, nothing is set.

Calling access() causes the following

  • scalar_default is instantiated and have its default set, which is OK.
  • complex_single is instantiated, which is ok, so far...
  • but then we recurse, because it's single-valued
  • child_scalar_default is instantiated, and gets its default set.

This is not OK, because we now have this data:

- root
  - scalar_default: foo
  - complex_single
    - child_scalar_default: foo

The user has not set the optional complex_single, but it now exists with a value set!

This situation exists in DCB:

  • README is a scalar with a default
  • Admin settings form is a complex single with properties with default values

Currently, calling access() on the DCB data root will cause the module to have an admin settings form by default, which is not intended.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant