-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
JSON deserialization issue of selfservice API in Java SDK #154
Comments
It seems to be related with the "discriminator" updates in ".schema/openapi/patches/schema.yaml" of commit 59e808e8dc6339da59bbe08ebbcf7b840e3fdd50 (Ory Kratos repo).
generated java code in "kratos-client-java/src/main/java/sh/ory/kratos/JSON.java" below:
and compile Java SDK with Maven With this workaround it seems that it is working for my current SDK evaluation purpose, but wouldn´t be useful for a release. |
I changed library to jersey2. With this library it is working without the discriminator problem |
Could you please elaborate how exactly you fixed the problem? You switched the Json library? |
Which one is the recommended generator for Java? We can also update it if that generator is less buggy |
The underlying openapi-generator supports several http libraries for java (see "library" at openapi-generator.tech). Default is "okhttp-gson" which causes the discriminator problems in my case.
I hope this helps to unserstand what I did. Jersey2 was working in my case. I´m not sure if it makes sense as a general solution |
Thank you for the reply! Switching generators is a possibility. Unfortunately I have very little experience with Java and don’t really know what libraries are en vogue and which ones aren’t. It also depends a bit on the support of the generator in the openapi tooling. @piotrmsc do you have experience with these libs in Java? |
Getting this too, noticed it only happens with |
I think For the HTTP client on the other hand I don't think there's a clear winner. So if you'd be willing to change the |
Can anyone confirm that this is still an issue? |
No response yet and I´m currently working on other projects. I will close this issue. |
Preflight checklist
Describe the bug
We have just started evaluating Ory Kratos and Ory Cloud as a cloud service for us.
I´m currently working with Ory Kratos Java SDK, to get connected via API to Ory Cloud v0.8.3-alpha.1.pre.0.0.20220221123934-668f6b246db1 and got into a JSON deserialization error. I´m trying to
initializeSelfServiceLoginFlowWithoutBrowser()
of V0alpha2API, where I get ajava.lang.IllegalArgumentException: field sh.ory.kratos.model.UiNode.attributes has type sh.ory.kratos.model.UiNodeAttributes, got sh.ory.kratos.model.UiNodeInputAttributes
. It looks pretty close to #75 .#75 was solved with Ory Kratos v0.7. I have checked several versions of Ory Kratos v0.7 Java SDK, which worked as expected, but with v0.8.0-alpha2 and newer I see the IllegalArgumentException again.
Reproducing the bug
Kratos Java SDK
ApiClient apiClient = Configuration.getDefaultApiClient();
apiClient.setBasePath("https://playground.projects.oryapis.com/api/kratos/public");
V0alpha2Api oryApiAlpha2 = new V0alpha2Api(apiClient);
oryApiAlpha2.initializeSelfServiceLoginFlowWithoutBrowser(null, null, null);
Relevant log output
Relevant configuration
No response
Version
v0.8.0-alpha2 and newer
On which operating system are you observing this issue?
Linux
In which environment are you deploying?
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: