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

Add ConsumerVersionSelector Class #731

Open
3 of 4 tasks
JP-Ellis opened this issue Jul 18, 2024 · 0 comments
Open
3 of 4 tasks

Add ConsumerVersionSelector Class #731

JP-Ellis opened this issue Jul 18, 2024 · 0 comments
Labels
area:v3 Relating to the pact.v3 module difficulty:medium A moderate task requiring a good understanding of the codebase type:feature New feature

Comments

@JP-Ellis
Copy link
Contributor

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of pact-python.
  • I have read the console error message carefully (if applicable).

Description

Replace the str with a new ConsumerVersionSelector class, or equivalent kwargs in:

def consumer_versions(self, *versions: str) -> Self:

Reproducible demo

No response

Steps to reproduce

Try using the consumer_versions key with most strings and the FFI call fails.

Expected behavior

The end-user should not be responsible for manually serialising data into JSON. Instead, the Python implementation should provide a nice interface.

There could be two options for this implementation, ultimately implementing the following Rust struct:

https://github.com/pact-foundation/pact-reference/blob/fd1ba0c390267ae72be1a5b272fe314e904aa423/rust/pact_verifier/src/pact_broker.rs#L1026-L1083

The first option is to add a TypedDict class, and using the Unpack typing annotation to help convert it into appropriate kwargs. The other is to manually define the kwargs as per the underlying struct.

The JSON string would then be created within the method's logic.

Actual behavior

End user is responsible for generating valid JSON string.

Your environment

No response

Self-service

  • I'd be willing to fix this bug myself.
@JP-Ellis JP-Ellis added type:feature New feature difficulty:medium A moderate task requiring a good understanding of the codebase area:v3 Relating to the pact.v3 module labels Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:v3 Relating to the pact.v3 module difficulty:medium A moderate task requiring a good understanding of the codebase type:feature New feature
Projects
None yet
Development

No branches or pull requests

1 participant