Skip to content

Feat/aggregate provider states by consumers - #790

Merged
YOU54F merged 4 commits into
pact-foundation:masterfrom
YOU54F:feat/aggregate-provider-states-by-consumers
Apr 10, 2025
Merged

Feat/aggregate provider states by consumers#790
YOU54F merged 4 commits into
pact-foundation:masterfrom
YOU54F:feat/aggregate-provider-states-by-consumers

Conversation

@YOU54F

@YOU54F YOU54F commented Mar 21, 2025

Copy link
Copy Markdown
Member

feat: group provider states by consumers

    {
      "providerStates" => [
        { "consumers" => ["Foo", "Foo2", "Foo3", "Foo4", "Foo5"], "name" => "product details", "params" => { "product_id" => "058925f7-1763-4dd9-a057-50ee265e33a0" } },
        { "consumers" => ["Waffle", "Waffle2"], "name" => "product list" },
        { "consumers" => ["Foo6"], "name" => "some other product list" }
      ]
    }

Fixes #789

@YOU54F
YOU54F requested review from impurist, mefellows and pahnin March 21, 2025 16:09

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this logic live elsewhere, rather than the decorator?

Would it be better to have this performed as part of a db query.

Just thinking of performance reasons, with a large set of consumer pacts, for a given provider.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure of previous patterns across the code base, but pagination might be one way to address that performance concern.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider returning more information here.

Would it be useful for example, for the returned list in the api to contain the links to the latest pacts on the consumers main branch, which contain the provider states returned?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A link might be a nice touch. Given it's just a template and doesn't require additional DB lookups it should be pretty speedy. But equally fairly straightforward to re-lookup using the HAL links so I think we could consider adding it later if people really need.

YOU54F added 4 commits April 10, 2025 10:16
```
    {
      "providerStates" => [
        { "consumers" => ["Foo", "Foo2", "Foo3", "Foo4", "Foo5"], "name" => "product details", "params" => { "product_id" => "058925f7-1763-4dd9-a057-50ee265e33a0" } },
        { "consumers" => ["Waffle", "Waffle2"], "name" => "product list" },
        { "consumers" => ["Foo6"], "name" => "some other product list" }
      ]
    }
```
@YOU54F
YOU54F force-pushed the feat/aggregate-provider-states-by-consumers branch from a1ec14a to 1abf3f6 Compare April 10, 2025 09:16
@YOU54F
YOU54F merged commit fb36b29 into pact-foundation:master Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Endpoint /provider-states duplicate names

3 participants