Skip to content
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

Closed
wants to merge 17 commits into from

Conversation

0xjjoyy
Copy link
Contributor

@0xjjoyy 0xjjoyy commented Mar 13, 2024

Background

  • What do these changes do?
  1. Adds a required property to the IAM trait defineConditionKeys.
  2. Updates the IAM trait documentation.
  • Why are they important?

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

  • How did you test these changes?
  1. Smithy test files.
  2. Java test class to check required is set correctly.

Links

  • Links to additional context, if necessary
  • Issue #, if applicable (see here for a list of keywords to use for linking issues)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@0xjjoyy 0xjjoyy requested a review from a team as a code owner March 13, 2024 06:17
@0xjjoyy 0xjjoyy requested a review from AndrewFossAWS March 13, 2024 06:17
* - required
- ``boolean``
- Defines whether a service resolved condition key is required. Not
applicable to request resolved condition keys as the native
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
applicable to request resolved condition keys as the native
applicable to request resolved condition keys, as the native

Copy link
Contributor

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.

Copy link
Contributor

@kstich kstich Apr 9, 2024

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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); }
Copy link
Contributor

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.

Copy link
Contributor Author

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;

/**
Copy link
Contributor

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.

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed

)
service MyService {
version: "2017-02-11"
}
Copy link
Contributor

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.

Copy link
Contributor Author

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"
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@kstich
Copy link
Contributor

kstich commented Mar 14, 2024

It appears there are also checkstyle validations that are failing the build.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't updated.

@0xjjoyy 0xjjoyy requested a review from kstich April 9, 2024 17:06
@kstich
Copy link
Contributor

kstich commented May 15, 2024

Resolving in favor of #2288

@kstich kstich closed this May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants