Skip to content

feat: validate_on_decode, and generated validators end to end - #71

Merged
Kinflou merged 1 commit into
mainfrom
feat/validate-on-decode
Oct 18, 2026
Merged

Kinflou merged 1 commit into
mainfrom
feat/validate-on-decode

Conversation

@Kinflou

@Kinflou Kinflou commented Oct 18, 2026

Copy link
Copy Markdown
Member

Step 4c of core#96, plus the cli's part of #99.

  • The setting: comline.toml gains validate_on_decode = "off" | "collect" | "first" in [generate] and per [[generate.target]].
    • Also settable as COMLINE_GENERATE_VALIDATE_ON_DECODE and --validate-on-decode, with the same precedence as external_std (flag → env → target → section → off).
    • An unknown value is an error naming the accepted ones.
    • comline new's template lists it.
  • Pins: core#109, generation#57's codegen, comline-rust#52, comline-typescript#43.
  • New end-to-end test: generated_validators_run_end_to_end runs the real comline generate on a package that uses std's StringBounds through a type alias, then tests the generated crate:
    • validate() returns each failure's path and message (friends[1] must be at least 2 characters);
    • with collect, the provider refuses a call whose argument fails its checks, and the connection survives.
  • Test helper fix: copy_fixture now copies a fixture's comline.toml; it silently dropped it before.

Tests, clippy (-D warnings) and fmt all pass.

comline.toml's [generate] / [[generate.target]] validate_on_decode (off | collect | first), with COMLINE_GENERATE_VALIDATE_ON_DECODE and --validate-on-decode, resolved like external_std and handed to the generator. An unknown value names the accepted ones. comline new's template lists it.

Pins core 8243d98, codegen 16b94d4, comline-rust d0c5013, comline-typescript 9f2b7ec. A second end-to-end test generates a package using std's StringBounds through a type alias and runs it: validate() reports paths and messages, and with collect a call whose argument fails is refused while the connection survives. copy_fixture now carries a fixture's comline.toml.
@Kinflou
Kinflou merged commit 45fa399 into main Oct 18, 2026
2 checks passed
@Kinflou
Kinflou deleted the feat/validate-on-decode branch October 18, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant