pact-foundation / pact-go

Golang version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
http://pact.io
MIT License
857 stars 109 forks source link

Problem with embedded structs during pact testing #229

Open TorbenCK opened 2 years ago

TorbenCK commented 2 years ago

In our Golang api application, we use embedded struct. However, when we use pact-go it does not seem to support embedded structs. Is there a plan to support this in the near future?

srcType.Field.Anonymous allow differentiation between embedded and normal structs and could be used in pact matcher.go in func match(srcType reflect.Type, params params). JSON Marshal could serve as inspiration, see here: https://play.golang.org/p/PzncHdyUUL5

mefellows commented 2 years ago

Hi, I'd be happy to support it. Would you be interested in submitting a PR?

TorbenCK commented 2 years ago

Good to hear. Yes, we currently thinking about if we fix this for ourself and then submit it as PR here.