Open ialarmedalien opened 4 years ago
Wait really? But we that customization here: https://github.com/kbase/relation_engine/blob/develop/relation_engine_server/utils/json_validation.py#L26 And you have tests for it here: https://github.com/kbase/relation_engine/blob/develop/relation_engine_server/test/test_json_validation.py#L144
I was looking to add default values for array properties, but it doesn't look like the python jsonschema supports it. I have a couple more things to try, but if the json schema doesn't allow it, I'll close this issue.
OK, it looks like this is an issue with the way defaults are set, as the validator just blindly checks the subschema to see if there's a default field without first checking whether the subschema is a reference or not. 😖 I have changed the schemas I'm using to avoid the problem but ideally the code could be changed to fix the problem.
Stored queries do not currently fill in the default values if they are not supplied as part of the params. Make it so!
ETA: This ticket was originally concerned with populating defaults, but further investigation revealed that the current mechanism for adding defaults (taken from the python-jsonschema repo) does not fetch
$ref
s, so defaults do not get set in some cases.