Skip to content

Conversation

treblereel
Copy link
Collaborator

@treblereel treblereel commented Sep 23, 2025

[Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:
Fix #477

Special notes for reviewers:

Additional information (if needed):]

Signed-off-by: Dmitrii Tikhomirov <[email protected]>
Signed-off-by: Dmitrii Tikhomirov <[email protected]>
Signed-off-by: Dmitrii Tikhomirov <[email protected]>
@treblereel treblereel marked this pull request as draft September 23, 2025 17:12
@treblereel
Copy link
Collaborator Author

I'm gonna add more tests soon

Copy link
Collaborator

Choose a reason for hiding this comment

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

Comment on lines +56 to +66
WorkflowContext workflowContext, TaskContext taskContext, WorkflowModel input) {
String operationId = task.getWith().getOperationId();
URI openAPIEndpoint = targetSupplier.apply(workflowContext, taskContext, input);
OpenAPIProcessor processor = new OpenAPIProcessor(operationId, openAPIEndpoint);
OperationDefinition operation = processor.parse();

OperationPathResolver pathResolver =
new OperationPathResolver(
operation.getPath(),
application,
task.getWith().getParameters().getAdditionalProperties());
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think all this stuff should be moved to init method (thy are always the same for different executions, so they only need to be processed once)

Comment on lines +70 to +93
HttpCallAdapter httpCallAdapter =
new HttpCallAdapter()
.auth(task.getWith().getAuthentication())
.body(operation.getBody())
.contentType(operation.getContentType())
.headers(
operation.getParameters().stream()
.filter(p -> "header".equals(p.getIn()))
.collect(Collectors.toUnmodifiableSet()))
.method(operation.getMethod())
.query(
operation.getParameters().stream()
.filter(p -> "query".equals(p.getIn()))
.collect(Collectors.toUnmodifiableSet()))
.redirect(task.getWith().isRedirect())
.target(pathResolver.resolve(workflowContext, taskContext, input))
.workflowParams(task.getWith().getParameters().getAdditionalProperties());

WorkflowException workflowException = null;

for (var server : operation.getServers()) {
CallHTTP callHTTP = httpCallAdapter.server(server).build();
HttpExecutor executor = new HttpExecutor();
executor.init(callHTTP, workflow, application, resourceLoader);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same hre the HttpExecutor,init should be called on OpenApiExecutor.init.
The idea is to keep the apply method as minimum as possible

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.

Add OpenAPI task implementation
2 participants