You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then when loading the config outputs an exception:
File ".../routemaster/routemaster/config/loader.py", line 198, in _load_gate
next_states=_load_next_states(path + ['next'], yaml_state.get('next')),
File ".../routemaster/routemaster/config/loader.py", line 284, in _load_next_states
return _load_context_next_states(path, yaml_next_states)
File ".../routemaster/routemaster/config/loader.py", line 312, in _load_context_next_states
default=yaml_next_states['default'],
KeyError: 'default'
This suggests that we're requiring that a state's next mapping contains a 'default' key when the next has a destinations, yet that doesn't match that schema.
I'm not sure whether this is a bug in the schema or is something which we can't express in the schema and should output a better error message for.
When fixing this we should also ensure that we check suitably for the reverse case (a default key without a destinations key). I don't know what the right behaviour is in such cases, though I suspect it's not currently being enforced.
The text was updated successfully, but these errors were encountered:
Yep, I think I just missed this in the schema, so we should add that. I think all destinations should have a default so that developers have to think about what should happen if the data doesn't match what they expected, which it can do given that it's unstructured.
As for the reverse case, I don't think we should support a default with no destinations, because that's just a less clear expression of the shorthand we already have:
Add a test that we get a schema error if no default is provided.
Fix that test by updating the schema.
Ensure that the schema requires a non-empty destinations list if not using the shorthand, and add a test if there isn't already something exercising this case.
I think this should be relatively straightforward, so I've added the "easy" label, it should be reasonable for a first time contributor such as @mthpower...
If you have a config which looks like:
Then when loading the config outputs an exception:
This suggests that we're requiring that a state's
next
mapping contains a'default'
key when thenext
has adestinations
, yet that doesn't match that schema.I'm not sure whether this is a bug in the schema or is something which we can't express in the schema and should output a better error message for.
When fixing this we should also ensure that we check suitably for the reverse case (a
default
key without adestinations
key). I don't know what the right behaviour is in such cases, though I suspect it's not currently being enforced.The text was updated successfully, but these errors were encountered: