-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
try-to-fix-the-non-required-default-value #26920
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,28 @@ describe("Serializer", function () { | |
assert.deepEqual(serialized, expected); | ||
}); | ||
|
||
it.only("should not set default value for non-required properties", function () { | ||
const expected = { | ||
id: 1, | ||
name: "testProduct", | ||
details: { | ||
max_product_capacity: "Large", | ||
}, | ||
}; | ||
|
||
const serialized = Serializer.serialize( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need a deserialize test rather than a serialize one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for pointing it out :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It took me a little bit to notice as well 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I found if I change the serialize into deserialize and revert all the other changes back, the test will fail, it seems like we have some issues when handling flatten? Sorry I haven't get time to look into the details yet. |
||
Mappers.SimpleProduct, | ||
{ | ||
id: 1, | ||
name: "testProduct", | ||
}, | ||
"SimpleProduct" | ||
); | ||
|
||
assert.deepEqual(serialized, expected); | ||
assert.deepEqual(serialized.details.max_product_display_name, undefined); | ||
}); | ||
|
||
it("should correctly serialize a string if the type is 'any'", function () { | ||
const mapper: Mapper = { | ||
type: { name: "any" }, | ||
|
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.
I feel like this is a pretty big change in runtime behavior. To ensure we didn't break we'd have to audit every use of
defaultValue
in a mapper for all SDKs we've shipped.