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

Query #18

Closed
njchandu opened this issue May 16, 2018 · 4 comments
Closed

Query #18

njchandu opened this issue May 16, 2018 · 4 comments

Comments

@njchandu
Copy link
Contributor

njchandu commented May 16, 2018

  1. Is it possible to create a bean object for an object which is not at the root level?
    Ex:
my:
  book: &book
    id: ${sequence.number}
    title: ${faker.book.title}
    language: en
    publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}

  author:
    id: ${sequence.number}
    works:
      - <<: *book
      - <<: *book
      - <<: *book
    somethingElse: bla
  1. Is it possible to create a bean for a specific object in a specific file if there are duplicate yaml objects.
    Ex:
first.yml
book: &book
  id: 1
  title: ${faker.book.title}
  language: en
  publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}

and

second.yml
book: &book
  id: 2
  title: ${faker.book.title}
  language: en
  publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}
@keepcosmos
Copy link
Owner

  1. Yes, it's possible just like example.

  2. No, I recommend using different key name. But you can if you create your own beanmother object https://github.com/keepcosmos/beanmother#customization

@njchandu
Copy link
Contributor Author

njchandu commented May 16, 2018

@keepcosmos
My bad.

  1. I noticed my example was not correct. I updated it now.
my:
  book: &book
    id: ${sequence.number}
    title: ${faker.book.title}
    language: en
    publishedAt: ${faker.date.between('2000-01-01', '2010-01-01')}

  author:
    id: ${sequence.number}
    works:
      - <<: *book
      - <<: *book
      - <<: *book
    somethingElse: bla

Here the root node is my, is it possible to map object for book and author in this case? Apologies if the query is redundant.

@keepcosmos
Copy link
Owner

It's not possible. key must be a root :), is there any usecase you want?

@keepcosmos keepcosmos reopened this May 16, 2018
@njchandu
Copy link
Contributor Author

@keepcosmos I just realised that doesn't make sense. :) thanks for responding

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