Skip to content

feat(dfns): add attribute for conditionally required fields - #395

Merged
wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:when-attribute
Oct 15, 2026
Merged

wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:when-attribute

Conversation

@wpbonelli

@wpbonelli wpbonelli commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Introduce a field attribute when which can be used to name a keyword in the same component's options block that toggles whether the field may be provided. Applies to

  • gwf-evt's petm0: when = "surf_rate_specified"
  • every boundname column: when = "boundnames"

when and optional interact in the following way: when decides whether a field may be provided, based on the presence/absence of another keyword field, and optional then decides whether it may be omitted. A field with when and without optional must always be provided if its conditional keyword is provided.

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 wpbonelli added this to the 1.10.0 milestone Oct 15, 2026
@wpbonelli wpbonelli added the enhancement New feature or request label Oct 15, 2026
@wpbonelli
wpbonelli marked this pull request as ready for review October 15, 2026 13:43
@wpbonelli
wpbonelli merged commit 9a1662e into MODFLOW-ORG:develop Oct 15, 2026
17 checks passed
@wpbonelli
wpbonelli deleted the when-attribute branch October 15, 2026 13:44
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant