Skip to content

Commit

Permalink
Merge pull request #380 from necusjz/fix-discriminate-by-in-tmpl
Browse files Browse the repository at this point in the history
handle discriminate_by method in response schema
  • Loading branch information
necusjz authored Jul 10, 2024
2 parents f2fd651 + 2892b9d commit da30202
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/aaz_dev/cli/templates/_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ def handle_keyword(env, data):

data = data.split(".")

return data[0] + "".join(get_prop(env, i) for i in data[1:]) # keyword in response, x.else.x -> x["else"].x
properties = ""
for d in data[1:]:
if d in _PYTHON_BUILD_IN_KEYWORDS:
properties += get_prop(env, d)
else:
properties += f".{d}"

return data[0] + properties # keyword in response, e.g., x.else.x -> x["else"].x


custom_filters = {
Expand Down

0 comments on commit da30202

Please sign in to comment.