generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 24
Decouple endpoint resolution from http #455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
codegen/aws/core/src/it/java/software/amazon/smithy/python/codegen/test/AwsCodegenTest.java
This file contains hidden or 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,41 @@ | ||
| /* | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
| package software.amazon.smithy.python.codegen.test; | ||
|
|
||
| import java.nio.file.Path; | ||
| import org.junit.jupiter.api.Test; | ||
| import org.junit.jupiter.api.io.TempDir; | ||
| import software.amazon.smithy.build.FileManifest; | ||
| import software.amazon.smithy.build.PluginContext; | ||
| import software.amazon.smithy.model.Model; | ||
| import software.amazon.smithy.model.node.ObjectNode; | ||
| import software.amazon.smithy.python.codegen.PythonClientCodegenPlugin; | ||
|
|
||
| /** | ||
| * Simple test that executes the Python client codegen plugin for an AWS-like service. | ||
| */ | ||
| public class AwsCodegenTest { | ||
|
|
||
| @Test | ||
| public void testCodegen(@TempDir Path tempDir) { | ||
| PythonClientCodegenPlugin plugin = new PythonClientCodegenPlugin(); | ||
| Model model = Model.assembler(AwsCodegenTest.class.getClassLoader()) | ||
| .discoverModels(AwsCodegenTest.class.getClassLoader()) | ||
| .assemble() | ||
| .unwrap(); | ||
| PluginContext context = PluginContext.builder() | ||
| .fileManifest(FileManifest.create(tempDir)) | ||
| .settings( | ||
| ObjectNode.builder() | ||
| .withMember("service", "example.aws#RestJsonService") | ||
| .withMember("module", "restjson") | ||
| .withMember("moduleVersion", "0.0.1") | ||
| .build()) | ||
| .model(model) | ||
| .build(); | ||
| plugin.execute(context); | ||
| } | ||
|
|
||
| } | ||
70 changes: 70 additions & 0 deletions
70
codegen/aws/core/src/it/resources/META-INF/smithy/main.smithy
This file contains hidden or 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,70 @@ | ||
| $version: "2.0" | ||
|
|
||
| namespace example.aws | ||
|
|
||
| use aws.protocols#restJson1 | ||
| use aws.api#service | ||
|
|
||
| /// A test service that renders a restJson1 service with AWS traits | ||
| @restJson1( | ||
| http: ["h2", "http/1.1"] | ||
| eventStreamHttp: ["h2"] | ||
| ) | ||
| @service( | ||
| sdkId: "REST JSON", | ||
| endpointPrefix: "rest-json-1" | ||
| ) | ||
| @title("AWS REST JSON Service") | ||
| @paginated(inputToken: "nextToken", outputToken: "nextToken", pageSize: "pageSize") | ||
| @httpApiKeyAuth(name: "weather-auth", in: "header") | ||
| service RestJsonService { | ||
alextwoods marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| version: "2006-03-01" | ||
| operations: [ | ||
| BasicOperation | ||
| ] | ||
| } | ||
|
|
||
| @http(code: 200, method: "POST", uri: "/basic-operation") | ||
| operation BasicOperation { | ||
| input := { | ||
| message: String | ||
| } | ||
| output := { | ||
| message: String | ||
| } | ||
| } | ||
|
|
||
| @http(code: 200, method: "POST", uri: "/input-stream") | ||
| operation InputStream { | ||
| input := { | ||
| stream: EventStream | ||
| } | ||
| } | ||
|
|
||
| @http(code: 200, method: "POST", uri: "/output-stream") | ||
| operation OutputStream { | ||
| output := { | ||
| stream: EventStream | ||
| } | ||
| } | ||
|
|
||
| @http(code: 200, method: "POST", uri: "/duplex-stream") | ||
| operation DuplexStream { | ||
| input := { | ||
| stream: EventStream | ||
| } | ||
| output := { | ||
| stream: EventStream | ||
| } | ||
| } | ||
|
|
||
|
|
||
| @streaming | ||
| union EventStream { | ||
| message: MessageEvent | ||
| } | ||
|
|
||
| structure MessageEvent { | ||
| message: String | ||
| } | ||
|
|
||
This file contains hidden or 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 @@ | ||
| main.smithy |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.