Repository navigation
feat(dfns): add attribute for conditionally required fields - #395
Merged
Merged
Conversation
A field's `when` names a keyword in its component's options block. The field is absent unless that keyword is set; `optional` then says whether it may still be left out. v1 says this only in prose, so a consumer reading a row couldn't tell which columns it has. * gwf-evt's petm0: when = "surf_rate_specified", no longer optional (MF6 reads it only, and then always, with SURF_RATE_SPECIFIED) * every boundname column: when = "boundnames", still optional * validate that `when` names a keyword option of the component * render a `when` field in brackets, like an optional one Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wpbonelli
marked this pull request as ready for review
October 15, 2026 13:43
wpbonelli
added a commit
to wpbonelli/pyphoenix-project
that referenced
this pull request
Oct 15, 2026
Pins MODFLOW-ORG/modflow-devtools#395 (9a1662ef), which adds the when attribute codegen will read in place of the _OPTION_COLUMNS table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wpbonelli
added a commit
to modflowpy/pyphoenix-project
that referenced
this pull request
Oct 15, 2026
Some fields are valid only when another option is set, e.g. EVT's petm0 with SURF_RATE_SPECIFIED. The DFNs now have a when attribute (MODFLOW-ORG/modflow-devtools#395) indicating this. Use it Boundnames move onto the same mechanism after #470
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.
Introduce a field attribute
whenwhich can be used to name a keyword in the same component's options block that toggles whether the field may be provided. Applies towhen = "surf_rate_specified"when = "boundnames"whenandoptionalinteract in the following way:whendecides whether a field may be provided, based on the presence/absence of another keyword field, andoptionalthen decides whether it may be omitted. A field withwhenand withoutoptionalmust always be provided if its conditional keyword is provided.