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

Parse timestamps strictly #412

Merged
merged 1 commit into from
Sep 7, 2021

Conversation

adamthom-amzn
Copy link
Contributor

Description of changes:
Timestamp formats are modeled, and instead of relying on the JavaScript Date
constructor's undefined behavior to support all three styles of timestamp,
we use a specific strict parsing method based on the modeled type to ensure
that we are only accepting timestamps in the correct format.

DocumentMemberDeserVisitor did not have a reference to the member being
deserialized, so it could not discover traits that were applied to the member
(such as @timestampFormat). It also needed to know whether epoch
timestamps are allowed to be strings, which is protocol-specific.

This relies on aws/aws-sdk-js-v3#2737 and there will be a follow-up PR for SDK-specific generation changes.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Timestamp formats are modeled, and instead of relying on the JavaScript Date
constructor's undefined behavior to support all three styles of timestamp,
we use a specific strict parsing method based on the modeled type to ensure
that we are only accepting timestamps in the correct format.

DocumentMemberDeserVisitor did not have a reference to the member being
deserialized, so it could not discover traits that were applied to the member
(such as @timestampFormat). It also needed to know whether epoch
timestamps are allowed to be strings, which is protocol-specific.
@adamthom-amzn adamthom-amzn requested review from JordonPhillips, gosar and a team September 1, 2021 20:30
@adamthom-amzn adamthom-amzn merged commit 885fec0 into smithy-lang:main Sep 7, 2021
@adamthom-amzn adamthom-amzn deleted the strict-date-parsing branch September 7, 2021 16:51
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.

3 participants