You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Fix #1878] Decouple HTTP and OpenAPI execution from workflows - #1844
Decouple HTTP and OpenAPI execution from workflows
Summary
This PR enables other workflow engines to reuse HTTP execution and OpenAPI capabilities from the SDK without requiring workflow contexts or adopting the SDK's JSON model.
Key Changes
New Modules
openworkflow-common-http: JDK HTTP transport with zero production dependencies
openworkflow-common-http-jakarta: Jakarta REST transport implementation
openworkflow-common-openapi: OpenAPI document model, operation lookup, and request preparation
The reason will be displayed to describe this comment to others. Learn more.
🟢 Approval recommended
No active review issues were identified for the standalone OpenAPI and HTTP extraction.
No open issues 🎉
What changed in this PR
Extracts OpenAPI interpretation, request preparation, and execution so external engines can reuse the SDK without workflow contexts. This builds on #1841’s HTTP extraction, which remains included in the current diff; it prepares, but does not implement, Lemline integration.
Changes:
Adds a standalone OpenAPI client and optional Jackson reader, retaining existing model and reader package names.
Exposes per-call parameter binding, transport-independent requests, and explicit server fallback.
Keeps workflow-specific behavior in adapters, copies HTTP builders per invocation, and adds compatibility and standalone coverage.
@geomagilles I think this PR and #1841 should be grouper together.
So please close #1841 and update the description of this one. It does not really make sense to review/merge them separately.
geomagilles
changed the title
Decouple OpenAPI calls from workflow contexts
Decouple HTTP and OpenAPI execution from workflows
Nov 18, 2026
The URI reconstruction drops the server URL's query string. For example, a server URL of https://example.test/v1?api-version=2026-01 and operation path /items produces https://example.test/v1/items, so an API that requires that fixed version parameter receives an invalid request. Neither queryParameters nor the transport restores it. Please preserve the server's raw query when joining the operation path and merge it with the operation's query parameters without decoding existing escapes.
@geomagilles
Sorry for the delay in the response, I wanted to carefully review and undestood the proposal
I would like to do some general consideration about the PRs that you have recently opened (this one and the gRPC one),
First of all, I think is a good idea to make bits of the current implementation reusable to another implementations, so thanks to bring this up and lets work on that direction.
Now, some general considerations for the twp PRs:
The general README should be updated to consider this new case, because currently it describe two SDK purposes: provide JAva POJOS generated from specification schema for implementing the spec (as you were doing so far) and to provide a usable, few dependencies, hightly customizable reference implementation that can be run in standalone SDK or integrated (as Quarkus Flow proves) into a enterprise application service. This PRs establishes a new usage that should be reflected there (it is a philosophical milestone ;))
As per previous point, I think stuff that is used by the reference implementation but it is also usable by another implementations should not be under current impl directory but located under a new directory (at the same level than impl) called common, so please move the common stuff to that place. Using that approach, the name of the modules will become common-http, common-openapi, common-grpc, common-http-jakarta.
Now, general condiderations for this PR (the HTML/OpenAPI one)
I think current openapi module (the one currently containing the jackson marshallling-unmarshalling) should be leave as it is, there is not real need to create an openapi-client-jackson (for users that want to use openapi-common, if they also, want to use jackson, they will include impl-openapi)
In the the case of http modules, to be honest, Im not completely satisfied about how the code that remains in the core module looks like. So I want to make a counter proposal (which description is large, but I think is worth it). The classes that you are added int the common module are pretty similar to the ones currently present under impl.http packages. In particular, WorkflowHttpRequestInfo is very similar (and I would argue more tied to the spec) than HttpRequestData and WorkflowHttpReponse is an interface more or lest equivalent to HttpResponseData (and it is an interface because the response handling is different for different REST client api stack and because I wanted to avoid the performance issue that is clearly there in HttpResponseData regarding cloning, hashing and several object-byte[] transformation). I think one of the results of this PR should be to move a refined version of these classes to http-common (not to keep two hierarchies, one in core and anohter in common). Problem is that right now those classes depends on WorkflowContext, TaskContext and WorkflowModel. WorkflowContext and TaskContext dependency can be removed esasily, but WorkflowModel is diffferent case, since it allow direct transformation from the structure used by the REST api and the model user by the workflow without having to have an intermediate partnet (the byte[]). You dealt with that by adding an exchange method, but Im wondering if it wont be better to leave WorklowHttpResponse as a common inteface (that can implement a method that returns a Workflowmodel) and let the HttpTransport layer return a WorkflowHttpRepsonse intance (so JDKTransport return JDKHttpResponse and JakartaTransport return JakartaHttpRepsonse) WorkflowModel is an easy to implement interface that can be easily bridged by any implementation if needed and will provide means for that implementation to achieve serialization improvements avoiding the byte[] step. Alternative, if WorkflowModel depenendecy is really a blocking issue, add a method Optional getBodyAsObject(Class clazz) to WorkflowHttpResonse interface and let the default implementations use ServiceLoader to load converter interfaces or optionally provide them in the constructor/builder of the implementations.
Since the last comment is pretty tricky stuff, which I propose is that this PR becomes a shared effort, you perform the movement and the readme updates I proposed in the my other comments and once you are done, Ill add a new commit implementing what I discuss in my last comment (just let me know if you prefer WorkflowModel vs WorkflowConverter (one of the two has to be there in common to allow extensibility)
+1 to what @fjtirado stated. A common BOM will be great for other implementations to build on top of the OWS SDK one. We can slowly refactor other parts to be there as well in future releases.
Thanks @fjtirado for the detailed review and for offering to work on the HTTP refactor together. I agree with the common/ layout and with keeping the Jackson reader in impl-openapi.
I’ll update this PR in two commits. The first will move the shared HTTP and OpenAPI modules under common/, keep the Jackson reader in impl-openapi, and update the root README to explain how other workflow engines can reuse these components. That commit will be ready to review and merge on its own. I’ll handle gRPC in its own PR.
On your WorkflowModel vs converter question, I’d prefer the injectable converter. Lemline already uses Jackson JsonNode, and a typed body accessor would let us request that type directly while still supporting WorkflowModel in the reference implementation.
I’ll put a small prototype of your converter idea in the second commit so we have something concrete to discuss. I’ll keep the existing tests for raw body access and effective request metadata after redirects. If you’d prefer to take the HTTP refactor from the first commit, we can drop the second one. I’ll ping you when both are ready.
@geomagilles Great.
Yes, I also think the converter approach is cleaner
I think Ill take the work from your second commit (when ready) based on converter (with the goal of avoiding the "hierarchy" duplication I mentioned on my prev comment)
For grpc (I have not looked it in detail yet) I think the split will be easier, because the dependencies are more stable (there is only one grpc library out there, the google one, while in Http we have many)
Extract resolved HTTP execution and OpenAPI operation preparation into common/http, common/http-jakarta and common/openapi, with common artifact coordinates, a shared Maven parent and root dependency management. Keep production dependencies directed from impl to common and leave gRPC to its own PR.
Keep the JSON/YAML Jackson reader, services, native-image metadata and tests in the existing openworkflow-impl-openapi artifact. Document reusable execution components as the third SDK usage in the root README and update examples and dependencies. Preserve HTTP/OpenAPI behavior, SDK authentication and error policy, multivalued headers and effective JDK request metadata after redirects; Jakarta explicitly reports unavailable final-request metadata.
Combine the original extraction and agreed reorganization in one independently usable commit on current main. Retain main's dependency updates and AssertJ migrations. Reserve shared request/response contracts and injectable converters for the next, independently revertible prototype commit.
Verify 124 passing targeted JDK/Jakarta HTTP, standalone OpenAPI and SDK compatibility tests with two existing skips. Check production dependency trees, custom engine-free reader usage, SDK reader discovery and packaging, and repository-wide format/style checks before starting the prototype.
Keep Jersey test scope local to consumers after moving dependency management. Restore native body preparation before header snapshots, and propagate provider Errors during Jakarta buffering so delivery cannot remain pending. Cover the latter with a regression observed failing before the fix. Remove engine-specific references from the common README examples.
Signed-off-by: Gilles Barbier <gilles@infinitic.io>
Refine the original SDK HTTP abstractions into common rather than keeping parallel request records and response implementations. Remove HttpRequestData; HttpRequestInfo owns the HTTP state and builder. The SDK request specialization owns only authentication and preserves usual constructor/accessor JVM signatures.
Move general response behavior, raw formatting and native JDK/Jakarta implementations into common. SDK response classes are constructor-only subclasses, with WorkflowModel parsing and task error enrichment in explicit injected SDK converters. Preserve effective JDK request metadata, explicit Jakarta absence, multivalued headers, original raw bytes and caller-owned response cleanup.
This remains the converter alternative for discussion with fjtirado, not an approved final design. The SDK request is now a class, so record patterns and record-specific reflection require migration. Standalone callers migrate to the common request class and response interface; stringHeaders provides portable text for native header values.
Jakarta retains a buffered native response until close and rejects unbufferable entities. Byte access and serialized request snapshots still copy. JDK avoids response snapshot cloning and payload hashing. Retain the existing private Jakarta raw-format heuristic as a documented compatibility limit. The preceding extraction/reorganization commit on main remains unchanged and independently usable.
Verify 161 passing targeted HTTP/OpenAPI/SDK compatibility tests with two existing skips, repository-wide style checks, HTTP Javadocs and clean structured review.
Retain current main dependency updates and migrate prototype tests to AssertJ. Propagate provider Errors as well as runtime failures through Jakarta delivery, buffering and conversion while closing owned responses and preserving primary failures.
Cover SDK delivery and OpenAPI status-inspection/cleanup Error paths with regressions observed failing before their fixes, preserving normal workflow error translation and explicit fallback policy.
Keep cause-less CompletionException instances as translation inputs and terminate SDK delivery even if failure translation itself throws. Verify exception identity, task position, closure and bounded completion on these paths.
Signed-off-by: Gilles Barbier <gilles@infinitic.io>
Thanks @fjtirado! The PR now contains exactly two commits on top of main:
cb585321: the agreed common/ reorganization and documentation updates, keeping the Jackson reader in impl-openapi. This commit is independently usable.
62a34be8: an implementation of the injectable-converter approach for you to review, adapt or replace. It shares the HTTP request/response implementations rather than maintaining parallel implementations. Reverting it restores the first commit exactly.
Local full-reactor validation passed: 43 modules, 884 tests passed, 17 existing skips, no failures. Spotless and Checkstyle also passed.
The GitHub workflow is awaiting maintainer approval. Could you approve it so we can confirm the Ubuntu CI result?
@geomagilles
Thanks for the refactor. This is aligned with what I have in mind.
Before adding my commit (between other things, Im going to add the Workflow prefix to http classes, so they do not collide with other general http frameworks when using IDEs), I have some preliminary question though:
In HttpResponse interface we have four retrieval methods, two that return byte[], two that return the converted object, when I foresee just two, one that return the body response as byte[] and another one that use the converter to convert it to the workkflow engine implementation domain object (WorkflowModel in the case of the reference implementaiton). I believe two methods need to be removed from that interface.
Why so much cloning on the response? I do not see a real need to clone, neither the headers( that are inmutable so there is no point on cloning), neither. and. specially the body (also, in the case of the response body, cloning it will be a performance killer). Im probably missing some detail, so asking before removing.
Thanks @fjtirado, agreed on both points. The Workflow prefix makes sense too.
The extra accessors were compatibility bridges for the existing SDK API. Let’s keep one byte[] body accessor and getBodyAsObject(Class) in common, with legacy aliases and full raw HTTP formatting kept outside that contract.
The cloning came from the immutable HttpResponseData snapshot guarantees. I agree with removing per-read body clones from native responses and reusing headers where they are already immutable. Returned byte arrays should then be documented as borrowed and read-only.
For Jakarta, the buffering preserves the original bytes when raw access follows typed conversion—that’s separate from the extra clones.
@geomagilles
Perfect, Ill let you know when I done (might take a while, I mean Im not sure Ill be able to do it today or in Monday), but I want to have this merged ASAP
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved regressions break Digest authentication, server fallback, and URI composition, while response handling can leak resources and prevent repeated body reads.
fjtirado
changed the title
Decouple HTTP and OpenAPI execution from workflows
[Fix #1878] Decouple HTTP and OpenAPI execution from workflows
Nov 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix #1878
Decouple HTTP and OpenAPI execution from workflows
Summary
This PR enables other workflow engines to reuse HTTP execution and OpenAPI capabilities from the SDK without requiring workflow contexts or adopting the SDK's JSON model.
Key Changes
New Modules
openworkflow-common-http: JDK HTTP transport with zero production dependenciesopenworkflow-common-http-jakarta: Jakarta REST transport implementationopenworkflow-common-openapi: OpenAPI document model, operation lookup, and request preparationopenworkflow-common-openapi-jackson: Jackson-based OpenAPI readerArchitecture
HttpRequestInfo<B>as concrete request implementationgetBodyAsObject(Class<T>)methodDocumentation
Updated READMEs for all common modules with: