-
Notifications
You must be signed in to change notification settings - Fork 190
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
Add Scoped
Plugin
#2759
Add Scoped
Plugin
#2759
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
7a6efe2
to
264672c
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
264672c
to
72133d7
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
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 like the idea, implementation is clever.
I'd add some docs with examples highlighting when to choose FilterByOperationName
or this, it's going to be the first thing someone thinks about when learning about both.
Changelog entry is missing.
@@ -111,6 +111,8 @@ mod filter; | |||
mod identity; | |||
mod layer; | |||
mod pipeline; | |||
#[doc(hidden)] |
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 hidden?
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'd like Scoped
and the scope
macros to be the primary API and the #[doc(hidden)]
items to be implementation details.
Co-authored-by: david-perez <[email protected]>
A new generated diff is ready to view.
A new doc preview is ready to view. |
fc7c8ea
to
f96e6ab
Compare
4613440
to
8564c71
Compare
|
||
/** Calculate all `operationShape`s contained within the `ServiceShape`. */ | ||
private val index = TopDownIndex.of(codegenContext.model) | ||
private val operations = index.getContainedOperations(codegenContext.serviceShape).toSortedSet(compareBy { it.id }) |
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.
private val operations = index.getContainedOperations(codegenContext.serviceShape).toSortedSet(compareBy { it.id }) | |
private val operations = index.getContainedOperations(codegenContext.serviceShape).toSortedSet(compareBy { it.id }) |
"SmithyHttpServer" to ServerCargoDependency.smithyHttpServer(runtimeConfig).toType(), | ||
) | ||
|
||
/** Calculate all `operationShape`s contained within the `ServiceShape`. */ |
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.
/** Calculate all `operationShape`s contained within the `ServiceShape`. */ |
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ScopeMacroGenerator.kt
Outdated
Show resolved
Hide resolved
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ScopeMacroGenerator.kt
Outdated
Show resolved
Hide resolved
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ScopeMacroGenerator.kt
Outdated
Show resolved
Hide resolved
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ScopeMacroGenerator.kt
Outdated
Show resolved
Hide resolved
} | ||
|
||
fun render(writer: RustWriter) { | ||
macro()(writer) |
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.
nit: I feel like you can just inline.
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ScopeMacroGenerator.kt
Show resolved
Hide resolved
...n/kotlin/software/amazon/smithy/rust/codegen/server/smithy/generators/ScopeMacroGenerator.kt
Outdated
Show resolved
Hide resolved
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. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
The
FilterByOperationName
allows the customer to filter application of a plugin. However this is a runtime filter. A faster and type safe alternative would be a nice option.Description
Add
Scoped
Plugin
andscope
macro.