Closed algattik closed 1 year ago
@paullatzelsperger @ndr-brt @bscholtes1A a penny for your thoughts on this :)
Having an EDC REST client would be great, I never got the chance to try the openapi generator, but looking forward for that.
@paullatzelsperger @ndr-brt @bscholtes1A @zeier I built a quick spike at https://github.com/agera-edc/DataSpaceConnector/pull/249. Happy for your comments and feedback on proposed decision points.
https://github.com/agera-edc/DataSpaceConnector/pull/249
The org.openapi.generator
plugin appears to work reliably as part of the build, and is fast (8 seconds).
The plugin generates an entire gradle project in the build/ directory. We have the option:
src/main/java
folder to the source set.Since the execution is fast, we opted for the latter option here.
In EDC, we standardise on OkHttpClient and Jackson. The plugin can use various HTTP client libraries and JSON serialisation frameworks. If generating for OkHttpClient, only GSON serialisation can be used. This means that new generated DTO classes must be used on the client side.
The generated DTO classes are mutable, and are created with this style: new MyDto().field1(value1).field2(value2)
An alternative would be to use the native
Java HttpClient
(Java 11+) and Jackson serialisation. We could then reuse the existing DTO classes. We would then have to refactor existing data management API modules to separate DTOs from services into separate packages.
HttpClient
rather than OkHttpClient
to maximise portability and reduce client code size (OkHttpClient
pulls in Kotlin). Clients who would want the additional advanced features of OkHttpClient
would anyway be sophisticated enough that having to regenerate their own client from the OpenAPI definitions would hardly be an issue.@algattik Great work, at a first sight I like it, it took a little while to build everything and run the e2e test with it.
about the decisions:
okttp
one since it's also the edc default httpclient, but, on the other hand, this client will be used separately from the EDC so having a lightweight library could be a first class feature. I would go for the latter.This is currently blocked by https://github.com/eclipse-dataspaceconnector/DataSpaceConnector/issues/1264
This issue is stale because it has been open for 14 days with no activity.
This issue was closed because it has been inactive for 7 days since being marked as stale.
This issue was closed because it has been inactive for 7 days since being marked as stale.
This issue is stale because it has been open for 14 days with no activity.
This issue is stale because it has been open for 14 days with no activity.
@algattik in my opinion this would have been useful, will someone work on it?
@ndr-brt work on this would require first #1264 to be resolved
This issue is stale because it has been open for 14 days with no activity.
This issue is stale because it has been open for 28 days with no activity.
Feature Request
The project should include a generated client for the Data Management API, which should be used in system tests (instead of RestAssured).
Which Areas Would Be Affected?
System tests
Why Is the Feature Desired?
Solution Proposal
We've had good results with openapi-generator-maven-plugin, the equivalent plugin exists for Gradle.
Type of Issue
Improvement
Checklist