Add AWS QUERY protocol support#663
Add AWS QUERY protocol support#663arandito merged 5 commits intosmithy-lang:feat/add-query-protocolfrom
Conversation
b4369c1 to
b9a4a2c
Compare
codegen/core/src/main/java/software/amazon/smithy/python/codegen/HttpProtocolTestGenerator.java
Outdated
Show resolved
Hide resolved
| Trait.new(id=ShapeID("smithy.api#error"), value="client"), | ||
| Trait.new( | ||
| id=ShapeID("aws.protocols#awsQueryError"), | ||
| value={"code": "InvalidAction"}, |
There was a problem hiding this comment.
How are we able to make this without httpResponseCode which should be required? Also not something we need to solve now. But I think this might affect all other traits and we should look into it as a separate task.
There was a problem hiding this comment.
It's most likely because the base Trait class doesn't invoke the trait's __post_init__ to actual call the assertions for required members.
I will create an issue/backlog item to get this addressed. I updated the test to include httpResponseCode in the meantime.
| f"Unable to parse discriminator for {self.shape_type} document." | ||
| if _HAS_JSON: | ||
|
|
||
| class AWSJSONDocument(JSONDocument): |
There was a problem hiding this comment.
I'm not a fan of this conditional class definition but I don't think it's a blocking comment.
For a follow-up, I’d move AWSJSONDocument into a small JSON-specific module and import it alongside JSONCodec at the optional-dependency boundary. That would keep the same behavior while making the structure cleaner.
There was a problem hiding this comment.
I'm not of fan either. We definitely need to centralize how we guard against optional dependencies in general. I had to repeat the same xml conditional logic for _private.query.errors to get around the optional smithy-xml import.
I took some time to see the effort required but it does extend to the smithy-http package with our optional dependencies on crt and aiohttp. This is definitely a larger effort that fell out of the scope of this PR.
Something we should address before add CBOR support.
3084914
into
smithy-lang:feat/add-query-protocol
* smithy-aws-core: add support for awsQuery protocol * codegen: generate AwsQueryClientProtocol for awsQuery services and generate protocol tests
Description
This PR adds
awsQuerysupport: a new protocol generator and protocol-test projection, plussmithy-aws-coreruntime client protocol support with URL form-encoded request serialization and modeledawsQueryErrorhandling forawsQueryservices.It also includes supporting infrastructure changes: generated operation error schema registration, SigV4 protocol-test config for AWS protocol tests, and shared protocol-test handling for
application/x-www-form-urlencodedbodies.Note
This PR includes a couple changes that are directly ported from the currently open AWS JSON protocol PR #645. This PR will be rebased once the other is merged.
Testing
All supported protocol tests are passing. Tests in the explicit skip list remain skipped because they cover features that are not yet supported.
I was also able to generate a client for AWS STS from its Smithy service model and make a successful call:
STS test script
Output
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.