0dbab33c4c
* When YAQL output data conversion is disabled there's still an issue caused by presence of not JSON-compatible types within a YAQL result. The internal Mistral code is already able to deal with that (due to the previous changes) by checking that and converting them to what's needed. However, JSON serialization may still not work if it's done via the standard "json" library. The library simply doesn't handle those non-standard types and raises an exception. We have a sanitizing function that all YAQL results go through, however, it doesn't make sense to do recursive sanitizing for performance reasons. It does make sense to convert data as late as possible to avoid redundant data manipulations. So the sanitizing function handles only the root object in the object graph. The solution for this problem is to use our own utility function based on the "oslo_serialization.jsonutils" that is able to deal with at least part of the mentioned types, specifically FrozenDict and iterators. Generators are still a problem and this new function takes care of that separately, assuming that any generator is just a special iterator and hence represents a collection, i.e. a list in JSON terms. It works for all the cases we've encountered so far working with YAQL. * Used the new function "utils.to_json_str()" everywhere for JSON serialization, including the action "std.http". * Added necessary unit tests. Closes-Bug: #1869168 Depends-On: I1081a44a6f305eb1dfe68a5bad30110385130725 Change-Id: I9e73ea7cbba215c3e1d174b5189be27c640c4d42 |
||
---|---|---|
.. | ||
__init__.py | ||
base.py | ||
jinja_expression.py | ||
std_functions.py | ||
yaql_expression.py |