Repository navigation
Conversation
export-schema --union combines the Pywr v1 schema, generated by pywr-v1-schema, with the v2 model and multi-network schemas. Each version's definitions are namespaced and the document kind is selected by its identifying property: nodes, models, network or networks.
Every v2 model, including the multi-network ones, and every v1 conversion input must validate, and a document that mixes the v1 and v2 identifying properties, or has none, must be rejected.
A new workflow exports the v2 schema and the combined v1 and v2 schema with pywr-cli and uploads them to the release that was published, so that each version has its schemas at a stable URL.
pywr_model_schema returns a Result with a JsonSchemaError instead of panicking when a schema generator produces an unexpected shape, and the CLI reports it with context. Both v2 document types are generated by one SchemaGenerator, so they share a single definition namespace and cannot number a clashing definition name differently. Root definitions are named from JsonSchema::schema_name rather than from the schema's title, which a doc comment heading or a schemars attribute can change. The help text of --union now says what the default export covers and how v1 custom types are treated.
…hema The union selected its document kind with a oneOf over four alternatives, so any invalid document failed with a bare "not valid under any of the given schemas" and the whole document echoed back. The kind is now chosen by an `if`/`then` on its identifying property, with a oneOf of bare `required` clauses enforcing that exactly one of them is present. The set of accepted documents is unchanged, and a document with a missing or mistyped field reports that field. The tests now reject invalid documents: none or two identifying properties, a missing `time` or `timestepper`, mistyped fields, an unknown v2 node type and a bad v1 edge. Each of the schema's parts is needed by one of them. A further test compares the v2 half of the union with the standalone v2 schema.
gh release upload fails on an asset that already exists, so re-running the job on a release failed. With --clobber the assets are replaced.
CI builds with --locked, which fails when the lock file lacks the entries for a dependency the manifest declares.
…_schema Fork-only: pywr/pywr-v1-schema#300 adds the json_schema module this branch uses, so the published crate cannot build it yet. Drop this commit once that release exists.
Mearman
force-pushed
the
nexsys/schema-union-fork
branch
from
October 9, 2026 09:35
8b35503 to
5375bc8
Compare
Fork-only, with the previous commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Runs the CI of pywr#900 and pywr#901 on this fork, built against the pywr-v1-schema fork branch that carries pywr/pywr-v1-schema#300, so the union export can be tested before either upstream change is released. Not for upstream.