generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix several go-runtime JSON encoding issues (#1417)
This PR: * Rips out the existing textMarshaler and jsonMarshaler usage from encoding.go. We may want to add those back for #1296 down the road, but we will need to be thoughtful about how we do that. Removing it for now keeps the logic much more predictable. * Moves the (un)marshaling logic for `ftl.Option` out of `option.go` and into `encoding.go`. * Special-cases both `time.Time` (the only stdlib type we currently support) and `ftl.Option`. Also `json.RawMessage` for _just_ encoding to preserve the existing `omitempty` behavior. * Fixes some existing issues where the Pointer unmarshaling wasn't actually working correctly * [eww] Adds a rather grotesque alternative to `Peek()` in `isNextTokenNull()` because json Decoder does not support Peek. * [eww] Makes the ftl.Option struct fields public so that they are settable by `encoding.go`. Suggestions welcome for both counts of [eww] above :) Fixes #1247. Addresses most of #1262, except `omitempty` is only working for json.RawMessage for now.
- Loading branch information
Showing
4 changed files
with
152 additions
and
137 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.