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

[Bug]: Autogen classes do not set required_name in fields #972

Closed
3 tasks done
rly opened this issue Oct 25, 2023 · 1 comment
Closed
3 tasks done

[Bug]: Autogen classes do not set required_name in fields #972

rly opened this issue Oct 25, 2023 · 1 comment

Comments

@rly
Copy link
Contributor

rly commented Oct 25, 2023

What happened?

Similar to #798

When a group spec contains a subgroup, dataset, or link spec with a container data type, and the subspec has a name, the auto-generated class for that group spec should set "required_name": name for the corresponding subspec field in the class __fields__ variable. Currently, users can specify a different name for the subgroup/dataset/link object and add that object to the parent object without error. Writing the parent object will not write the child object, resulting in a file with missing data and possibly even an invalid file. This has caused problems with several extensions in the past, both for auto-generated classes and custom classes. For auto-generated classes, we can fix the custom class generator. For custom classes, we need to provide guidance in the documentation for writing extensions to avoid this gotcha.

Steps to Reproduce

n/a

Traceback

No response

Operating System

macOS

Python Executable

Conda

Python Version

3.11

Package Versions

No response

Code of Conduct

@rly
Copy link
Contributor Author

rly commented Oct 30, 2023

Fixed by #800. I will open a separate ticket about improving the extensions documentation

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

No branches or pull requests

1 participant