sghribi / loopback-fixtures

ISC License
18 stars 21 forks source link

Incorrect reference resolved #11

Closed dziamid closed 7 years ago

dziamid commented 7 years ago

Hey, i noticed that sometimes references get resolved incorrectly.

Bar:
  bar1:
    title: {{name.findName}}

FooBar:
  foobar1:
    title: {{name.findName}}

Baz:
  baz1:
    title: {{name.findName}}
    bar: @bar1 // references "@foobar1" instead.

PS Lmk if you need further help to reproduce this. Great library anyway!

aaronbuchanan commented 7 years ago

I'm having the same issue with 0.0.9

aaronbuchanan commented 7 years ago

I found the issue to be the regex matching references ids that include the identifier.

I fixed this by making the regex more explicit (commit). Seems to solve @dziamid's issue as well.

@sghribi happy to PR if you'd like (fixed a couple linter things too, but I also committed lib/ for now so we could keep moving)

dziamid commented 7 years ago

Nice catch @aaronbuchanan, that helped a lot!

aaronbuchanan commented 7 years ago

Went ahead and submitted Pull #13 to address this @sghribi

jaime-franco commented 7 years ago

@sghribi is possible to merge the Pull #13?

sghribi commented 7 years ago

Hello @jaime-franco @aaronbuchanan @dziamid ,

Thanks for your feedback, and sorry for the delay

I'm testing the pull request, and then I publish the new version on NPM