Skip to main content

Convert XML Schema Definitions to Voluptuous schemas.

Project description

xsd-to-vol

ci Code style: black Open Issues Release

Convert XML Schema Definition files to voluptuous schemas.

Binary file usage

Basic usage:

xml-to-vol -i schema.xsd -o schema.py

Basic pipe usage:

cat schema.xsd | xml-to-vol > schema.py

Pipe through black formatter:

cat schema.xsd | xsd-to-vol | black - > schema.py

Advanced piping example with curl:

curl -s https://api-test.geofox.de/gti/public/geofoxThinInterfacePublic.xsd 2>&1 | xsd-to-vol | black - > schema.py

You can also mix input/output files and stdin/stdout.

Library usage

You can also use the xml_to_vol method to convert your schema:

from xsd_to_vol import xsd_to_vol

with open("schema.xsd", 'r') as schema_file:
    xsd = schema_file.read()
    print(xsd_to_vol(xsd))

To Do

While the generation should work for most xsd files, there are some features I'd like to have in future versions:

  • Only include used imports: Currently all possible voluptuous requirements are imported. The required imports can be determined.
  • Tests: Gather different xsd schemas and build pytests to test the generation.
  • Automatic code formatting: Run black over the code (without piping).

Contributions are welcome!

If you want to contribute to this, please read the Contribution guidelines

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xsd-to-vol-0.0.6.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

xsd_to_vol-0.0.6-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file xsd-to-vol-0.0.6.tar.gz.

File metadata

  • Download URL: xsd-to-vol-0.0.6.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for xsd-to-vol-0.0.6.tar.gz
Algorithm Hash digest
SHA256 205c1578630a15ff847b91ea88d1eeb3782a987f16b3fd19b6def39b196d063f
MD5 36c0265f5e84c51109d59571cdb3ccc2
BLAKE2b-256 9e71e144f8a6fd67a6c548ae0e00bfccd29166e647e15af093b1e0ac64631e75

See more details on using hashes here.

File details

Details for the file xsd_to_vol-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: xsd_to_vol-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for xsd_to_vol-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 85ef305dcd81630d763432cafcd6e9fb03d5002c2bf33dc53e8f9c033f04537c
MD5 96ce2e8fc76f3ac85eaf52546d6417c6
BLAKE2b-256 d3afeb9d2c558906e36fac27b62826f86962d4e58928a4b88d34cb9213770236

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page