-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Expected behavior
In PR #177, #187, and #188, we expanded on the input schema and input file format. In each of these PRs we added tests to cover the new input variables, but there are still tests missing ensuring that the older variables are also covered.
Additionally, when we validate this schema in python, we should be able to do things:
- Set any default values using the approach described here.
- Check that there are no misspelled or additional properties in the input file by using the
unevaluatedPropertieskeyword in the schema.
Describe the bug
Here's what I think is happening:
When we try to include item 1 and 2 in our program flow, the following appears to happen:
a. The validator looks for which properties are included in the input file, and makes these the allowed list of properties.
b. The validator then tries to fill the defaults, but because in step A we made the allowed list of properties only those that are included in the input file, there is no need to set any defaults as all needed properties already have values.
I'm unsure if this is actually happening. Someone will need to check.
To Reproduce
Steps to reproduce the behavior:
- Add
"unevaluatedProperties": falseto thedepcodesubschema ininput_schema.json"
depcode : {
description : Depcode class input parameters ,
type : object ,
default : {},
unevaluatedProperties : false,
"properties": {
...- Run
pytest --pdb tests/unit_tests/test_app.py - Observe the error:
j = obj
> print(j['reactor']['timestep_type'])
E KeyError: 'timestep_type'
saltproc/app.py:166: KeyError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB post_mortem (IO-capturing turned off) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/ooblack/projects/saltproc/saltproc/app.py(166)read_main_input()
-> print(j['reactor']['timestep_type'])Supporting Informatioon
System Specifications:
- Software version: SaltProc v0.5.0-dev
- Platform/OS: Ubuntu 22.04LTS
How can this issue be closed?
This issue can be closed when a PR exists that fixes the schema validation and adds coverage to the test suite for all input variables. The first item may require rewriting the schema as well as diving deeper into the jsonschema python package and modifying _schema_default.py