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

Error raised when processing an object schema with no properties #62

Open
eslavich opened this issue Feb 19, 2021 · 0 comments
Open

Error raised when processing an object schema with no properties #62

eslavich opened this issue Feb 19, 2021 · 0 comments

Comments

@eslavich
Copy link
Collaborator

@PaulHuwe ran into an error when supplying DataModel with a schema containing an object with no properties:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/phuwe/src/roman/romancal/romancal/datamodels/reference_files/referencefile.py", line 10, in __init__
    super().__init__(init=init, **kwargs)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/model_base.py", line 165, in __init__
    self._schema = mschema.merge_property_trees(schema)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 202, in merge_property_trees
    walk_schema(schema, callback)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 149, in walk_schema
    recurse(schema, [], None, ctx)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 129, in recurse
    recurse(sub, path, c, ctx)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 137, in recurse
    recurse(val, path + [key], combiner, ctx)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 137, in recurse
    recurse(val, path + [key], combiner, ctx)
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 124, in recurse
    if callback(schema, path, combiner, ctx, recurse):
  File "/Users/phuwe/anaconda3/envs/roman-dev/lib/python3.9/site-packages/stdatamodels/schema.py", line 194, in callback
    del schema['properties']
KeyError: 'properties'

This works fine in ASDF so it should probably work here as well. The use case is a schema that makes optional properties described in the core schema required.

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