Skip to content
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

Consistent variant encoding and decoding #74

Closed
davidyuk opened this issue Oct 25, 2021 · 5 comments · Fixed by #81
Closed

Consistent variant encoding and decoding #74

davidyuk opened this issue Oct 25, 2021 · 5 comments · Fixed by #81
Assignees

Comments

@davidyuk
Copy link
Member

I have noticed that encoder accepts variants as { variant: 'Year', values: [] }, but decodes as { Year: [] }, would be better to use one approach in both cases, but I'm not sure which one is better.

@marc0olo
Copy link
Contributor

@dincho what were your thoughts behind this, do you agree?

to be more explicit in this case I personally would probably favor { variant: 'Year', values: [] } as consistent representation

@davidyuk
Copy link
Member Author

Can we use FateVariant externally?
Like contractMethod('arg1', 'arg2', new FateVariant('name', value1, value2)).
In this case would be: contractMethod(new FateVariant('Year'))

@dincho
Copy link
Member

dincho commented Oct 29, 2021

I've to take a look and I'll get back with recommendation

@dincho
Copy link
Member

dincho commented Nov 2, 2021

Can we use FateVariant externally?

No, I've provided an alternative data constructors in the related PR.

@dincho
Copy link
Member

dincho commented Nov 2, 2021

to be more explicit in this case I personally would probably favor { variant: 'Year', values: [] } as consistent representation

I was first lean to it as well, however the concise version somehow made a bit more sense in terms of public API, because you don't need to carry keys and keep them backward compatible.

Also I think the SDK is already utilizing that structure?

Please see the related PR

@dincho dincho closed this as completed in #81 Nov 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants