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

The updateVerificationFlowBody OpenAPI type is missing the code enum variant #2943

Closed
4 of 6 tasks
thehabbos007 opened this issue Dec 11, 2022 · 2 comments
Closed
4 of 6 tasks
Labels
bug Something is not working.

Comments

@thehabbos007
Copy link

thehabbos007 commented Dec 11, 2022

Preflight checklist

Describe the bug

Hey, with the recent update to v0.11.0 and the additional code method for the verification flow, it seems that the OpenAPI type enum hasn't been updated, which means downstream clients are not able to pass updateVerificationFlowWithCodeMethod to the updateVerificationFlowBody operation.

From what I've gathered, it seems that operation is missing a patch to allow the other variant of the enum at
https://github.com/ory/kratos/blob/master/.schema/openapi/patches/selfservice.yaml#L79-L88
which I think should look something like this?

- op: add
  path: /components/schemas/updateVerificationFlowBody/oneOf
  value:
    - "$ref": "#/components/schemas/updateVerificationFlowWithLinkMethod"
    - "$ref": "#/components/schemas/updateVerificationFlowWithCodeMethod"
- op: add
  path: /components/schemas/updateVerificationFlowBody/discriminator
  value:
    propertyName: method
    mapping:
      link: "#/components/schemas/updateVerificationFlowWithLinkMethod"
      code: "#/components/schemas/updateVerificationFlowWithCodeMethod"

Reproducing the bug

N/A, but the resulting codegen that is wrong is https://github.com/ory/sdk/blob/627c129c69423e9246a21cb86fdfe54fedd87721/clients/kratos/typescript/api.ts#L3183 which should be
export type UpdateVerificationFlowBody = UpdateVerificationFlowWithLinkMethod | UpdateVerificationFlowWithCodeMethodBody;.

This is apparaent when consuming the SDK and not being able to update a verification flow with the code method.

Relevant log output

No response

Relevant configuration

selfservice:
  flows:
    verification:
      use: code
      ui_url: http://localhost:3000/verification
      enabled: true

Version

v0.11.0

On which operating system are you observing this issue?

Linux

In which environment are you deploying?

Other

Additional Context

No response

@NiteArie
Copy link

NiteArie commented Dec 14, 2022

export type UpdateVerificationFlowBody = UpdateVerificationFlowWithLinkMethod | UpdateVerificationFlowWithCodeMethodBody.

The UpdateVerificationFlowWithCodeMethodBody is missing in the generated sdk. Can you guys take a look at this?

@jijjijj
Copy link

jijjijj commented Feb 28, 2023

You can workaround this with @ts-ignore:

...
let Data: UpdateVerificationFlowWithCodeMethodBody = {
    csrf_token: CsrfToken,
    email: this.#Container.Email,
    code: Code
};

this.#Ory.updateVerificationFlow({
    flow: this.FlowContainer.FlowId,
    // @ts-ignore
    updateVerificationFlowBody: Data
})
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

3 participants