8000 Add ConsumerVersionSelector Class · Issue #731 · pact-foundation/pact-python · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Add ConsumerVersionSelector Class #731
Open
@JP-Ellis

Description

@JP-Ellis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:v3Relating to the pact.v3 moduledifficulty:mediumA moderate task requiring a good understanding of the codebasetype:featureNew feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0