You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.
that 90% of the time we would want displayed as an IP address string.
Ideally, there would be a way to read from a thrift buffer then convert ( optionally ) to a formatted JS object. Also, it would be great to define the inverse as well; go from a formatted field to the raw type definition.
Something similar could be supported with an annotation like (js.type = 'ipv4-string') with the implication that the type would be able to coerce strings containing ipv4 addresses when encoding, and prefer the string representation when decoding. Alternately there could be a (js.type = 'AddressObject') that would do the same for an AddressObject type that would resemble your {host,port} representation. The pattern exists for i64 alternate representations. On the wire, i32 would always be a four byte signed number, but you can use the annotation to control the code representation.
In general though, it would be preferable I think to perform the conversion in your handler.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello thriftrw!
I was curious if there was a way to apply formatting to a particular typedef or field definition globally?
For example, if we have a thrift typedef:
that 90% of the time we would want displayed as an IP address string.
Ideally, there would be a way to read from a thrift buffer then convert ( optionally ) to a formatted JS object. Also, it would be great to define the inverse as well; go from a formatted field to the raw type definition.
If this is something that doesn't exist I'd be very interested in contributing. Thanks!
The text was updated successfully, but these errors were encountered: