improve parsing of JSON inputs

see: https://github.com/ansible/awx/issues/4573
see: https://github.com/ansible/awx/issues/2371
This commit is contained in:
Ryan Petrello
2019-08-26 18:08:01 -04:00
parent 9e849ad3e6
commit f22adca6f7
8 changed files with 88 additions and 19 deletions

View File

@@ -408,3 +408,14 @@ def prevent_search(relation):
"""
setattr(relation, '__prevent_search__', True)
return relation
def accepts_json(relation):
"""
Used to mark a model field as allowing JSON e.g,. JobTemplate.extra_vars
This is *mostly* used as a way to provide type hints for certain fields
so that HTTP OPTIONS reports the type data we need for the CLI to allow
JSON/YAML input.
"""
setattr(relation, '__accepts_json__', True)
return relation