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

Dynamic generation based on generated values #14

Open
matiaslopezd opened this issue Feb 29, 2024 · 1 comment
Open

Dynamic generation based on generated values #14

matiaslopezd opened this issue Feb 29, 2024 · 1 comment
Assignees
Labels
enhancement: feature New feature or request proposal: draft Proposal feature in draft stage

Comments

@matiaslopezd
Copy link
Member

matiaslopezd commented Feb 29, 2024

The idea is to generate the value by key-passing the generated object like this:

const schema = new Schema({
  ...,
  date: { ... },
  duration: {
     type: Number,
     dummy(mock) {
         return Date.now() - this.schema.generated.date; // Use another key to generate other
     } 
  }
});
@matiaslopezd matiaslopezd added enhancement: feature New feature or request proposal: draft Proposal feature in draft stage labels Feb 29, 2024
@matiaslopezd matiaslopezd self-assigned this Feb 29, 2024
@matiaslopezd
Copy link
Member Author

matiaslopezd commented Feb 29, 2024

Concerns

  • Dirty schemas
  • Limitation using evaluated (with function) with other key use evaluated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement: feature New feature or request proposal: draft Proposal feature in draft stage
Projects
None yet
Development

No branches or pull requests

1 participant