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

URL based matching #107

Closed
guyisra opened this issue May 27, 2016 · 9 comments
Closed

URL based matching #107

guyisra opened this issue May 27, 2016 · 9 comments
Labels
v3 pact v3 specification

Comments

@guyisra
Copy link

guyisra commented May 27, 2016

I am using PACT to mock a service which uses a REST based urls

resource/resource_id/system/system_id

Is there a way to avoid have a predefined resource_id/system_id which must be used by the consumer and provider? I.e. resource_id should look like a UUID, but it really doesn't matter, as long as its consitent throughout the mocking - if I request resource/resource_id, resource_id should use whatever has been sent, as long as it matching that I specificied

I understand there is support for query parameters, is there a way to do this for REST-like url params?

@uglyog
Copy link
Member

uglyog commented May 28, 2016

I'm not sure if regex expression work with paths. I'll need to confirm.

@bethesque
Copy link
Member

It does in the consumer side, but you need to provide a concrete example
for replay on the provider.

On Saturday, May 28, 2016, Ronald Holshausen [email protected]
wrote:

I'm not sure if regex expression work with paths. I'll need to confirm.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/realestate-com-au/pact/issues/107#issuecomment-222281025,
or mute the thread
https://github.com/notifications/unsubscribe/AAbPFAfebO_aLlBkkd0PeZG4CPjiruIHks5qF5GvgaJpZM4IoeEN
.

@guyisra
Copy link
Author

guyisra commented May 28, 2016

how does it work with regex?

@guyisra
Copy link
Author

guyisra commented Aug 22, 2016

@bethesque Can you give an example of how this can be done?

@johngluckmdsol
Copy link

It would be nice if there were a way to not have to specify a value for the provider.

I'm wondering if there can be a generator in the :path, something along the lines of path: '/some_path/{some_generator.generate}' . For example we use lots of uuids and it would be handy to randomly generate the uuid and be able to use retrieve the value for use in the provider state to make the service call. Otherwise, we have to map uuids across projects to provider states. That seems like it could get out of hand. But maybe I'm missing something?

@uglyog
Copy link
Member

uglyog commented Oct 6, 2016

Generators are defined as part of the V3 specification, which is not implemented for Ruby as yet: https://github.com/pact-foundation/pact-specification/tree/version-3#introduce-example-generators

@johngluckmdsol
Copy link

Thanks for the quick response :)

@YOU54F YOU54F added the v3 pact v3 specification label Aug 12, 2024
@YOU54F
Copy link
Member

YOU54F commented Aug 12, 2024

See #318 for latest status on pact-v3 implementation in pact-ruby

Closing this issue as I've linked it to the meta v3 issue and will be implemented as part of that work

@YOU54F YOU54F closed this as completed Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 pact v3 specification
Projects
None yet
Development

No branches or pull requests

5 participants