Deltares / HYDROLIB-core

Core code around the I/O of the DHYDRO-suite
https://deltares.github.io/HYDROLIB-core/
MIT License
24 stars 4 forks source link

Investigate Pydantic class generation directly from xsd for D-RTC files. #141

Open arthurvd opened 2 years ago

arthurvd commented 2 years ago

Context: We're considering to support the full RTCTools input set of xml files, which are quite rich, but have a set of well-defined xsds. Is it possible to automatically generate Pydantic classes from these xsds?

This issue is supposed to be a small investigation issue. Clean implementation can be done in new-to-be-created issue(s) when more is clear on the questions below.

Questions:

priscavdsluis commented 2 years ago

using XML Spy in combination with the datamodel-code-generator looks promising:

xsd-jsonschema-py.zip

In the zip file is:

  1. The source file rtcDataConfig.xsd
  2. The intermediate JSON schema file: rtcDataConfig.json
  3. The resultng files: _.py & init.py
  4. A text file with the steps & settings I used to generate these files.