-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
RustReservedWordsSymbolProvider
configurable
- Loading branch information
Showing
9 changed files
with
203 additions
and
37 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
.../src/main/kotlin/software/amazon/smithy/rust/codegen/client/smithy/ClientReservedWords.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.client.smithy | ||
|
||
import software.amazon.smithy.rust.codegen.core.rustlang.RustReservedWordConfig | ||
import software.amazon.smithy.rust.codegen.core.smithy.generators.UnionGenerator | ||
|
||
val ClientReservedWords = RustReservedWordConfig( | ||
structMemberMap = mapOf( | ||
"build" to "build_value", | ||
"builder" to "builder_value", | ||
"default" to "default_value", | ||
"send" to "send_value", | ||
// To avoid conflicts with the `make_operation` and `presigned` functions on generated inputs | ||
"make_operation" to "make_operation_value", | ||
"presigned" to "presigned_value", | ||
"customize" to "customize_value", | ||
// To avoid conflicts with the error metadata `meta` field | ||
"meta" to "meta_value", | ||
), | ||
unionMemberMap = mapOf( | ||
// Unions contain an `Unknown` variant. This exists to support parsing data returned from the server | ||
// that represent union variants that have been added since this SDK was generated. | ||
UnionGenerator.UnknownVariantName to "${UnionGenerator.UnknownVariantName}Value", | ||
"${UnionGenerator.UnknownVariantName}Value" to "${UnionGenerator.UnknownVariantName}Value_", | ||
), | ||
enumMemberMap = mapOf( | ||
// Unknown is used as the name of the variant containing unexpected values | ||
"Unknown" to "UnknownValue", | ||
// Real models won't end in `_` so it's safe to stop here | ||
"UnknownValue" to "UnknownValue_", | ||
), | ||
) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
18 changes: 18 additions & 0 deletions
18
.../src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerReservedWords.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package software.amazon.smithy.rust.codegen.server.smithy | ||
|
||
import software.amazon.smithy.rust.codegen.core.rustlang.RustReservedWordConfig | ||
|
||
val ServerReservedWords = RustReservedWordConfig( | ||
structMemberMap = mapOf( | ||
"build" to "build_value", | ||
"builder" to "builder_value", | ||
"default" to "default_value", | ||
), | ||
unionMemberMap = emptyMap(), | ||
enumMemberMap = emptyMap(), | ||
) |