-
Notifications
You must be signed in to change notification settings - Fork 53
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
feat: add service codegen framework #497
Conversation
...hy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/integration/GoIntegration.java
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoCodegenContext.java
Show resolved
Hide resolved
.../java/software/amazon/smithy/go/codegen/service/protocol/aws/AwsJson10ProtocolGenerator.java
Outdated
Show resolved
Hide resolved
...-codegen/src/main/java/software/amazon/smithy/go/codegen/service/ServiceDirectedCodegen.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comments:
- Rather than "Service", I think "Server" is a better name. This avoids any naming confusion for Service shapes, and is the recommended way to name Smithy plugins: https://smithy.io/2.0/guides/building-codegen/configuring-the-generator.html#how-to-name-codegen-plugins
- The Server plugin using DirectedCodegen is awesome. I think unifying the Go Integration interfaces would be better in the long term, especially if we want to write integrations that are applicable to both client / server codegen. Keeping
ArtifactType
for nullable index check modes makes sense though. - nit: For all of the classes with changes in visibility, I am wondering if we should move them to an
internal
package also, just to be sure no one uses it. Either way, we should be liberal with using the@SmithyInternalApi
annotation.
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/CodegenVisitor.java
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoCodegenContext.java
Outdated
Show resolved
Hide resolved
...go-codegen/src/main/java/software/amazon/smithy/go/codegen/service/GoServiceIntegration.java
Outdated
Show resolved
Hide resolved
...hy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/service/NoopServiceStruct.java
Outdated
Show resolved
Hide resolved
...-go-codegen/src/main/java/software/amazon/smithy/go/codegen/service/NotImplementedError.java
Outdated
Show resolved
Hide resolved
...-codegen/src/main/java/software/amazon/smithy/go/codegen/service/ServiceDirectedCodegen.java
Outdated
Show resolved
Hide resolved
...en/src/main/java/software/amazon/smithy/go/codegen/service/integration/DefaultProtocols.java
Outdated
Show resolved
Hide resolved
.../java/software/amazon/smithy/go/codegen/service/protocol/aws/AwsJson10ProtocolGenerator.java
Outdated
Show resolved
Hide resolved
codegen/smithy-go-codegen/src/main/java/software/amazon/smithy/go/codegen/GoCodegenContext.java
Show resolved
Hide resolved
if (directive.shape().getId().getNamespace().equals(CodegenUtils.getSyntheticTypeNamespace())) { | ||
return; | ||
} | ||
if (isUnit(directive.shape().getId())) { | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason why we are skipping generating the synthetic I/O shapes and unit types? The I/O shapes should be generated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unclear, this was taken from the client version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Marked as FUTURE to reconcile
- Remove document support code - Skip event streaming operations
677a2f1
to
70a8eaf
Compare
@SmithyInternalApi | ||
public enum ArtifactType { | ||
CLIENT, | ||
SERVER; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think ArtifactType
is doing anything meaningful right now, it can be removed.
Adds the infrastructure for service code generation.
Service codegen exists as a separate plugin which is powered by the newer recommended
DirectedCodegen
.This PR adds partial support for the awsJson1.0 protocol. The document type and event stream operations are not yet implemented.
I had to change some internals to work w/
DirectedCodegen
that technically would be experienced by the downstream v2 SDK (e.g. refactoringGoWriter
to extendSymbolWriter
instead ofAbstractCodeWriter
. I checked and confirmed that the output of v2's codegen is completely unchanged against this.Special thanks to @syall and @isaiahvita without whom this would not have been possible!