pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

Fields starting with underscore cannot get values from Generator #20

Closed mstefan7 closed 5 years ago

mstefan7 commented 5 years ago

First of all - you've put together a great tool! I'm currently setting it up for our CI/CD and am looking forward for the improved, faster feedback when changing APIs!

I'm currently setting up a stub server and I believe I've discovered two issues, or at least areas where I'm lacking understanding about how it should work. This is the first one:

I have a POST request that returns this body:

body": {"_id": "1234jj58-kk49-3383-vvvv-1234rrrr5678"}

It has a generator assigned:

{"generators": {"body": {"$._id": {"type": "Uuid"}}}}

When hitting the POST endpoint, the log reveals following:

[WARN] Generator path '$._id' is invalid, ignoring: Expected either a "*" or path identifier in path expression "$._id" at index 2

If I use the generator for any other field than the one that starts with underscore, it generates uuid correctly. I believe that fields starting with underscores aren't handled properly when processing the generators. Can you please take a look?

Thanks!

uglyog commented 5 years ago

This has been fixed in 0.2.1