Skip to content

Conversation

@davidh44
Copy link
Contributor

@davidh44 davidh44 commented Oct 5, 2023

Motivation and Context

Explicit String payloads are not supported for Query protocols

Modifications

Update codegen to fail if there is Query protocol operation with explicit String payload

Update Json codegen test classes which were missed in previous PR - string can be lowercase when calling shape.getType()

Testing

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@davidh44 davidh44 requested a review from a team as a code owner October 5, 2023 23:01
*/
private static boolean isStringShape(Shape shape) {
return shape != null && "String".equals(shape.getType());
return shape != null && shape.getType().equalsIgnoreCase("String");
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's keep the original ordering and compare to the constant: "String".equalsIgnoreCase(shape.getType())

Copy link
Contributor Author

Choose a reason for hiding this comment

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

+1

String originalShapeName = input.getShape();
String inputShape = namingStrategy.getRequestClassName(operationName);

if (isQueryProtocolWithExplicitStringPayload(c2jShapes, c2jShapes.get(inputShape))) {
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 like the idea of doing validation in here since we're not doing it for anything else. Can we do this validation as a preprocessor instead?

similar to
public final class NewAndLegacyEventStreamProcessor implements CodegenCustomizationProcessor {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, moving to preproccesor

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

83.7% 83.7% Coverage
0.0% 0.0% Duplication

@davidh44 davidh44 merged commit 13985e0 into master Oct 6, 2023
@davidh44 davidh44 deleted the hdavidh/fail-codegen-string-payload-query-protocol branch October 6, 2023 22:38
aws-sdk-java-automation added a commit that referenced this pull request Dec 4, 2025
…6f9ab9f0d

Pull request: release <- staging/0a759341-8fdc-488f-847e-b036f9ab9f0d
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