A schema and JSON validator for Pywr.
Report Bug
·
Request Feature
Table of Contents
Pywr is a water resources modelling library. It uses a JSON file format for model definition. Unfortunately it contains no strong schema definition and uses bespoke deserialization methods. This makes parsing model definitions in other tools difficult.
Several attempts have been made to add and strengthen the schema definition in Pywr itself, but
these have become difficult to implement due to backward compatibility reasons. Therefore, this
project has been created as a separate definition of the Pywr JSON schema. It is implemented in
Rust using serde
and serde_json
. It aims to achieve schema compatibility with the latest
version of Pywr while also supporting custom nodes and parameters.
The package is split into a library, pywr_schema
, and validator pywr_validator
. Other tools
may make use of the library for parsing Pywr JSON.
Pywr-schema is built with Rust and requires a working
installation. To validate a Pywr JSON file run the
pywr_validator
as follows.
git clone https://github.com/pywr/pywr-schema.git
cd pywr-schema
cargo r --bin pywr_validator -- --path /path/to/my-model.json
- Initial support for nodes.
- Initial support for parameters.
- Initial support for recorders.
- Schema definitions for all nodes.
- Schema definitions for all parameters.
- Schema definitions for all recorders.
- Python support.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the Apache-2 License. See LICENSE.txt
for more information.
Project Link: https://github.com/pywr/pywr-schema