-
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.
…870) For clear separation of concerns.
- Loading branch information
1 parent
0bc5523
commit 1ee7d65
Showing
7 changed files
with
51 additions
and
16 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...rc/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerCargoDependency.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,19 @@ | ||
/* | ||
* 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.rustlang.CargoDependency | ||
import software.amazon.smithy.rust.codegen.rustlang.CratesIo | ||
|
||
/** | ||
* Object used *exclusively* in the runtime of the server, for separation concerns. | ||
* Analogous to the companion object in [CargoDependency]; see its documentation for details. | ||
* For a dependency that is used in the client, or in both the client and the server, use [CargoDependency] directly. | ||
*/ | ||
object ServerCargoDependency { | ||
val Axum: CargoDependency = CargoDependency("axum", CratesIo("0.3")) | ||
// TODO Remove this dependency https://github.com/awslabs/smithy-rs/issues/864 | ||
val DeriveBuilder = CargoDependency("derive_builder", CratesIo("0.10")) | ||
} |
24 changes: 24 additions & 0 deletions
24
...r/src/main/kotlin/software/amazon/smithy/rust/codegen/server/smithy/ServerRuntimeTypes.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,24 @@ | ||
/* | ||
* 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.rustlang.CargoDependency | ||
import software.amazon.smithy.rust.codegen.smithy.RuntimeConfig | ||
import software.amazon.smithy.rust.codegen.smithy.RuntimeType | ||
|
||
/** | ||
* Object used *exclusively* in the runtime of the server, for separation concerns. | ||
* Analogous to the companion object in [RuntimeType]; see its documentation for details. | ||
* For a runtime type that is used in the client, or in both the client and the server, use [RuntimeType] directly. | ||
*/ | ||
object ServerRuntimeType { | ||
val DeriveBuilder = RuntimeType("Builder", dependency = ServerCargoDependency.DeriveBuilder, namespace = "derive_builder") | ||
|
||
fun Router(runtimeConfig: RuntimeConfig) = | ||
RuntimeType("Router", CargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing") | ||
fun RequestSpecModule(runtimeConfig: RuntimeConfig) = | ||
RuntimeType("request_spec", CargoDependency.SmithyHttpServer(runtimeConfig), "${runtimeConfig.crateSrcPrefix}_http_server::routing") | ||
} |
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