-
Notifications
You must be signed in to change notification settings - Fork 35
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
Unqork #2278
base: main
Are you sure you want to change the base?
Unqork #2278
Conversation
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.
Nice improvement thank you!
Would be nice to have a UT to illustrate this new behavior (maybe in HttpOutboundElementTemplateBuilderTest).
Last thing, did you test the generated template with a request using an Integer param? Just to be sure :)
Thank you again!
return new HttpOperationProperty(id, target, description, required, Type.ENUM, choices, null); | ||
String id, Target target, String description, boolean required, List<Object> choices) { | ||
|
||
List<String> strChoices = new ArrayList<>(); |
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.
What about:
List<String> strChoices = choices.stream().filter(Objects::nonNull).map(Object::toString).toList();
@@ -117,7 +117,7 @@ static HttpOperationProperty fromSchema(String name, Schema<?> schema, Component | |||
|
|||
if (schema.getEnum() != null) { | |||
return HttpOperationProperty.createEnumProperty( | |||
name, Target.BODY, schema.getDescription(), true, (List<String>) schema.getEnum()); | |||
name, Target.BODY, schema.getDescription(), true, (List<Object>) schema.getEnum()); |
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.
we can delete this cast
@@ -73,7 +73,7 @@ private static HttpOperationProperty fromSchema(Parameter parameter, Components | |||
targetMapping.get(parameter.getIn()), | |||
parameter.getDescription(), | |||
parameter.getRequired() != null && parameter.getRequired(), | |||
(List<String>) schema.getEnum()); | |||
(List<Object>) schema.getEnum()); |
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.
same here
@@ -33,8 +34,19 @@ public static HttpOperationProperty createStringProperty( | |||
} | |||
|
|||
public static HttpOperationProperty createEnumProperty( | |||
String id, Target target, String description, boolean required, List<String> choices) { | |||
return new HttpOperationProperty(id, target, description, required, Type.ENUM, choices, null); | |||
String id, Target target, String description, boolean required, List<Object> choices) { |
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.
List choices => List<?> choices, then we can delete the casts (see my next comments)
Thanks for your review @johnBgood! I'll go thru and update the code per your suggestions asap. I was able to import the element template json into Camunda Web Modeler 🎉 Next step is to test it out in an actual process ... I'll keep you posted 🙂 |
Hey @upgradingdave ✋ Just following-up, did you have any chance to test the changes in a process? |
Description
Allow for parsing integers found in ENUM section of open api specs
See issue #2277 for more details. This patch addresses that issue.
Related issues
closes #2277