Skip to content

Commit

Permalink
[smithy-rs] Compile regexes for @pattern strings early (#2058)
Browse files Browse the repository at this point in the history
* Add docs for `compile_regex()`

* Try to pass `@pattern` string shapes to service visitor

* Add `compile_rege` calls

* Remove unwanted changes

* Fix python code generator

* Add hack for `@pattern` + `@enum` trait

* Generate tests for regexes

* Move some functionality to `TraitInfo`

* Add docs for `Symbol.testModule`

* Improve docs for `Symbol.testModule`

* Update codegen-server/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ConstrainedStringGenerator.kt

Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>

* Refactor `regex_compiles` test rendering

* Refactor `Symbol.testModule` -> `SymbolProvider.testModuleForShape`

* Use `RustWriter.unitTest` instead of manually annotating `#[test]`s

* Refactor `mapNotNull` -> `filter` + `map`

* Only render doc comment when there's `@pattern` strings

* Rename `String.toRustName` -> `´String.unsafeToRustName`

* Add kotlin test for pattern with lookahead

* Update `Attribute.Cfg` to new `Attribute.CfgTest`

* Prepend `@pattern` docs

* Fix test name

Co-authored-by: Luca Palmieri <20745048+LukeMathWalker@users.noreply.github.com>
  • Loading branch information
2 people authored and aws-sdk-rust-ci committed Jan 13, 2023
1 parent 9cdc0bc commit b9e5eb7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
24 changes: 12 additions & 12 deletions sdk/s3control/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1475,8 +1475,8 @@ impl DeleteAccessPointInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_access_point_name(self.name.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -2265,8 +2265,8 @@ impl DeleteBucketInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -2685,8 +2685,8 @@ impl DeleteBucketPolicyInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -5366,8 +5366,8 @@ impl GetAccessPointPolicyStatusInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_access_point_name(self.name.clone())
.set_account_id(self.account_id.clone())
.set_access_point_name(self.name.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -5765,8 +5765,8 @@ impl GetBucketInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -5970,8 +5970,8 @@ impl GetBucketLifecycleConfigurationInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -6181,8 +6181,8 @@ impl GetBucketPolicyInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -6388,8 +6388,8 @@ impl GetBucketTaggingInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -8319,8 +8319,8 @@ impl ListAccessPointsInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -9160,8 +9160,8 @@ impl ListRegionalBucketsInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_outpost_id(self.outpost_id.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -10481,8 +10481,8 @@ impl PutBucketPolicyInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down Expand Up @@ -10728,8 +10728,8 @@ impl PutBucketTaggingInput {
.set_use_fips(_config.use_fips)
.set_use_dual_stack(_config.use_dual_stack)
.set_requires_account_id(Some(true))
.set_account_id(self.account_id.clone())
.set_bucket(self.bucket.clone())
.set_account_id(self.account_id.clone())
.build()
.map_err(|err| {
aws_smithy_http::endpoint::ResolveEndpointError::from_source(
Expand Down
4 changes: 2 additions & 2 deletions versions.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
smithy_rs_revision = 'aaac83f9728202943ff1fe30f167626eaba62abc'
smithy_rs_revision = '76f0fa96da331268319a20a0fef3c1c9a17cb6be'
aws_doc_sdk_examples_revision = 'cf400c3d1eefb910869a961bc3c948e75386daa1'

[manual_interventions]
Expand Down Expand Up @@ -1663,7 +1663,7 @@ model_hash = '78eb7dd7acf02fc39b4ec540a7135fb1846a13888ccc292d1dc105b80b696757'
[crates.aws-sdk-s3control]
category = 'AwsSdk'
version = '0.23.0'
source_hash = '7dcc3c8dcdcb4f0bbbc727eb5a5a7a8146516ae34e0f48eeef446cb4a97beaad'
source_hash = 'ce598b2e2c79701b4d0d9445fef9af998381665f7a70f6b711eb541a97342b39'
model_hash = 'bd3252c3f5ee09b9431d77bd3dd985679bd3b94d7b61cb90727c63cbd0653833'

[crates.aws-sdk-s3outposts]
Expand Down

0 comments on commit b9e5eb7

Please sign in to comment.