Skip to content

Enable and fix schema test - #1705

Open
scpeters wants to merge 6 commits into
scpeters/install_types_xsdfrom
scpeters/schema_xml_catalog
Open

Enable and fix schema test#1705
scpeters wants to merge 6 commits into
scpeters/install_types_xsdfrom
scpeters/schema_xml_catalog

Conversation

@scpeters

@scpeters scpeters commented Sep 2, 2026

Copy link
Copy Markdown
Member

🦟 Bug fix

Fixes #1656, builds on top of #1704

Summary

As noted in #1656, the schema integration test is broken with xmllint version 2.15.0 and later, when its internal HTTP client was removed (see also RoboStack/ros-jazzy#200) with failures like:

Failed to load the document 'http://sdformat.org/schemas/types.xsd' for inclusion

Gemini suggested using an XML catalog to map the external document references to locally cached copies, which is done in 628139a. There are also some failures of the schema test that are fixed by modifying the xmlschema.py script in the following commits (which I recommend reviewing as separate commits):

  • c981b64 refactors the print_element and print_xsd methods to make their implementations more similar and reduce the diff of subsequent commits. It has mild behavior changes detailed in the commit message. The diff without whitespace may be useful
  • 83230c5 adds support for an element with both attributes (complex type) and a text value (simple content), such as <pose degrees='true'>0 0 0 0 0 0</pose>. The diff without whitespace may be useful
  • e4e0652 ensures that nested includes are handled recursively

Backport Policy

  • This is safe to backport to the following versions:
    • Jetty
    • Ionic
    • Harmonic
    • Fortress
  • This should not be backported
  • I am not sure
  • Other (fill in yourself)

there will be conflicts backporting to harmonic, as it doesn't have 1.12

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the fix (as needed)
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Assisted-by" to your commits. (See this policy for more info.)

Assisted-by: Gemini 3.6 Flash

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

Backports: If this is a backport, please use Rebase and Merge instead.

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
A catalog.xml file is configured to rewrite http://sdformat.org/schemas/
URIs to the local build output directory CMAKE_CURRENT_BINARY_DIR.
The path to the catalog file is set in XML_CATALOG_FILES and
xmllint is invoked with `--catalogs`.

Assisted-by: Gemini 3.6 Flash

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
@scpeters
scpeters force-pushed the scpeters/schema_xml_catalog branch from d114d9d to 322246e Compare September 2, 2026 18:08
@scpeters scpeters changed the title Fix schema test Enable and fix schema test Sep 2, 2026
@scpeters
scpeters marked this pull request as ready for review September 2, 2026 18:13
@scpeters
scpeters requested a review from azeey as a code owner September 2, 2026 18:13
@scpeters
scpeters marked this pull request as draft September 3, 2026 00:16
@scpeters

scpeters commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

I'm going to clean this up a little more

@scpeters
scpeters force-pushed the scpeters/schema_xml_catalog branch 2 times, most recently from 5c5f099 to 9c053f9 Compare September 3, 2026 06:37
This refactors parts of the print_element and print_xsd
methods to make the implementations more similar and
introduces the following behavior changes:

* Empty-element <xsd:element ... /> tags are split into pairs
  of start-tag and end-tag: <xsd:element ... ></xsd:element>
* The pose element in pose.xsd was missing a type attribute
  that is now added:
  <xsd:element name='pose' type='pose'>...</xsd:element>

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
An XML element that contains child elements, attributes,
or includes is a complexType, and if it also contains a value
then it has simpleContent. An example of this is
<pose degrees='true'>0 0 0 0 0 0</pose>

This updates the XSD generator to properly wrap these elements
in <xsd:simpleContent><xsd:extension base='{type}'>, which
helps fix some of the schema tests.

Assisted-by: Gemini 3.6 Flash

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
@scpeters
scpeters force-pushed the scpeters/schema_xml_catalog branch from 9c053f9 to b511502 Compare September 3, 2026 07:50
Fixed recursive processing of nested <include> elements and top-level
schema inclusions so nested included components (such as <pose>
inside <include>) generate valid schema references.

Assisted-by: Gemini 3.6 Flash

Signed-off-by: Steve Peters <scpeters@intrinsic.ai>
@scpeters
scpeters force-pushed the scpeters/schema_xml_catalog branch from b511502 to e4e0652 Compare September 3, 2026 07:54
@scpeters
scpeters marked this pull request as ready for review September 3, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

2 participants