Skip to content
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

Setup Go Server codegen #494

Merged
merged 2 commits into from
Jan 29, 2024
Merged

Setup Go Server codegen #494

merged 2 commits into from
Jan 29, 2024

Conversation

syall
Copy link
Contributor

@syall syall commented Jan 29, 2024

The branch feat-svcgen should NOT be merged into main; everything in the branch is a POC.

Issue #, if available:

N/A.

Description of changes:

Setup Go Server codegen

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@syall syall requested review from a team as code owners January 29, 2024 20:16
@syall syall force-pushed the setup-server-plugin branch from 7d82b5a to 94fe8a4 Compare January 29, 2024 21:34
@@ -49,6 +50,10 @@ default byte getOrder() {
return 0;
}

default ArtifactType getArtifactType() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for a plugin to work for either artifact type? What's this used for?

@@ -70,7 +71,8 @@
* <p>Reserved words for Go are automatically escaped so that they are
* suffixed with "_". See "reserved-words.txt" for the list of words.
*/
final class SymbolVisitor implements SymbolProvider, ShapeVisitor<Symbol> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - is this really a SymbolVisitor or a ShapeVisitor?

@@ -79,8 +80,10 @@ final class CodegenVisitor extends ShapeVisitor.Default<Void> {
LOGGER.info("Attempting to discover GoIntegration from the classpath...");
ServiceLoader.load(GoIntegration.class, loader)
.forEach(integration -> {
LOGGER.info(() -> "Adding GoIntegration: " + integration.getClass().getName());
integrations.add(integration);
if (integration.getArtifactType().equals(ArtifactType.CLIENT)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any kind of future refactoring that removes the need to add these kinds of conditionals inside of codegen?


@Override
public void execute(PluginContext context) {
String onlyBuild = System.getenv("SMITHY_GO_BUILD_API");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is going on here? Feels like this needs a comment at least.

protocolDocumentGenerator = new ProtocolDocumentGenerator(settings, model, writers);

// TODO(SSDK): do we need this?
this.eventStreamGenerator = new EventStreamGenerator(settings, model, writers, symbolProvider, service);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW we probably won't get to event streams in our current scope


public interface ProtocolGenerator {
@SmithyInternalApi
public interface ServerProtocolGenerator {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a reason we moved this?

@syall syall force-pushed the setup-server-plugin branch from 383eb2e to 8819a05 Compare January 29, 2024 22:45
@syall syall changed the title Setup SSDK codegen Setup Go Server SSDK codegen Jan 29, 2024
@syall syall changed the title Setup Go Server SSDK codegen Setup Go Server codegen Jan 29, 2024
@syall syall merged commit 91d1b63 into aws:feat-svcgen Jan 29, 2024
1 check passed
@syall syall deleted the setup-server-plugin branch January 29, 2024 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants