-
Notifications
You must be signed in to change notification settings - Fork 24
Description
Description of the issue
Follow up of #1882
If you fixed the editor, as shown in #1882, and now want to submit changes you made, this fails with an javascript alert saing "Bad request".
Steps to Reproduce
- Follow setup of Adding a tag to a table without metadata, breaks metadata editor #1882 and apply change to js as described there.
- Now set some attributes and submit the form.
- Get a 400 error.
Ideas of solution
So it does a POST request on http://localhost:8000/api/v0/schema/model_draft/tables/test_with_tag/meta/ and this returns even a message:
Metadata could not be parsed: 'list' object has no attribute 'get'
Unfortunately, the exception is not providing any more context, like what object is problematic and so on.
But with forcing the oep to simply drop the execption unchanged to get the stack trace, we can get at least closer to it.
So looks like this line with Context foreignKeys.
....
metadata, error = actions.try_parse_metadata(raw_input)
File "/home/me/OEP/api/actions.py", line 216, in try_parse_metadata
return parser.parse(inp), None
File "/home/me/OEP/oep-venv/lib/python3.10/site-packages/omi/dialects/base/dialect.py", line 44, in parse
return p.parse_from_string(string, *args, **kwargs)
File "/home/me/OEP/oep-venv/lib/python3.10/site-packages/omi/dialects/oep/parser.py", line 823, in parse_from_string
return self.parse(
File "/home/me/OEP/oep-venv/lib/python3.10/site-packages/omi/dialects/oep/parser.py", line 1161, in parse
source_fields = [
File "/home/me/OEP/oep-venv/lib/python3.10/site-packages/omi/dialects/oep/parser.py", line 1162, in <listcomp>
field_dict[field_name]
KeyError: None
Just for the sake of completeness, here's the json structure that was send (only formatted, else directly from the post request):
post_data.json
Concrete problem here is now:
"foreignKeys":[{"fields":[null]
Null, which become None in Python, seems to be here the problem. If that is updated to an empty list, the query basically works, but another exception occurs:
Metadata could not be compiled: 'JSONCompiler' object has no attribute 'compile'
And here is ends for me.
So easiest solution is probably to get back to #1882 to avoid producing invalid meta JSON structure.
Context and Environment
- Version used: develop
- Operating system: -
- Environment setup and (python) version: -
Workflow checklist
- I am aware of the workflow in CONTRIBUTING.md