Skip to content

Commit

Permalink
Fix auto bug (#468)
Browse files Browse the repository at this point in the history
* fix

* making changes to add auto hierarchy at the end

* bug_fix

* update version
  • Loading branch information
Vibaswan authored Jun 26, 2024
1 parent 0658ebf commit 72c3196
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions openapiart/bundler.py
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,12 @@ def _generate_value_schema(
}
if xconstants is not None:
schema["x-constants"] = copy.deepcopy(xconstants)
if "features" in xpattern:

# TODO: part of temporary auto hack, to be removed later
auto_heirarchy = False
auto_prop = None

if "features" in xpattern:
if "auto" in xpattern["features"]:
if "auto" in xpattern:
# new enhance for auto hierarchy
Expand Down Expand Up @@ -895,10 +899,7 @@ def _generate_value_schema(
and auto_prop["default"] is True
):
schema["properties"]["choice"]["default"] = "auto"
schema["properties"]["auto"] = {
"$ref": auto_prop["$ref"],
"x-field-uid": auto_field.uid,
}
auto_heirarchy = True

else:
if "default" not in xpattern:
Expand Down Expand Up @@ -928,8 +929,8 @@ def _generate_value_schema(
property_name="auto",
)

# skip this UID as it was previously being used for metric_groups
_ = auto_field.uid
# skip this UID as it was previously being used for metric_groups
_ = auto_field.uid

if "features" in xpattern and "count" in xpattern["features"]:
if xpattern["format"] in ["integer", "ipv4", "ipv6", "mac"]:
Expand Down Expand Up @@ -1060,6 +1061,13 @@ def _generate_value_schema(
metric_tags_schema_name
] = metric_tags_schema

# TODO; temporary hack to add auto hierarchy field at the end, remove later
if auto_heirarchy and auto_prop is not None:
schema["properties"]["auto"] = {
"$ref": auto_prop["$ref"],
"x-field-uid": auto_field.uid,
}

self._apply_common_x_field_pattern_properties(
schema["properties"]["value"],
xpattern,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import setuptools

pkg_name = "openapiart"
version = "0.3.13"
version = "0.3.14"

base_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(base_dir, "readme.md")) as fid:
Expand Down

0 comments on commit 72c3196

Please sign in to comment.