Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ else
$(IN_VENV) cd client && yarn install $(YARN_INSTALL_OPTS)
endif

format-xsd:
xmllint --format --output galaxy-tmp.xsd lib/galaxy/tool_util/xsd/galaxy.xsd
mv galaxy-tmp.xsd lib/galaxy/tool_util/xsd/galaxy.xsd

build-api-schema:
$(IN_VENV) python scripts/dump_openapi_schema.py _schema.yaml
Expand Down
32 changes: 12 additions & 20 deletions doc/parse_gx_xsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,28 +83,20 @@ def _build_tag(tag, hide_attributes):
assertions_buffer.write(_doc_or_none(assertions_tag))
assertions_buffer.write("\n\n")

assertion_groups = assertions_tag.xpath(
"xs:choice/xs:group", namespaces={"xs": "http://www.w3.org/2001/XMLSchema"}
assertion_tag = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}group[@name='TestAssertion']")
elements = assertion_tag.findall(
"{http://www.w3.org/2001/XMLSchema}choice/{http://www.w3.org/2001/XMLSchema}element"
)
for group in assertion_groups:
ref = group.attrib["ref"]
assertion_tag = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}group[@name='" + ref + "']")
doc = _doc_or_none(assertion_tag)
assertions_buffer.write(f"### {doc}\n\n")
elements = assertion_tag.findall(
"{http://www.w3.org/2001/XMLSchema}choice/{http://www.w3.org/2001/XMLSchema}element"
)
for element in elements:
for element in elements:
doc = _doc_or_none(element)
if doc is None:
doc = _doc_or_none(element)
if doc is None:
doc = _doc_or_none(_type_el(element))
assert doc is not None, f"Documentation for {element.attrib['name']} is empty"
doc = doc.strip()

element_el = _find_tag_el(element)
element_attributes = _find_attributes(element_el)
doc = _replace_attribute_list(element_el, doc, element_attributes)
assertions_buffer.write(f"#### ``{element.attrib['name']}``:\n\n{doc}\n\n")
assert doc is not None, f"Documentation for {element.attrib['name']} is empty"
doc = doc.strip()

element_attributes = _find_attributes(element)
doc = _replace_attribute_list(element, doc, element_attributes)
assertions_buffer.write(f"#### ``{element.attrib['name']}``:\n\n{doc}\n\n")
text = text.replace(line, assertions_buffer.getvalue())
tag_help.write(text)
if best_practices := _get_bp_link(annotation_el):
Expand Down
Loading