Skip to content
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

API generation bug regarding Accept Consent request session model #3058

Closed
4 of 6 tasks
matejkramny opened this issue Apr 6, 2022 · 7 comments · Fixed by #3074
Closed
4 of 6 tasks

API generation bug regarding Accept Consent request session model #3058

matejkramny opened this issue Apr 6, 2022 · 7 comments · Fixed by #3074
Assignees
Labels
bug Something is not working. good first issue A good issue to tackle when being a novice to the project.

Comments

@matejkramny
Copy link
Contributor

Preflight checklist

Describe the bug

The API generates an incorrect definition for the Accept Consent request session data model in the Go api client (ref ory/hydra-client-go#10)

Model in question:
https://github.com/ory/hydra-client-go/blob/master/model_consent_request_session.go#L23

It's type "idToken": map[string]map[string]interface{} when the API docs suggest it is "idToken": map[string]interface{}

The JS (node) api also sends an object of key: string, value: any. The dart api also has a similar mapping, but of String: JSONObject.

The model requires us to define the following body, which is not correct

idToken: {
  email: { email: "hello@email.com" },
  name: { name: "foo bar" },
}

Reproducing the bug

  1. Create a login session/ consent
  2. OpenAPI consumer crashes (not expecting nested maps)

Relevant log output

n/a

Relevant configuration

n/a

Version

1.11.7

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Kubernetes

Additional Context

The openapi generator seems to incorrectly assume the value of the map and gives them a map instead

@matejkramny matejkramny added the bug Something is not working. label Apr 6, 2022
@zepatrik
Copy link
Member

zepatrik commented Apr 8, 2022

Hm looks like a problem with the generator, the spec looks fine. Also if other languages are working properly, this suggests it's a bug in the generator.

@matejkramny
Copy link
Contributor Author

I've done some digging into how it's generated, it appears to have been a problem before

@aeneasr
Copy link
Member

aeneasr commented Apr 9, 2022

We had this problem in Kratos, a good solution is to remove the type attribute which de-bugs the spec. You can find such an example here: https://github.com/ory/kratos/blob/e50551330d976845c696bf68b6d9b61221da59d3/.schema/openapi/patches/schema.yaml#L2

To apply the patch, add it like so:

https://github.com/ory/kratos/blob/e50551330d976845c696bf68b6d9b61221da59d3/Makefile#L93

@matejkramny
Copy link
Contributor Author

Thanks @aeneasr I'll create a patch and submit a PR

@aeneasr aeneasr added the good first issue A good issue to tackle when being a novice to the project. label Apr 16, 2022
@aeneasr aeneasr self-assigned this Apr 16, 2022
@matejkramny
Copy link
Contributor Author

Apologies but I'd lik to reopen as the PR does not correct the definition:

https://github.com/ory/hydra-client-go/blob/master/model_consent_request_session.go#L23

@kotyara85
Copy link

This PR didn't seem to fixed the the client repo?
Looking for a fix too
Thanks

@aeneasr
Copy link
Member

aeneasr commented Apr 28, 2022

It's not yet released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working. good first issue A good issue to tackle when being a novice to the project.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants