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

How to query #20

Closed
njchandu opened this issue May 22, 2018 · 2 comments
Closed

How to query #20

njchandu opened this issue May 22, 2018 · 2 comments

Comments

@njchandu
Copy link
Contributor

njchandu commented May 22, 2018

This is a how to query. Apologies if this is not the right place to post queries:

book: &book
  id: ${sequence.number}
  title: ${faker.book.title}
  publishedAt: &anchor_val2 ${faker.date.between('2000-01-01', '2010-01-01')}

author:
  id: ${sequence.number}
  policies:
    id1:
      id: ${sequence.number}
      title: ${faker.book.title}
      publishedAt: *anchor_val2
    id2:
      id: ${sequence.number}
      title: ${faker.book.title}
      publishedAt: ${current.date}

Using yaml anchors here, publishedAt: *anchor_val2 generates new ${faker.date.between('2000-01-01', '2010-01-01')}

Is there a way I can reference (reuse) the data generated in publishedAt: &anchor_val2 ${faker.date.between('2000-01-01', '2010-01-01')}

@keepcosmos
Copy link
Owner

It's not possible currently. Even if publishedAt of book is inherited, it generates new faker value.

You should use post processor (https://github.com/keepcosmos/beanmother#register-postprocessors)

@njchandu
Copy link
Contributor Author

@keepcosmos Thanks

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