-
Notifications
You must be signed in to change notification settings - Fork 183
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
Use the SymbolProvider
and Model
directly from the Smithy plugins
#1438
Use the SymbolProvider
and Model
directly from the Smithy plugins
#1438
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
@@ -36,8 +35,6 @@ class ServerAwsJsonFactory(private val version: AwsJsonVersion) : ProtocolGenera | |||
override fun buildProtocolGenerator(codegenContext: CodegenContext): ServerHttpBoundProtocolGenerator = | |||
ServerHttpBoundProtocolGenerator(codegenContext, protocol(codegenContext)) | |||
|
|||
override fun transformModel(model: Model): Model = model |
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 used this yesterday to augment the S3 model with some extra metadata—I think we should keep these, especially since the default implementation means that there isn't any cost to having it
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.
You used the transformModel
from the decorators, not this one. I accidentally removed the invocation of the former, but I didn't mean to, that's why CI failed. I've now fixed that.
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.
ah! got it
Despite all the decorators and protocols that we have, there aren't any `RustCodegenDecorator`s or `ProtocolGeneratorFactory`s that are modifying the base symbol provider that the Smithy plugin provides. So we can use directly the base symbol provider everywhere and remove the methods from these interfaces to make the code a little bit simpler. Likewise, there isn't a single `ProtocolGeneratorFactory` that transforms the base model that the Smithy plugin provides.
689be8f
to
862f073
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
import software.amazon.smithy.rust.codegen.smithy.generators.LibRsCustomization | ||
import software.amazon.smithy.rust.codegen.smithy.generators.ManifestCustomizations | ||
import software.amazon.smithy.rust.codegen.smithy.generators.client.FluentClientDecorator | ||
import software.amazon.smithy.rust.codegen.smithy.generators.config.ConfigCustomization | ||
import software.amazon.smithy.rust.codegen.smithy.protocols.ProtocolMap | ||
import software.amazon.smithy.rust.codegen.util.deepMergeWith | ||
import java.util.ServiceLoader | ||
import java.util.* |
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.
Why hasn't the linter complained about *
?
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.
What linter?
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.
kotlin style check
…mbolprovider_-and-_model_-directly-from-the-smithy-plugins
A new generated diff is ready to view.
A new doc preview is ready to view. Rust Wrk benchmark report:Duration: 90 sec, Connections: 32, Threads: 2
|
…-directly-from-the-smithy-plugins
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.
LGTM, thanks for the cleanup!
A new generated diff is ready to view.
A new doc preview is ready to view. |
…mbolprovider_-and-_model_-directly-from-the-smithy-plugins
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
…mbolprovider_-and-_model_-directly-from-the-smithy-plugins
f59b6e3
to
a0dd263
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
Despite all the decorators and protocols that we have, there aren't any
RustCodegenDecorator
s orProtocolGeneratorFactory
s that aremodifying the base symbol provider that the Smithy plugin provides. So
we can use directly the base symbol provider everywhere and remove the
methods from these interfaces to make the code a little bit simpler.
Likewise, there isn't a single
ProtocolGeneratorFactory
thattransforms the base model that the Smithy plugin provides.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.