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

@Representer(null) should not try to serialize data #12

Open
driescroons opened this issue May 11, 2022 · 2 comments
Open

@Representer(null) should not try to serialize data #12

driescroons opened this issue May 11, 2022 · 2 comments

Comments

@driescroons
Copy link

Take following controller function:
image

It generates a Maximum call stack size exceeded:
image

This is because even though we set our representer to null, the handler returns a token entity (I like to return the token for testing purposes), we still call classToPlain in the representer middleware. We should do a null check on the representationType, and if it's null, return null as well.

@doichev-kostia
Copy link
Member

Additionally, when the strictNullChecks flag in tsconfig is set to true, we have a type error

Screenshot 2023-08-11 at 13 52 54

@doichev-kostia
Copy link
Member

Additionally, when the strictNullChecks flag in tsconfig is set to true, we have a type error

Screenshot 2023-08-11 at 13 52 54

Ah, nevermind, I should use @OnUndefined() instead of @Representer(null)

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

2 participants