## Motivation and Context
Customers want to be able to use `serde` with Smithy models. For
details, see the
[RFC](https://github.com/smithy-lang/smithy-rs/blob/configurable-serde/design/src/rfcs/rfc0045_configurable_serde.md)
## Description
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
Implementation of `serde::Serialize` for smithy-rs code generators. This
takes the approach of a trait, `SerializeConfigured` which _returns_ a
type that implements `Serialize`. This allows customers to control serde
behavior for their use case.
```rust
/// Trait that allows configuring serialization
/// **This trait should not be implemented directly!** Instead, `impl Serialize for ConfigurableSerdeRef<T>`**
pub trait SerializeConfigured {
/// Return a `Serialize` implementation for this object that owns the object. This is what you want
/// If you need to pass something that `impl`s serialize elsewhere.
fn serialize_owned(self, settings: SerializationSettings) -> impl Serialize;
/// Return a `Serialize` implementation for this object that borrows from the given object
fn serialize_ref<'a>(&'a self, settings: &'a SerializationSettings) -> impl Serialize + 'a;
}
```
This can be used as follows:
```rust
serde_json::to_string(&my_struct.serialize_ref(&SerializationSettings::redact_sensitive_fields());
```
Currently, this codegen plugin is not used by anything. It can be
enabled by bringing it in scope during code generation & adding the
`@serde` trait to the model for the fields where serialization is
desired. This will allow the SDK (if they choose to) roll it out only
for specific types or services that have customer demand.
There are a number of follow on items required:
- [x] Ensure the generated impls work for `Server` codegen
- [ ] Generate `Deserialize` implementations
- [x] Test the implementation all Smithy protocol test models (ensure it
compiles)
## Testing
Unit test testing serialization with a kitchen-sink model
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
---------
Co-authored-by: david-perez <d@vidp.dev>
## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here -->
When a `@contextParam` is marked as required, we will enforce it on
inputs. Since these fields may influence endpoint, omitting them can
result in a different target being hit.
- #1668
- aws-sdk-rust#873
## Description
<!--- Describe your changes in detail -->
## Testing
- [x] S3 Integration test
## Checklist
<!--- If a checkbox below is not applicable, then please DELETE it
rather than leaving it unchecked -->
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the
smithy-rs codegen or runtime crates
- [x] I have updated `CHANGELOG.next.toml` if I made changes to the AWS
SDK, generated SDK code, or SDK runtime crates
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
This PR merges the benchmark and integration tests from `aws/sra-test`
into the SDK integration tests, and updates the tests so that they
compile and pass.
----
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
* A barely working code generation in typescript
* Extract shared socket into feature inside aws-smithy-http-server
* Building a fully functional application, I think
* Add NAPI build.rs
* Refactor all names to use typescript instead of js
* Add (hopefully) the PR bot for TS
* Clippy fixes
* Fix documentation
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* set_reuse_port in socket not on windows
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Add example implementation
* Allow the new application to build
* Remove all occurrences of Python
* Simplify README
* Fix issue with the codegen-diff-revision script
* Try to prevent the ci-lint to bother us with TODO at this stage of development
* Remove codegen-client from typescript dependencies
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Add CODEOWNERS and fix some other linting issues
* Add license
* Prevent from running tests on typescript in Windows
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Initial work to remove error from this PR
* Update to call_async
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* types/node in package.json
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Generate app.ts
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
* Improve makefile
* Adapting code to the latest changes and removing runtime dependency (for now).
* Removing rust-runtime/aws-smithy-http-server-typescript.
* Making CI happy.
* Restoring ServerCodegenDecorator to be like main.
* Adding back the aws-smithy-http-server-typescript crate back.
* Removing index.js file.
---------
Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
Co-authored-by: 82marbag <69267416+82marbag@users.noreply.github.com>
Co-authored-by: Alberto Pose <albepose@amazon.com>
* Convert interceptor fns to macro invocations
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Add unmodeled error to ServiceError and bring in EventLog
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Simplify and test `EventLog`
* Attempt to integrate the event log with the orchestrator
* fix: error type in integration test
update: retry handling in orchestrator
* update: set the runtime plugins to do nothing instead of panic when called on
* Introduce a construct for type erasure
* Eliminate several generics and add phased error handling
* Code generate the `ResponseDeserializer` trait impls
* CI fixes
* Reorganize the new runtime crates
* Create the `Identity` type
* Reorganize orchestrator traits and accessors
* Set up code generated test environment for the new runtime
* Add initial auth orchestration implementation
* Fix clippy lint
* Incorporate feedback
* Fix external types lint
---------
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
* Create the `codegen-core` module
* Move the `Version` class into `codegen-core`
* Rename `codegen` to `codegen-client`
* Rename `codegen-test` to `codegen-client-test`
* Move shared test models to common location
* Fix Smithy validation errors in `misc.smithy`
* Fix `aws:sdk-codegen-test` build
* Add config for SDK endpoint/readme generation
* Rename `sdk-codegen-test` to `sdk-adhoc-test` and update README
* Add `sdk-adhoc-tests` to CI
* Refactor CI scripts
The `check-rust-runtime-and-tools` script was getting beyond 20
minutes to run, so this commit splits it into `check-aws-config`,
`check-rust-runtimes`, and `check-tools`.
This also enables most of the checks to run before the smoke test SDK is
generated, which should deliver more immediate feedback on PRs.
* Give the canary its own CI step
* Upgrade to Smithy 1.16.2
* Remove extra test fixed in Smithy 1.16.2
* Upgrade to Smithy 1.16.3
* Remove extra test fixed in Smithy 1.16.3
* Remove failing expectation from server tests
* Upgrade to Smithy 1.17.0
* Upgrade to Smithy 1.18.1
* Upgrade to Smithy 1.19.0
* Upgrade to Smithy 1.21.0
* Update changelog
* Fix Gradle repositories
* Initial implementation of RestJson and Http ser/de
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Visitor render operation shapes from server generators
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Use a symlink for the ebs test model
* Revert "Use a symlink for the ebs test model"
This reverts commit 0c2adcbf12.
* Now the model is emitted in different files
* A little more general model generation
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Use a very simple model to try the service generators
* Move serializer in its own folder
* Initial implementation of RestJson and Http ser/de
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Visitor render operation shapes from server generators
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Use a symlink for the ebs test model
* Revert "Use a symlink for the ebs test model"
This reverts commit 0c2adcbf12.
* Now the model is emitted in different files
* A little more general model generation
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Use a very simple model to try the service generators
* Move serializer in its own folder
* Refactor RestJson to accomodate upstream changes
* Refactor a little RestJson1 and add simple RFC doc
* Remove inheritance from Json ser/de and refactor codegen visitor to
directly use the rendering functions
* Make operation.rs module public
* Use the protocol ID instead of its string representation
Signed-off-by: Bigo <1781140+crisidev@users.noreply.github.com>
* Remove jcenter / bintray from gradle
Our build was referencing the old bintray repositories. This would 403 and make the build much slower as at retried 5 times against the broken URL.
* Update CHANGELOG.md
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
* Add customization for S3 host ID
* Cleanup and fully replace the s3 protocol
* Only generate the customization for S3
* Fix bugs which caused rustfmt to crash
* Add test
* Back out unused change
* Update aws/sdk/integration-tests/s3/Cargo.toml
* CR feedback, add missing test