-
Notifications
You must be signed in to change notification settings - Fork 105
Add basic support for server serde in http binding protocols #270
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1ac9603
to
6f42b3b
Compare
...ript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/TypeScriptSettings.java
Outdated
Show resolved
Hide resolved
This commit updates the request body comparison generation for protocol tests to safely handle having multiple bodyMediaType settings in the same suite of protocol tests. It also updates the methodology for comparing blob bodies to not be a special case in the generator, as they can have alternate media types.
e14875c
to
4788184
Compare
This adds the ability to disable generating clients. This is useful if the customer only wants to generate types for shapes, and will enable generating a server only.
This adds methods to the ProtocolGenerator interface to enable generating serializers for responses and deserializers for requests. Making these separate methods allows the CodegenVisitor to make sure everything that needs to get called gets called.
This adds support for error serialization. A new interface was needed to write error headers specifically. This also fixes an issue where the response serializers were looking at the wrong http bindings.
HttpRequest implements Endpoint, it does not contain one as a member.
I don't think response serialization will need to know about the endpoint, but I'm keeping the serializer context around in case it is useful in the future.
51dac4c
to
5621fd0
Compare
These might not actually work as-is, this will need to be verified. In the meantime it at leasts unblocks generation.
The serde functions were not being exported, and their names were aggressively protocol-specific. This re-exports the protocol-specific serde module under its own name, so that the functions themselves do not have to have the protocol name.
This adds an empty enpoint to response serialization. It should never be used, hopefully. It may be better to replace this with as assertions later on.
adamthom-amzn
suggested changes
Feb 26, 2021
...java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java
Outdated
Show resolved
Hide resolved
This updates the path parsing regex to differentiate between greedy and non-greedy labels as well as to disallow empty label segments.
adamthom-amzn
approved these changes
Mar 1, 2021
srchase
pushed a commit
that referenced
this pull request
Mar 23, 2023
srchase
pushed a commit
that referenced
this pull request
Jun 16, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes:
This adds basic support for server serde in http binding protocols, which is to say it adds support for serializing responses and deserializing requests. Currently there are a few major points missing:
No deserialization support for members bound to the pathNo deserialization support for members bound to the query stringNo deserialization support for members bound to the endpoint@adamthom-amzn
@gosar
This adds two new options to
TypeScriptSettings
which is what thesmithy-build.json
config is mapped to:generateClient
- boolean - default true - triggers client generationgenerateServerSdk
- boolean - default false - triggers ssdk generationSo to do server only you might have something like:
This also adds in deser support for the various uri bindings. Here's an example generated deser function:
Also note that this pr is merging into the ssdk branch and not main
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.