-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(sfn): can't override toStateJson() from other languages #24593
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.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
If any part of a state's JSON representation is `null`, that value will be replaced by `undefined` when jsii sends data to the other language, resulting in a change of semantics. Multi-language APIs cannot differentiate between `null` and `undefined` as non-JS languages typically fail to distinguish between them... In order to address that, a `JsonNull` value was added which serializes to `null` (via Javascript's standard `toJSON` method), which must be used in such cases where `null` may need to cross the language boundary. The `JsonPath.DISCARD` value is now a string-token representation of the `JsonNull` instance. Fixes #14639
521e154
to
10f168e
Compare
✅ Updated pull request passes all PRLinter validations. Dissmissing previous PRLinter review.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
@@ -579,7 +580,7 @@ export function renderJsonPath(jsonPath?: string): undefined | null | string { | |||
if (jsonPath === undefined) { return undefined; } | |||
if (jsonPath === JsonPath.DISCARD) { return null; } |
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 think this line might still need to be updated for this to work properly. Even though JsonPath.DISCARD
has been updated to a JsonNull token, this line will still evaluate truthy and return null, which in other languages like Python would translate to undefined
. Perhaps this should return a JsonNull token as well?
Follow-up to #24593. The `renderJsonPath` function is subsituting a literal `null` for `JsonPath.DISCARD`, which results in the key being dropped if the value is sent across a language boundary, which effectively changes semantics. The `JsonPath.DISCARD` value is a `Token` that ultimately resolves to `null`, and it must be preserved as such so that it is safe to exchange across languages. Thanks to @beck3905 for reporting & diagnosing this.
Follow-up to #24593. The `renderJsonPath` function is subsituting a literal `null` for `JsonPath.DISCARD`, which results in the key being dropped if the value is sent across a language boundary, which effectively changes semantics. The `JsonPath.DISCARD` value is a `Token` that ultimately resolves to `null`, and it must be preserved as such so that it is safe to exchange across languages. Thanks to @beck3905 for reporting & diagnosing this. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
If any part of a state's JSON representation is `null`, that value will be replaced by `undefined` when jsii sends data to the other language, resulting in a change of semantics. Multi-language APIs cannot differentiate between `null` and `undefined` as non-JS languages typically fail to distinguish between them... In order to address that, a `JsonNull` value was added which serializes to `null` (via Javascript's standard `toJSON` method), which must be used in such cases where `null` may need to cross the language boundary. The `JsonPath.DISCARD` value is now a string-token representation of the `JsonNull` instance. Fixes aws#14639 Fixes aws/jsii#3999 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Follow-up to aws#24593. The `renderJsonPath` function is subsituting a literal `null` for `JsonPath.DISCARD`, which results in the key being dropped if the value is sent across a language boundary, which effectively changes semantics. The `JsonPath.DISCARD` value is a `Token` that ultimately resolves to `null`, and it must be preserved as such so that it is safe to exchange across languages. Thanks to @beck3905 for reporting & diagnosing this. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
If any part of a state's JSON representation is
null
, that value will be replaced byundefined
when jsii sends data to the other language, resulting in a change of semantics.Multi-language APIs cannot differentiate between
null
andundefined
as non-JS languages typically fail to distinguish between them... In order to address that, aJsonNull
value was added which serializes tonull
(via Javascript's standardtoJSON
method), which must be used in such cases wherenull
may need to cross the language boundary.The
JsonPath.DISCARD
value is now a string-token representation of theJsonNull
instance.Fixes #14639
Fixes aws/jsii#3999
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license