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

Using number | null ends up in an error #60

Open
PeterMK85 opened this issue Sep 23, 2021 · 2 comments
Open

Using number | null ends up in an error #60

PeterMK85 opened this issue Sep 23, 2021 · 2 comments

Comments

@PeterMK85
Copy link

PeterMK85 commented Sep 23, 2021

Hey 👋

I think I faced with a possible issue, the source type generated by the swagger-typescript-api package.

Steps to reproduce

  • Have a type with a nullable field:
    Failing Example:
    export interface ExampleKey {
    /** @format int64 */
    activeUntil: number | null;
    allowExportDashboard: boolean;
    email: string;
    firstName?: string;
    isValid: boolean;
    lastName?: string;
    }

If the ... | null removed, the mock will be created as expected.

Errors:

Online interface will throw the following error:
m[a] is not a function

CLI will throw the following error:
Unsupported Primitive type 173

Is it something expected or it is a bug?

@Anthony-YY
Copy link

Anthony-YY commented Jan 28, 2022

encounter such issues too. one workaround is to replace all | null with empty strings in fileData.
mock({files: [filePath, fileData]})

@elie222
Copy link

elie222 commented Feb 11, 2022

Quick fix when using the online editor:
Select | null. Command D to select them all. Delete.

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

No branches or pull requests

3 participants