Skip to content
This repository has been archived by the owner on Jun 29, 2021. It is now read-only.

[Question] Is there a required if feature on model classes? #417

Closed
adil-waqar opened this issue Feb 26, 2021 · 2 comments
Closed

[Question] Is there a required if feature on model classes? #417

adil-waqar opened this issue Feb 26, 2021 · 2 comments
Labels

Comments

@adil-waqar
Copy link

adil-waqar commented Feb 26, 2021

Hello all. I just wanted to know if we could do something like this in our model definition:

class MyModel {
  @prop({ required: true })
  public hasHost!: boolean;

  @prop({ required: this.hasHost })
  public myHost!: string;
}
@adil-waqar adil-waqar changed the title [Question] Is there a required if feature on models? [Question] Is there a required if feature on modals? Feb 26, 2021
@adil-waqar adil-waqar changed the title [Question] Is there a required if feature on modals? [Question] Is there a required if feature on model classes? Feb 26, 2021
@hasezoey
Copy link
Contributor

wrong repo, #391

PS: as you can see in the mongoose documentation you can make more or less all validators from mongoose an function

@adil-waqar
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants