Skip to content

Commit f4d88b5

Browse files
committed
Modeling from assertions.
1 parent d7f2776 commit f4d88b5

File tree

17 files changed

+3183
-1181
lines changed

17 files changed

+3183
-1181
lines changed

doc/parse_gx_xsd.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -83,28 +83,20 @@ def _build_tag(tag, hide_attributes):
8383
assertions_buffer.write(_doc_or_none(assertions_tag))
8484
assertions_buffer.write("\n\n")
8585

86-
assertion_groups = assertions_tag.xpath(
87-
"xs:choice/xs:group", namespaces={"xs": "http://www.w3.org/2001/XMLSchema"}
86+
assertion_tag = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}group[@name='TestAssertion']")
87+
elements = assertion_tag.findall(
88+
"{http://www.w3.org/2001/XMLSchema}choice/{http://www.w3.org/2001/XMLSchema}element"
8889
)
89-
for group in assertion_groups:
90-
ref = group.attrib["ref"]
91-
assertion_tag = xmlschema_doc.find("//{http://www.w3.org/2001/XMLSchema}group[@name='" + ref + "']")
92-
doc = _doc_or_none(assertion_tag)
93-
assertions_buffer.write(f"### {doc}\n\n")
94-
elements = assertion_tag.findall(
95-
"{http://www.w3.org/2001/XMLSchema}choice/{http://www.w3.org/2001/XMLSchema}element"
96-
)
97-
for element in elements:
90+
for element in elements:
91+
doc = _doc_or_none(element)
92+
if doc is None:
9893
doc = _doc_or_none(element)
99-
if doc is None:
100-
doc = _doc_or_none(_type_el(element))
101-
assert doc is not None, f"Documentation for {element.attrib['name']} is empty"
102-
doc = doc.strip()
103-
104-
element_el = _find_tag_el(element)
105-
element_attributes = _find_attributes(element_el)
106-
doc = _replace_attribute_list(element_el, doc, element_attributes)
107-
assertions_buffer.write(f"#### ``{element.attrib['name']}``:\n\n{doc}\n\n")
94+
assert doc is not None, f"Documentation for {element.attrib['name']} is empty"
95+
doc = doc.strip()
96+
97+
element_attributes = _find_attributes(element)
98+
doc = _replace_attribute_list(element, doc, element_attributes)
99+
assertions_buffer.write(f"#### ``{element.attrib['name']}``:\n\n{doc}\n\n")
108100
text = text.replace(line, assertions_buffer.getvalue())
109101
tag_help.write(text)
110102
if best_practices := _get_bp_link(annotation_el):

0 commit comments

Comments
 (0)