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
37 changes: 37 additions & 0 deletions .github/workflows/schema-validation.v3.2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Validate iTop datamodel XML version 3.2

on:
pull_request:
branches: [ main ]

jobs:
validate-xml:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install lxml
run: pip install lxml

- name: Verify files exist
run: |
test -f 3.2/itop_design.xsd || (echo "XSD file missing!" && exit 1)
test -f test/datamodel.must-validate.xml || (echo "XML file missing!" && exit 1)

- name: Validate datamodel.must-validate.xml against itop_design.xsd
run: |
python -c '
import lxml.etree as ET
schema = ET.XMLSchema(file="3.2/itop_design.xsd")
parser = ET.XMLParser(schema=schema)
with open("test/datamodel.must-validate.xml", "rb") as f:
ET.parse(f, parser)
print("XML is valid.")
'
9 changes: 3 additions & 6 deletions 3.2/itop_design.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@
<xs:element name="properties" minOccurs="0">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:any />
<xs:any processContents="lax" />
</xs:choice>
</xs:complexType>
</xs:element>
Expand Down Expand Up @@ -1146,17 +1146,14 @@
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element name="id" type="xs:string" />
<xs:any />
</xs:choice>
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attributeGroup ref="alteredNode" />
<xs:anyAttribute />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>

</xs:all>
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attributeGroup ref="alteredNode" />
Expand Down Expand Up @@ -1209,7 +1206,7 @@
<xs:element name="presentation" minOccurs="0">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:any />
<xs:any processContents="lax" />
</xs:choice>
</xs:complexType>
</xs:element>
Expand Down Expand Up @@ -1295,7 +1292,7 @@
<xs:element name="listener" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:any />
<xs:any processContents="lax" />
</xs:choice>
<xs:attribute name="id" type="xs:string" use="required" />
<xs:attributeGroup ref="alteredNode" />
Expand Down