-
-
Notifications
You must be signed in to change notification settings - Fork 191
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: preventing unmarshal on primitive types #2144
base: master
Are you sure you want to change the base?
fix: preventing unmarshal on primitive types #2144
Conversation
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.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
✅ Deploy Preview for modelina canceled.
|
if (obj[\\"primitiveArrayTest\\"] !== undefined) { | ||
instance.primitiveArrayTest = obj[\\"primitiveArrayTest\\"]; | ||
} |
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.
Here's evidence that the code doesn't try to call unmarshal anymore for the array of primitive items.
Quality Gate passedIssues Measures |
@@ -162,13 +175,16 @@ exports[`Marshalling preset should render un/marshal code 1`] = ` | |||
? null | |||
: obj[\\"arrayTest\\"].map((item: any) => NestedTest.unmarshal(item)); | |||
} |
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.
Here's evidence that for an array of objects, unmarshal is still called.
Description
There's currently a bug on 3.10.0 where calls to unmarshal are made on arrays of primitive type. Here's an example of the generated code:
This PR prevents the issue by adding new checks.
Related Issue
N/A
Checklist
npm run lint
).npm run test
).Additional Notes
By the way, noticed that version 4.0.0 doesn't include unmarshalling array items, and that might be an issue (at least for my use cases). Just letting you know so you can keep track of this, in case it's not expected.