mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 07:26:03 -03:30
Maintain nested context for validation error messages
This commit is contained in:
@@ -790,7 +790,9 @@ class CredentialTypeInjectorField(JSONSchemaField):
|
|||||||
'extra_vars': {
|
'extra_vars': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'patternProperties': {
|
'patternProperties': {
|
||||||
r'^(?:(?:{(?:{|%)[^{}]*?(?:%|})})|(?:[a-zA-Z_]+[a-zA-Z0-9_]*)+)+$': {"anyOf": [{'type': 'string'}, {'$ref': '#/properties/extra_vars'}]}
|
r'^(?:(?:{(?:{|%)[^{}]*?(?:%|})})|(?:[a-zA-Z_]+[a-zA-Z0-9_]*)+)+$': {
|
||||||
|
"anyOf": [{'type': 'string'}, {'type': 'array'}, {'$ref': '#/properties/extra_vars'}]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'additionalProperties': False,
|
'additionalProperties': False,
|
||||||
},
|
},
|
||||||
@@ -876,9 +878,9 @@ class CredentialTypeInjectorField(JSONSchemaField):
|
|||||||
|
|
||||||
def validate_extra_vars(key, node):
|
def validate_extra_vars(key, node):
|
||||||
if isinstance(node, dict):
|
if isinstance(node, dict):
|
||||||
return {validate_extra_vars(key, k): validate_extra_vars(k, v) for k, v in node.items()}
|
return {validate_extra_vars(key, k): validate_extra_vars("{key}.{k}".format(key=key, k=k), v) for k, v in node.items()}
|
||||||
elif isinstance(node, list):
|
elif isinstance(node, list):
|
||||||
return [validate_extra_vars(key, x) for x in node]
|
return [validate_extra_vars("{key}[{i}]".format(key=key, i=i), x) for i, x in enumerate(node)]
|
||||||
else:
|
else:
|
||||||
validate_template_string("extra_vars", key, node)
|
validate_template_string("extra_vars", key, node)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user