JSON v3 — Field v3 Migration + Post-Decode Validation#8
Conversation
…t-decode Validate() This commit implements the Field v3 migration as described in docs/PLAN.md: - Updated `encode.go`: removed `parseJSONTag`, updated `encodeFielder` to use `field.Name` and `field.OmitEmpty`. - Updated `parser.go`: modified `matchFieldIndex` to use `field.Name` directly. - Updated `decode.go`: implemented `DecodeRaw` and updated `Decode` to include post-decode validation using `fmt.Validator`. - Updated all test files: removed `JSON` field literals, updated expectations, and added validation tests in `tests/validation_test.go`. - Updated `README.md` to reflect new API and behavior. Co-authored-by: cdvelop <44058491+cdvelop@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
I have completed the Field v3 migration for the
tinywasm/jsonpackage.Key Changes:
parseJSONTaglogic. The library now usesfield.Namedirectly as the JSON key for both encoding and decoding.OmitEmptySupport: Replaced,omitemptystring tag parsing with the booleanfield.OmitEmptyproperty fromfmt.Field.Decodefunction now checks if the targetfmt.Fielderimplements thefmt.Validatorinterface and callsValidate()after parsing.DecodeRawAddition: IntroducedDecodeRawfor scenarios where post-decode validation should be skipped.README.mdto reflect the new behavior and API changes.DecodeRaw.All tests in the
tests/directory passed successfully.PR created automatically by Jules for task 9782617429973433732 started by @cdvelop