-
Notifications
You must be signed in to change notification settings - Fork 218
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
Rule-Engine: Experimental Context Traits #1248
Conversation
I’m tempted to make this part of Smithy core rather than something AWS-specific. Seems simple enough so far, but I guess the decision hinges on the associated endpoint rules configuration and whether they can be generic enough too. |
My recommendation would be to have this be in Smithy core—this would influence code generation of endpoint parameter structures / configuration wiring. For the rules, I'd put them in something like You might imagine that a customer uses the endpoint parameters but than hand-writes a simple endpoint resolver instead of relying on rules. |
Updated this PR with the latest trait designs & feedback. This should be good for another review pass now. |
2682d96
to
ecd22e8
Compare
...va/software/amazon/smithy/aws/traits/experimental/StaticContextParamsTraitValidatorTest.java
Outdated
Show resolved
Hide resolved
...c/test/java/software/amazon/smithy/aws/traits/experimental/ClientContextParamsTraitTest.java
Outdated
Show resolved
Hide resolved
...s/src/main/java/software/amazon/smithy/aws/traits/experimental/ClientContextParamsTrait.java
Outdated
Show resolved
Hide resolved
...s-traits/src/main/java/software/amazon/smithy/aws/traits/experimental/ContextParamTrait.java
Outdated
Show resolved
Hide resolved
...hy-aws-traits/src/main/java/software/amazon/smithy/aws/traits/experimental/ContextIndex.java
Outdated
Show resolved
Hide resolved
...n/java/software/amazon/smithy/aws/traits/experimental/StaticContextParamsTraitValidator.java
Outdated
Show resolved
Hide resolved
...n/java/software/amazon/smithy/aws/traits/experimental/StaticContextParamsTraitValidator.java
Outdated
Show resolved
Hide resolved
...ws-traits/src/test/java/software/amazon/smithy/aws/traits/experimental/ContextIndexTest.java
Outdated
Show resolved
Hide resolved
smithy-aws-traits/src/main/resources/META-INF/smithy/aws.experimental.smithy
Outdated
Show resolved
Hide resolved
smithy-aws-traits/src/main/resources/META-INF/smithy/aws.experimental.smithy
Outdated
Show resolved
Hide resolved
Implemented all feedback, except for the final documentation pieces within the model. |
Rebased commits on top of 1.22.0. |
...engine/src/test/resources/software/amazon/smithy/rulesengine/traits/traits-test-model.smithy
Outdated
Show resolved
Hide resolved
...engine/src/test/java/software/amazon/smithy/rulesengine/traits/EndpointRuleSetTraitTest.java
Show resolved
Hide resolved
...engine/src/main/java/software/amazon/smithy/rulesengine/traits/StaticContextParamsTrait.java
Outdated
Show resolved
Hide resolved
...engine/src/main/java/software/amazon/smithy/rulesengine/traits/StaticContextParamsTrait.java
Outdated
Show resolved
Hide resolved
...engine/src/main/java/software/amazon/smithy/rulesengine/traits/ClientContextParamsTrait.java
Outdated
Show resolved
Hide resolved
...engine/src/main/java/software/amazon/smithy/rulesengine/traits/ClientContextParamsTrait.java
Outdated
Show resolved
Hide resolved
...-rules-engine/src/main/java/software/amazon/smithy/rulesengine/traits/ContextParamTrait.java
Outdated
Show resolved
Hide resolved
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/traits/ContextIndex.java
Outdated
Show resolved
Hide resolved
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/traits/ContextIndex.java
Outdated
Show resolved
Hide resolved
Good for follow-up review. |
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/traits/ContextIndex.java
Outdated
Show resolved
Hide resolved
9687058
to
0d4a5e0
Compare
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/package-info.java
Show resolved
Hide resolved
smithy-rules-engine/src/main/resources/META-INF/smithy/smithy.rules.smithy
Outdated
Show resolved
Hide resolved
smithy-rules-engine/src/main/resources/META-INF/smithy/smithy.rules.smithy
Show resolved
Hide resolved
4fb02d3
to
e90daed
Compare
Adds support for new AWS context traits
clientContextParams
,staticContextParams
, andcontextParam
.smithy.rules#clientContextParams
is a trait that may be applied to a Service shape. It is used to indicate that the named context parameters that should be configurable on a top-level API client. The trait is a mapping of the context parameter name to their definition containing the Smithy shape type used to represent it, documentation string for the client, and context usages. Valid usages areendpoint
, and valid shape types supported arestring
andboolean
.smithy.rules#staticContextParams
is a trait that may be applied to an Operation shape. It is a mapping of context parameter names to their definition containing the static value to be configured for the parameter, and context usages. Valid usages areendpoint
.smithy.rules#contextParam
is a trait that may be applied to a Member shape. The trait indicates the target context parameter name that the member's value should be bound to as, as well as the context usages. Valid usages areendpoint
. Per specification this trait will only be supported on the top-level operation input shape.smithy.rules#endpointRuleSet
is a trait that is used to embed a rule-set document.Example Model
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.