feat: add -force to bypass request schema validation - #77
Open
Bucknalla wants to merge 1 commit into
Open
Conversation
Add a -force flag to the notecard CLI that skips JSON schema validation of -req. Validation is opt-in via the BLUES environment variable and is warn-only, so -force suppresses the warning and, more usefully, skips the live schema fetches that initSchema performs -- helpful when working offline or against a request the published schema does not yet cover. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T8F6xMAoAdBizsR7cUKc4F
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.
Summary
Adds a
-forceflag to thenotecardCLI that skips JSON schema validation of-req.What it does
Three changes, all in
notecard/main.go:-forcealongside-dryif err == nil && validateJSON && !actionForce {forceto thecommhelp group —lib.PrintGroupedFlagsonly iterates grouped flags, so a registered-but-ungrouped flag is silently missing from-helpwhile still building cleanNote on what "bypass" means here
Schema validation today is opt-in via the
BLUESenv var and is warn-only — it printswarning: ...to stderr and sends the request anyway. So-forcesuppresses that warning; it does not unblock a request that was previously refused, because nothing was ever refused.The bigger practical win is network I/O:
initSchemafetches the top-level schema plus every$reflive. Same invalid request, measured:That makes it useful when working offline, or against a request the published schema doesn't cover yet.
If we'd rather validation actually gate sends and
-forcebe the override, that's a separate change — happy to follow up.Testing
go buildandgo vet ./notecard/cleannotecard -helpconfirmed to render-forceunder Communication & DebugBLUES=1 notecard -req '{"req":"card.time","bogusfield":123}' -dry -verbosewith and without-force(output above)No new tests —
-dry,-nobinand the other flags don't have any either. Docs unchanged, matching the-nobinprecedent (18db54f); the README doesn't enumerate flags.Pre-existing, not addressed
-dryadvertises "validate a -req but do not send it" but never gated on validation success, so-dry -forcevalidates nothing and sends nothing.🤖 Generated with Claude Code
https://claude.ai/code/session_01T8F6xMAoAdBizsR7cUKc4F