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

Events and API unification - Market API. #52

Merged
merged 41 commits into from
Nov 9, 2020

Conversation

stranger80
Copy link
Contributor

@stranger80 stranger80 commented Oct 24, 2020

This is part I of REST API unification and event-handling changes - Market API.

Part II is #53

Confirmed to be back-compatible with yapapi v0.3.0 via golemfactory/yagna#758
and later on via golemfactory/yagna#775

@stranger80 stranger80 mentioned this pull request Oct 24, 2020
Copy link
Contributor

@tworec tworec left a comment

Choose a reason for hiding this comment

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

the same set of comments/changes as in second part of my review for #53 applies here also

specs/common.yaml Show resolved Hide resolved
specs/market-api.yaml Outdated Show resolved Hide resolved
@tworec tworec removed a link to an issue Nov 4, 2020
Copy link
Contributor

@nieznanysprawiciel nieznanysprawiciel left a comment

Choose a reason for hiding this comment

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

Second part of review (last)

proposal: Proposal,
},
#[serde(rename = "ProposalRejectedEvent")]
ProposalRejectedEvent {
Copy link
Contributor

Choose a reason for hiding this comment

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

To consider:
Since we have PropsalRejectedEvent, maybe we could give better name to ProposalEvent whose name seems to be to general now. Probably similar to AgreementEvent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Second thing to consider:
I saw in rust Requestor code, that when querying Proposals, he must check if Proposal is initial and make different decisions based on this. Maybe it's reason to separate initial Proposals from counter Proposals??

Copy link
Contributor

Choose a reason for hiding this comment

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

We can't change event names and semantics for Alpha.3, because we need to be backward compatible.
And this PR is meant for Alpha.3

Copy link
Contributor

Choose a reason for hiding this comment

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

postponed to #53

model/src/market/agreement_event.rs Show resolved Hide resolved
model/src/market/agreement_event.rs Outdated Show resolved Hide resolved
model/src/market/demand_offer_base.rs Show resolved Hide resolved
specs/market-api.yaml Outdated Show resolved Hide resolved
specs/market-api.yaml Outdated Show resolved Hide resolved
@tworec tworec force-pushed the stranger80/market-api-events branch from 98ee654 to 5738047 Compare November 5, 2020 20:13
* Reason message is required, but Reason itself is optional
* removed AgreementTimeoutEvent
* renamed operations from `rejectProposal__Reason` to `rejectProposal__WithReason`
* restored double linebreaks in descriptions to render paragraphs properly in generated documentation
@tworec tworec force-pushed the stranger80/market-api-events branch from 5738047 to 27bdc52 Compare November 5, 2020 20:25
responses:
'200':
200:
description: Agreement approval result.
content:
application/json:
schema:
type: string
enum: [Approved, Rejected, Cancelled]
Copy link
Contributor

Choose a reason for hiding this comment

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

@nieznanysprawiciel the solution for your concern is to return here a single event, but then we will not be back compatible, so it is not possible in this PR which is meant for Alpha.3

                $ref: '#/components/schemas/AgreementEvent'

Copy link
Contributor

@nieznanysprawiciel nieznanysprawiciel Nov 9, 2020

Choose a reason for hiding this comment

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

and in ApproveAgreement on Provider

Copy link
Contributor

Choose a reason for hiding this comment

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

postponed to #53

- $ref: 'common.yaml#/parameters/pollTimeout'
- $ref: 'common.yaml#/parameters/afterTimestamp'
- $ref: 'common.yaml#/parameters/maxEvents'
- $ref: 'common.yaml#/parameters/appSessionId'
Copy link
Contributor

@tworec tworec Nov 9, 2020

Choose a reason for hiding this comment

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

To enable querying only for events regarding single agreement

Suggested change
- $ref: 'common.yaml#/parameters/appSessionId'
- $ref: 'common.yaml#/parameters/appSessionId'
- $ref: '#/components/parameters/queryAgreementId'

@@ -827,27 +967,33 @@ components:

Copy link
Contributor

Choose a reason for hiding this comment

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

To enable querying only for events regarding a single agreement

Suggested change
queryAgreementId:
name: agreementId
description: Used to enable querying agreement events related to a single agreement.
in: query
required: false
schema:
type: string

Copy link
Contributor

@nieznanysprawiciel nieznanysprawiciel Nov 9, 2020

Choose a reason for hiding this comment

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

For sure it is worth considering, because we have no easy way to query, for example, termination reason for specific Agreement, without querying all events, even these unrelated.
But note that adding new optional filter to endpoint is backward compatible change, so I suggest to postpone these changes for later and investigate other options.

Copy link
Contributor

Choose a reason for hiding this comment

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

postponed to #53

Copy link
Contributor

@tworec tworec left a comment

Choose a reason for hiding this comment

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

marked all comments postponed to #53 to easily find them when we need

@@ -827,27 +967,33 @@ components:

Copy link
Contributor

Choose a reason for hiding this comment

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

postponed to #53

responses:
'200':
200:
description: Agreement approval result.
content:
application/json:
schema:
type: string
enum: [Approved, Rejected, Cancelled]
Copy link
Contributor

Choose a reason for hiding this comment

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

postponed to #53

proposal: Proposal,
},
#[serde(rename = "ProposalRejectedEvent")]
ProposalRejectedEvent {
Copy link
Contributor

Choose a reason for hiding this comment

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

postponed to #53

@tworec tworec merged commit fe426ad into master Nov 9, 2020
Mkt & Prov (Yagna Core) automation moved this from In progress to Done Nov 9, 2020
@tworec tworec deleted the stranger80/market-api-events branch November 9, 2020 13:35
@tworec tworec restored the stranger80/market-api-events branch November 10, 2020 13:02
@nieznanysprawiciel nieznanysprawiciel moved this from Done to Archive in Mkt & Prov (Yagna Core) Nov 12, 2020
@tworec tworec deleted the stranger80/market-api-events branch December 11, 2020 10:53
@tworec tworec moved this from Archive to Done in Mkt & Prov (Yagna Core) Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants