-
Notifications
You must be signed in to change notification settings - Fork 220
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 required property to defineConditionKeys to be used for serviceResolvedConditionKeys #2183
Conversation
docs/source-2.0/aws/aws-iam.rst
Outdated
* - required | ||
- ``boolean`` | ||
- Defines whether a service resolved condition key is required. Not | ||
applicable to request resolved condition keys as the native |
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.
The "native @required" should be replaced with a :ref:
to the required trait.
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.
applicable to request resolved condition keys as the native | |
applicable to request resolved condition keys, as the native |
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.
There should be some sort of validation for if this property is set and the named key is request-resolved. I think that case should fail and direct users to applying the @required
trait instead.
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.
Still missing the :ref:
for the required trait and the validation wasn't added.
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.
Still missing the :ref: for the required trait and the validation wasn't added.
Added
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.
There should be some sort of validation for if this property is set and the named key is request-resolved. I think that case should fail and direct users to applying the @required trait instead.
Added the validator
@@ -91,13 +103,16 @@ public Optional<String> getRelativeDocumentation() { | |||
return Optional.ofNullable(relativeDocumentation); | |||
} | |||
|
|||
public Optional<Boolean> getRequired() { return Optional.ofNullable(required); } |
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.
Since required
is a primitive boolean, it's not nullable. This should just be a boolean isRequired()
method that returns the value.
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.
Updated to be isRequired without nullable
|
||
private final String type; | ||
private final String documentation; | ||
private final String externalDocumentation; | ||
private final String relativeDocumentation; | ||
|
||
/** |
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.
These should be part of the javadoc for the isRequired
method and not on the private var.
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.
Updated javadoc to be on the method
@@ -119,6 +119,10 @@ structure ConditionKeyDefinition { | |||
/// A relative URL path that defines more information about the condition key | |||
/// within a set of IAM-related documentation. | |||
relativeDocumentation: String | |||
|
|||
// Whether a service resolved condition key is required | |||
// Not applicable to request resolved condition key as the native @required trait must be used |
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.
// Not applicable to request resolved condition key as the native @required trait must be used | |
// Not applicable to request resolved condition keys, as the native @required trait must be used. |
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.
updated
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.
Wasn't updated.
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.
pushed
smithy-aws-iam-traits/src/main/resources/META-INF/smithy/aws.iam.smithy
Outdated
Show resolved
Hide resolved
) | ||
service MyService { | ||
version: "2017-02-11" | ||
} |
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.
Should have empty line at EOF.
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.
added EOF
@@ -0,0 +1,19 @@ | |||
$version: "2" |
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 we need this test, as it's not validating behavior specific to the trait - it's validation for model loading and parsing.
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.
removed
It appears there are also checkstyle validations that are failing the build. |
typo Co-authored-by: Kevin Stich <[email protected]>
…am.smithy period Co-authored-by: Kevin Stich <[email protected]>
...s-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ConditionKeyDefinition.java
Show resolved
Hide resolved
...s-iam-traits/src/main/java/software/amazon/smithy/aws/iam/traits/ConditionKeyDefinition.java
Outdated
Show resolved
Hide resolved
@@ -119,6 +119,10 @@ structure ConditionKeyDefinition { | |||
/// A relative URL path that defines more information about the condition key | |||
/// within a set of IAM-related documentation. | |||
relativeDocumentation: String | |||
|
|||
// Whether a service resolved condition key is required | |||
// Not applicable to request resolved condition key as the native @required trait must be used |
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.
Wasn't updated.
…/iam/traits/ConditionKeyDefinition.java Co-authored-by: Kevin Stich <[email protected]>
…keys use the required property
Resolving in favor of #2288 |
Background
required
property to the IAM traitdefineConditionKeys
.Defines whether a service resolved condition key is required. Not applicable to request resolved condition keys as the native @required trait must be used on the field directly.
Testing
required
is set correctly.Links
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.