Commit Graph

24 Commits

Author SHA1 Message Date
Russell Cohen a95b8b311b
Disable formatter (#3417)
## Motivation and Context
running codegen tests produces a diff you need to ignore

## 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._
2024-02-19 15:23:11 -05:00
Russell Cohen 8db8f4b0c1
Fix task dependency (#3420)
## Motivation and Context
Release build was broken because `smithy-build.json` was not being
generated prior to smithyBuild actually running.

## Description
Fix task names

## Testing
Manual patch of release tag with this fix.


----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2024-02-16 12:42:59 -08:00
John DiSanti ae52b69572
Upgrade Smithy Gradle Plugin to 0.9 (#3394)
_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2024-02-07 22:18:49 +00:00
Miles Ziemer 345624eb6c
Ignore actual default value instead of 0/false (#3252)
## 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 -->
Previously, there was logic used to ignore the default 0/false values
for numbers/booleans when serializing members if they weren't boxed.
This was to fix issues that occured when upstream models didn't properly
box shapes that were meant to be optional, and for the most part worked
because services would just fill in the default if it wasn't passed.
However, with Smithy 2.0, models may have defaults != 0/false, but the
codegenerator still ignores the zero value.

## Description
<!--- Describe your changes in detail -->
This commit makes it so that the actual default value for the member is
ignored for booleans and numbers, instead of just 0/false. It also
updates serialization for http bindings so that headers and query
parameters with 0/false values aren't ignored if they are optional
parameters.

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
- [x] Generated AWS SDK and inspected diff. Only changes are not
ignoring default value inside `if let Some() = ...` blocks, and ignoring
default value instead of just 0 (only seems to effect nimble).
- [x] Added protocol tests for serializing 0/false in query params for
restXml and restJson

## 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._

---------

Co-authored-by: John DiSanti <john@vinylsquid.com>
2023-12-15 16:37:36 +00:00
Zelda Hessler 48d1c559b8
Gradle deprecation warning fixes (#3242)
Fix deprecation warnings in the gradle build scripts, and upgrade jsoup
and gson.

----

_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: ysaito1001 <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
2023-12-06 14:05:21 -08:00
Russell Cohen f63980cda3
Fix AwsQuery target serialization (#3210)
## Motivation and Context
- aws-sdk-rust#957

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-11-16 15:50:53 +00:00
Russell Cohen 307f0ed112
Upgrade Smithy to 1.40 and ignore __type in unions (#3081)
## Motivation and Context
> JSON object. A union is serialized identically as a ``structure``
        shape, but only a single member can be set to a non-null value.
Deserializers MUST ignore an unrecognized ``__type`` member if present.


[source](https://github.com/smithy-lang/smithy/blob/main/docs/source-2.0/aws/protocols/aws-json.rst.template#L133-L135)

## Description
- upgrade to smithy 1.40
- unignore protocol tests
- fix JSON deserializers
## Testing
- protocol tests + extra unit tests

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-10-19 14:15:25 +00:00
Russell Cohen 3c11815e5e
Merge 0.56.x back into main (#3003)
## 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 -->

## Description
<!--- Describe your changes in detail -->

## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->

## 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: ysaito1001 <awsaito@amazon.com>
Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: kstich <kevin@kstich.com>
2023-09-28 13:20:04 +00:00
Zelda Hessler 1331dc5443
add support for nullable struct members when generating AWS SDKs (#2916)
## 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 -->
smithy-rs#1767 aws-sdk-rust#536

## Description
<!--- Describe your changes in detail -->
This PR adds support for nullability i.e. much less unwraps will be
required when using the AWS SDK. For generic clients, this new behavior
can be enabled in codegen by setting `nullabilityCheckMode: "Client"` in
their codegen config:
```
      "plugins": {
        "rust-client-codegen": {
          "codegen": {
            "includeFluentClient": false,
            "nullabilityCheckMode": "CLIENT_CAREFUL"
          },
     }
```


## Testing
<!--- Please describe in detail how you tested your changes -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Ran existing tests

## 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._

---------

Co-authored-by: John DiSanti <jdisanti@amazon.com>
Co-authored-by: Russell Cohen <rcoh@amazon.com>
2023-09-21 17:20:51 +00:00
John DiSanti c98d5febac
Fix codegen for unions with the `@httpPayload` trait (#2969)
This PR incorporates the new test cases in Smithy from
https://github.com/smithy-lang/smithy/pull/1908, and adds support to
`@restXml` and `@restJson1` for unions with the `@httpPayload` trait.
This resolves https://github.com/awslabs/smithy-rs/issues/1896.

This also fixes code generation for the latest `medicalimaging` SDK
model.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-31 16:43:02 +00:00
John DiSanti 89802592b0
Remove middleware - part 1 (#2920)
This PR removes the runtime mode flag, test compile flags, and CI checks
for client middleware.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-08-16 19:57:16 +00:00
John DiSanti 25abe5a842
Change the default runtime mode to orchestrator (#2847)
This PR changes the default runtime mode to orchestrator for generated
clients and the AWS SDK.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-07-20 15:49:53 +00:00
John DiSanti c1a1daeee0
Split runtime components out of config in the orchestrator impl (#2832)
This PR moves all the "runtime components", pieces that are core to the
operation of the orchestrator, into a separate `RuntimeComponents` type
for the orchestrator to reference directly.

The reason for this is so that these core components cannot be changed
by interceptors while the orchestrator is executing a request.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-07-12 16:59:54 -07:00
John DiSanti c8ba2d5b80
Fix auth failures in codegen-client-tests in orchestrator mode (#2812)
## Motivation and Context
In orchestrator mode, most `codegen-client-test` tests were failing due
to being unable to find a matching auth scheme, or due to some of the
test models referencing the `@sigv4` trait. This PR fixes all of those
failures, and adds the `smithy.runtime.mode` flag to
`codegen-client-test` as well.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
2023-06-28 17:08:00 +00:00
Burak 31c152d9af
Unify Pokemon model for Rust and Python servers (#2700)
## Motivation and Context
Now we have the feature parity between Rust and Python servers (at least
for the Pokémon service's needs) we can use the same model in both.
Closes https://github.com/awslabs/smithy-rs/issues/1508

## Testing
```bash
$ cd smithy-rs/examples
$ make test # test Rust servers
$ cd python
$ make test # test Python servers
```

## 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._
2023-05-17 10:51:00 +00:00
Harry Barber 9ecd7f0a30
Fix consistent service naming and add test coverage (#2349)
* Make service name casing consistent

* Add naming-obstacle-course-casing.smithy

* Add missing import

* Relax obstacle course even further

* Better TODO

* Add CHANGELOG.next.toml
2023-02-13 18:25:56 +00:00
82marbag 93f4c4f054
Enable streaming support for AwsJson (#2207)
* Enable streaming support for AwsJson

Signed-off-by: Daniele Ahmed <ahmeddan@amazon.de>
2023-01-17 14:26:50 +00:00
Russell Cohen 29abdc9b42
Enable Endpoints 2.0 (#2074)
* wip

* Fix region decorator

* Update S3 tests to succeed

* Create 'endpoint_url' setters

* Fix SDK adhoc tests

* Fix endpoint tests

* Fix protocol test generator to have a stub endpoint resolver

* Fix some more tests

* Fix aws rust runtime tests

* Update generator to appease clippy

* CR feedback

* Fix compilation

* Fix tests

* Fix doc links

* Fix SDK integration tests

* Update changelog

* Fix s3 control by adding transformer

* Throw a specific exception if the service doesn't have ep rules

* Add codecatalyst to the list of custom services
2022-12-16 12:56:16 -05:00
John DiSanti 5970ef7725
Break up `RustCodegenDecorator` (#2099)
This change creates `ClientCodegenDecorator` and
`ServerCodegenDecorator` in `codegen-client` and `codegen-server`
respectively to replace `RustCodegenDecorator`. Client/server
equivalents are created to replace `CombinedCodegenDecorator` as well.

This eliminates the need for the `supportsCodegenContext` method since
the decorator interface is no longer generic, so the `ServiceLoader` is
now powerful enough to differentiate.

The largest benefit, however, is that now clients and servers can have
separate customizations.
2022-12-14 13:26:55 -08:00
Zelda Hessler 445b7fea1e
fix: use idiomatic method of setting smithy gradle plugin version (#1995) 2022-11-16 21:58:04 +00:00
Russell Cohen 7ab8f56d2d
Add support for Endpoints 2.0 Parameters (#1953)
* Add support for Endpoints 2.0 Parameters

This commit adds `EndpointDecorator` which injects Endpoint
parameters in to the operation property bag. These can come from
an ordered list of sources—this wires them all up. To facilitate
testing, this diff also writes the parameters into the property
bag during operation generation.

* remove println

* CR Feedback
2022-11-16 17:07:36 +00:00
david-perez aa60badfe8
Correctly serialize `String`s in XML (#1832)
The logic that keeps track of whether we're working with a borrowed or
an owned value is flawed. It just so happened to work when requesting
owned values from borrowed values because we called `autoDeref` before
creating the value expression. That logic should instead be used
_within_ `ValueExpression` to appease Clippy there too.

Fixes #1831.
2022-10-13 11:51:10 +00:00
Harry Barber 9405f00014
Cleanup pokemon.smithy (#1763)
* Remove Operation suffix

* Remove reuse of @output

* Add full-stops

* Rename to {Verb}{Qualifier}{Noun}

* Symlink pokemon operations

Co-authored-by: Matteo Bigoi <1781140+crisidev@users.noreply.github.com>
2022-09-23 17:37:32 +00:00
John DiSanti 96e9f61fee
Establish the `codegen-core` module (#1697)
* 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`
2022-09-07 09:31:46 -07:00