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

Constructor parameter decorators might not work correctly due to indeterministic initial schema setup #160

Open
adamstoffel opened this issue Jan 14, 2022 · 1 comment

Comments

@adamstoffel
Copy link

adamstoffel commented Jan 14, 2022

In a class that uses both constructor parameter decorators and property decorators such as:

class MyClass {
  constructor(
    @serializable(alias('b'))
    public b: string
  ) { }

  @serializable
  public a?: string;
}

If the decorator for property a is processed before the decorator for property b, the "special" factory function to call the constructor will not be setup in the ModelSchema. Consequently, the constructor will not be called when the class is deserialized.

@mweststrate
Copy link
Member

mweststrate commented Jan 14, 2022 via email

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