diff --git a/codegenerator/openapi/utils.py b/codegenerator/openapi/utils.py index 3d0f591..4a1575e 100644 --- a/codegenerator/openapi/utils.py +++ b/codegenerator/openapi/utils.py @@ -78,9 +78,9 @@ def merge_api_ref_doc( ep = op.find("div", class_="endpoint-container") ep_divs = ep.find_all("div") url = doc_url_prefix + "".join(ep_divs[0].strings) - summary = "".join(ep_divs[1].strings) + summary = "".join(ep_divs[1].strings).strip("\n") method_span = op.find("div", class_="operation").find( - "span", class_="label" + "span", class_=lambda tag: tag.startswith("label") ) method = method_span.string @@ -173,7 +173,9 @@ def merge_api_ref_doc( # Find the button in the operaion container to get ID of the # details section details_button = op.find("button") - details_section_id = details_button["data-target"].strip("#") + details_section_id = details_button.get( + "data-target", details_button.get("data-bs-target") + ).lstrip("#") details_section = section.find( "section", id=details_section_id ) @@ -550,4 +552,6 @@ def rst_to_md(content: str) -> str: def get_sanitized_description(descr: str) -> LiteralScalarString: - return LiteralScalarString(md(descr, escape_underscores=False).rstrip()) + return LiteralScalarString( + md(descr.strip("\n"), escape_underscores=False).rstrip() + )