Validate in value before sorting validation

I incorrectly assumed folks wouldn't diverge on the use of the in
value from where it was specified in the OpenAPI spec, but in looking
at the senlin code, I was wrong.

This produces a much more specific warning to explain what is wrong
with the parameters file.

Change-Id: Idffbd55dcd69d8f9ad988f74eb1b4be4b8a56667
This commit is contained in:
Sean Dague 2016-05-18 08:59:33 -04:00
parent 3d24453a9b
commit ba17a1630b
1 changed files with 11 additions and 0 deletions

View File

@ -197,6 +197,17 @@ class RestParametersDirective(Table):
last = None
for key, value in yaml_data.items():
# use of an invalid 'in' value
if value['in'] not in sections:
self.app.warn(
"``%s`` is not a valid value for 'in' (must be one of: %s)"
". (see ``%s``)" % (
value['in'],
", ".join(sorted(sections.keys())),
key)
)
continue
if last is None:
last = (key, value)
continue