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

Fix byte-array JSValue conversions #220

Merged
merged 1 commit into from
Mar 11, 2024
Merged

Conversation

jasongin
Copy link
Member

@jasongin jasongin commented Mar 9, 2024

Fixes: #206

A .NET API that has a byte[] (in a property type, parameter type, or return type) should get projected as JS number[] type, not a JS string type. This change removes the conversion operators between byte[] and string-type JSValue. Since code-generation for type conversions makes use of those operators, removing those conversions achieves the desired effect of keeping the array form of the type.

In some scenarios it might actually be desirable to marshal .NET byte[] as JS string. So, it could be helpful then if there was a way for the application to control that behavior (related to #64). But I believe number[] is the most correct default.

There were a few places in test code that were relying on the implicit conversion from byte[] to JSValue; I replaced those with explicit conversions.

@jasongin jasongin merged commit 2f53044 into main Mar 11, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

byte[] from .NET becomes string in Node
2 participants