Closed Vibaswan closed 1 year ago
Do we need this snippet ? Why ?
if "enums" in xpattern:
schema["properties"]["value"]["enum"] = copy.deepcopy(
xpattern["enums"]
)
schema["properties"]["values"]["items"]["enum"] = copy.deepcopy(
xpattern["enums"]
Do we need this too ? can't it be deepcopied directly to schema ?
xconstants = (
xpattern["x-constants"] if "x-constants" in xpattern else None
)
This is again coming from old code, but shouldn't we check if counter
feature is provided before defining Incr/Decr schemas ?
if xpattern["format"] in ["integer", "ipv4", "ipv6", "mac"]:
counter_pattern_name = "{}.Counter".format(schema_name)
these were from beginning not sure of the use-cases
these were from beginning not sure of the use-cases
Would suggest removing any unused code, hence asking for confirmation if it's indeed used
We're not setting correct format for auto
field (for integer
)
Do not provide minimum and maximum for properties which require exact 32/64 bits.
We're not setting correct format for
auto
field (forinteger
)
already showcased this
these were from beginning not sure of the use-cases
Would suggest removing any unused code, hence asking for confirmation if it's indeed used
removed unused code
Still see some consistency issues in bundler.py:
_apply_common_x_field_pattern_properties
on count
?count
property if count
feature is selected; Ideally the entire schema shouldn't be generated at all if count
feature is not selected.empty string not needed
pt.get("type", "") == "int" or pt.get("itemtype") == "int"
Inside _get_integer_format
, if type_format
is None, set it to int32
needs to be and
def _min_max_in_range(cls, format, min, max):
if min is None or max is None:
return True
Remove _format_from_range
and its usage. Print a WARNING that since format has not been provided, it's being defaulted to int32
Probably need to include map for int32
self._oapi_go_types = {
Remove
elif property_schema["format"].lower() in self._oapi_go_types:
go_type = "{oapi_go_type}".format(
oapi_go_type=self._oapi_go_types[
property_schema["format"].lower()
]
)
use startswith
if "uint" in field.type and field.min == 0:
pass
Fixes #436 Fixes #437 Fixes #438