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

Initial implementation of @httpMalformedRequestTests #871

Merged
merged 2 commits into from
Aug 3, 2021

Conversation

adamthom-amzn
Copy link
Contributor

Description of changes:
Sets up the trait and serialization/deserialization of all of its members. This
trait allows server implementations to generate tests that reject invalid
requests before those requests are bound to a Smithy-generated implementation
class, or before the deserialized request is handed off to application code.

I'm going to keep this in draft mode for feedback while I work on generating tests from it to make sure this is actually useful.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@adamthom-amzn adamthom-amzn marked this pull request as ready for review July 28, 2021 21:01
adamthom-amzn added a commit to adamthom-amzn/smithy-typescript that referenced this pull request Jul 28, 2021
@httpMalformedRequestTests allow server implementations to generate tests
that exercise how the implementation deals with requests that are rejected
before they reach the customer's business logic. See
smithy-lang/smithy#871 for more information.
headers: {"X-Foo": "baz"},
body: """
{
"message" : "Invalid JSON"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the same test as above but checking body v/s bodyMessageRegex? The regex has ": .*" but it doesn't here...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can either specify body (exact match) or a regex for the message. this test is simply "can we deserialize all of these fields"

adamthom-amzn added a commit to adamthom-amzn/smithy-typescript that referenced this pull request Jul 29, 2021
@httpMalformedRequestTests allow server implementations to generate tests
that exercise how the implementation deals with requests that are rejected
before they reach the customer's business logic. See
smithy-lang/smithy#871 for more information.
@adamthom-amzn adamthom-amzn force-pushed the malformed-requests branch 2 times, most recently from 988b1e8 to 7f0abec Compare July 29, 2021 18:57
@adamthom-amzn adamthom-amzn requested a review from gosar July 29, 2021 18:58
@adamthom-amzn adamthom-amzn force-pushed the malformed-requests branch 2 times, most recently from ae17dbe to 23e58ec Compare August 2, 2021 20:08
Sets up the trait and serialization/deserialization of all of its members. This
trait allows server implementations to generate tests that reject invalid
requests before those requests are bound to a Smithy-generated implementation
class, or before the deserialized request is handed off to application code.
@adamthom-amzn adamthom-amzn merged commit bdc32a2 into smithy-lang:main Aug 3, 2021
trivikr pushed a commit to smithy-lang/smithy-typescript that referenced this pull request Aug 5, 2021
@httpMalformedRequestTests allow server implementations to generate tests
that exercise how the implementation deals with requests that are rejected
before they reach the customer's business logic. See
smithy-lang/smithy#871 for more information.
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
@httpMalformedRequestTests allow server implementations to generate tests
that exercise how the implementation deals with requests that are rejected
before they reach the customer's business logic. See
smithy-lang/smithy#871 for more information.
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.

4 participants