Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace validator with xmlschema (XSD1.1 compliant) #816

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

hamishwillee
Copy link
Contributor

The current validator is XSD 1.0 compliant. That means you can validate for order of elements, and number and type of elements.
I'd like to update to an XSD 1.1 compliant validator, as XSD 1.1 allows validation using patterns, and inter-element validation. For example, with XSD 1.0 you can require that a command has 7 parameters, and that their index is between 1 and 7, but with XSD 1.1 you can also require that they be unique.

My main interest at this point is to add range checking - allowing us to validate in XSD the allow range(s) for the command and message IDs, and to add exclusion ranges so that we can reserve items more obviously inside the allocated ranges.

The only Python XSD1.1 validate I can find is this one: https://github.com/sissaschool/xmlschema

This update is pretty much a direct replacement. Right now it drops one feature - the ability to turn off strict checking of the types. I've raised a question here to see if there is a way to do this: sissaschool/xmlschema#346

In many ways I prefer the existing parser, but there is no indication if or when it will get v1.1 parsing. Note that the existing parser is capable of doing the same kind of tests that I want, but only in Python, not in XSD. That is not really OK because we want others to be able to validate in their own programming languages if they so wish - so best to embed in the XSD file.

@khancyr
Copy link
Contributor

khancyr commented May 19, 2023

I would said that should be ok. But we need to ensure that Windows can use the new lib and we will need to put a python3.7+ restriction on pymavlink.
That can be an issue depending on the project using it . for example ArduPilot still require python3.6+ so that can have some issue. Even if 3.6 is already from the past.

@hamishwillee
Copy link
Contributor Author

Thanks. I've been running it on Windows (only) so far. Good catch on Python restriction. I still want to see if I can turn off strict checking. Apparently the right way to do this is a second XSD file. If I can do it elegantly I will.

@hamishwillee
Copy link
Contributor Author

Ubuntu 18.04 is running Python 3.6, which might be a blocker

@julianoes
Copy link
Contributor

Python 3.6 is end of life, so not even security supported anymore, since December 2021 (see https://devguide.python.org/versions/#unsupported-versions).

My strong opinion is to remove it from CI here and focus any efforts on what is actually maintained. If we try to maintain each and every old version it creates a burden for maintainers and hence slows everything down.

The only use case of Python 3.6 would be someone building MAVLink directly on a Jetson on Ubuntu 18.04 with stock Python. I would say to ignore that one. Worst case Python can be updated manually in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants