-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: implement encoding.Unmarshal #975
Conversation
e7d8bf8
to
8606043
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start, but this needs some tests.
v = v.Elem() | ||
fallthrough | ||
|
||
case t.Implements(jsonUnmarshaler): | ||
case t.Implements(jsonMarshaler): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch 🤦♂️
go-runtime/encoding/encoding.go
Outdated
if _, ok := jsonData[jsonKey]; ok { | ||
fieldTypeStr := fieldType.Type.String() | ||
switch { | ||
case fieldTypeStr == "*Unit" || fieldTypeStr == "Unit": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a direct comparison with reflect.TypeOf(ftl.Unit{})
et al?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this introduces a dependency cycle because ftl
depends on encoding (it's used in option.go
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to use the streaming JSON decoder?
6af7298
to
6a2bfec
Compare
6a2bfec
to
8a7617c
Compare
good idea! updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
8a7617c
to
e83e33b
Compare
fixes #971
fixes #951