ory / ory/sdk

@ory/kratos typescript API 25.4.0 adds strange "UnknownDefaultOpenApi" von Enums breaking typing

Open
#452 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

I just tried to upgrade @ory/kratos to version 25.4.0.
This produces typing errors in code that worked fine with 1.3.8.
One of the culprits is, that ContinueWithVerificationUi is no longer assignable to ContinueWith.
This is strange.
Digging into it, I found that the ContinueWithVerificationUiActionEnum has a strange definition:

export const ContinueWithVerificationUiActionEnum = {
ShowVerificationUi: 'show_verification_ui',
UnknownDefaultOpenApi: '11184809'
} as const;

And there are many more that have "UnknownDefaultOpenApi" things.

Looks like a generation error to me.

Here is the concrete error I get:

error TS2677: A type predicate's type must be assignable to its parameter's type.
Type 'ContinueWithVerificationUi' is not assignable to type 'ContinueWith'.
Type 'ContinueWithVerificationUi' is not assignable to type '{ action: "show_verification_ui"; } & ContinueWithVerificationUi'.
Type 'ContinueWithVerificationUi' is not assignable to type '{ action: "show_verification_ui"; }'.
Types of property 'action' are incompatible.
Type 'ContinueWithVerificationUiActionEnum' is not assignable to type '"show_verification_ui"'.
Type '"11184809"' is not assignable to type '"show_verification_ui"'.

33 const isContinueWithVerificationUi = (continueWith: ContinueWith): continueWith is ContinueWithVerificationUi => {

Reproducing the bug

run type checking on my typescript code.

Relevant log output

Relevant configuration

Version

25.4.0

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the generated TypeScript definitions in @ory/kratos 25.4.0 with version 1.3.8, focusing on ContinueWithVerificationUiActionEnum and other UnknownDefaultOpenApi entries. Reproduce the reported type-checking error; done means the generated enum types no longer make ContinueWithVerificationUi incompatible with ContinueWith.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.