Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Feature]: Prevent Write on Containers with custom names #122

Closed
3 tasks done
mavaylon1 opened this issue Sep 28, 2023 · 2 comments
Closed
3 tasks done

[Feature]: Prevent Write on Containers with custom names #122

mavaylon1 opened this issue Sep 28, 2023 · 2 comments
Assignees
Labels
category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users
Milestone

Comments

@mavaylon1
Copy link
Contributor

What would you like to see added to HDMF-ZARR?

There is not catch/error for writing root containers (files) that have custom names. In order to properly write, the root container's name need to be "root".

We cannot raise a warning and rename the container due to the fact renaming a container and a builder is not allowed. Raise an error in write_builder to prevent incorrect writing.

Is your feature request related to a problem?

No response

What solution would you like?

if f_builder.name != ROOT_NAME:
            msg = f"Root builder has name {f_builder.name}. Needs to be {ROOT_NAME}."
            raise ValueError(msg)

Do you have any interest in helping implement the feature?

Yes.

Code of Conduct

@mavaylon1 mavaylon1 self-assigned this Sep 28, 2023
@mavaylon1 mavaylon1 added category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users labels Apr 16, 2024
@mavaylon1 mavaylon1 added this to the 0.7.0 milestone Apr 16, 2024
@mavaylon1
Copy link
Contributor Author

I will look back into this before the next release (0.7.0)

@rly
Copy link
Contributor

rly commented Nov 7, 2024

Closing for now because it does not seem to be an issue. I think this came up only in the testing suite where you can have a root builder named something other than "root".

The NWBFile schema hardcodes the name to be "root". Writing a builder with a hardcoded name in the schema ignores the actual name of the container and uses the schema name: https://github.com/hdmf-dev/hdmf/blob/be602e51804922e01bcd0e6f89b23873f9e13b4b/src/hdmf/build/objectmapper.py#L1388

On read, the root group is read into a builder with a hardcoded name "root".

@rly rly closed this as completed Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: bug errors in the code or code behavior priority: medium non-critical problem and/or affecting only a small set of users
Projects
None yet
Development

No branches or pull requests

2 participants