sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #05592
Re: [Merge] ~lloydwaltersj/maas:fix-broken-oapi-param-names into maas:master
Review: Approve
+1
small nit inline
Diff comments:
> diff --git a/src/maasserver/api/doc_oapi.py b/src/maasserver/api/doc_oapi.py
> index b7e3a9d..56efa28 100644
> --- a/src/maasserver/api/doc_oapi.py
> +++ b/src/maasserver/api/doc_oapi.py
> @@ -213,8 +213,11 @@ def _oapi_item_from_docstring(
> oper_obj["deprecated"] = True
> for param in ap_dict["params"]:
> description = _prettify(param["description_stripped"])
> - name = param["name"].strip("}{")
> - path_var = name in uri_params
> + # LP 2009140
> + stripped_name = re.match(r"(?<=\{)\.+(?<=\})", param["name"])
since this is performed multiple time, I'd extract the regexp to a global, so it's only compiled once.
E.g.
PARAM_RE = re.compile(r"(?<=\{)\.+(?<=\})")
and then here:
stripped_name = PARAM_RE.match(param["name"])
> + name = (
> + param["name"] if not stripped_name else stripped_name.group()
> + )
> required = (
> param["options"]["required"].lower() == "true"
> or name != param["name"]
--
https://code.launchpad.net/~lloydwaltersj/maas/+git/maas/+merge/438279
Your team MAAS Committers is subscribed to branch maas:master.