-
Notifications
You must be signed in to change notification settings - Fork 853
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
Fail codegen for Query protocol operations with explicit String payload #4553
Fail codegen for Query protocol operations with explicit String payload #4553
Conversation
@@ -73,7 +74,7 @@ private static boolean isBlobShape(Shape shape) { | |||
* @return True if shape is a String type. False otherwise | |||
*/ | |||
private static boolean isStringShape(Shape shape) { | |||
return shape != null && "String".equals(shape.getType()); | |||
return shape != null && shape.getType().equalsIgnoreCase("String"); |
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.
Let's keep the original ordering and compare to the constant: "String".equalsIgnoreCase(shape.getType())
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.
+1
@@ -179,6 +180,12 @@ public Map<String, OperationModel> constructOperations() { | |||
if (input != null) { | |||
String originalShapeName = input.getShape(); | |||
String inputShape = namingStrategy.getRequestClassName(operationName); | |||
|
|||
if (isQueryProtocolWithExplicitStringPayload(c2jShapes, c2jShapes.get(inputShape))) { |
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 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?
Line 21 in ea1bb9b
public interface CodegenCustomizationProcessor { |
Line 34 in ea1bb9b
public final class NewAndLegacyEventStreamProcessor implements CodegenCustomizationProcessor { |
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.
makes sense, moving to preproccesor
Kudos, SonarCloud Quality Gate passed! |
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 callingshape.getType()
Testing
Screenshots (if appropriate)
Types of changes
Checklist
mvn install
succeedsscripts/new-change
script and following the instructions. Commit the new file created by the script in.changes/next-release
with your changes.License