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

Update the geofencing subscription models to align on CAMARA commonalities #202

Merged

Conversation

@maxl2287 maxl2287 changed the title update the geofencing subscription models to align on CAMARA commonalities Update the geofencing subscription models to align on CAMARA commonalities Jun 6, 2024
@maxl2287
Copy link
Contributor Author

maxl2287 commented Jun 7, 2024

@bigludo7 @jlurien

What are we doing about this here?
Are we setting here a maximum of 1 for now?
Because we are not yet supporting multiple types, as this would be maybe an own PR / issue.

Wdyt?

        types:
          description: |
            Camara Event types eligible to be delivered by this subscription.
            Note: for the Commonalities meta-release v0.4 we enforce to have only event type per subscription then for following meta-release use of array MUST be decided
             at API project level.
          type: array
          items:
            $ref: "#/components/schemas/SubscriptionEventType"

@bigludo7
Copy link
Collaborator

bigludo7 commented Jun 7, 2024

@bigludo7 @jlurien

What are we doing about this here? Are we setting here a maximum of 1 for now? Because we are not yet supporting multiple types, as this would be maybe an own PR / issue.

Wdyt?

        types:
          description: |
            Camara Event types eligible to be delivered by this subscription.
            Note: for the Commonalities meta-release v0.4 we enforce to have only event type per subscription then for following meta-release use of array MUST be decided
             at API project level.
          type: array
          items:
            $ref: "#/components/schemas/SubscriptionEventType"

I think we can add this maximum:1 in our yaml. The template in commonalities is generic and should live for more than one release. Here we're crafting an yaml for implementation so better to be straightforward.
@jlurien @alpaycetin74 different view?

bigludo7
bigludo7 previously approved these changes Jun 10, 2024
Copy link
Collaborator

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

LGFM !
Thanks Max

@jlurien
Copy link
Collaborator

jlurien commented Jun 12, 2024

@bigludo7 @jlurien
What are we doing about this here? Are we setting here a maximum of 1 for now? Because we are not yet supporting multiple types, as this would be maybe an own PR / issue.
Wdyt?

        types:
          description: |
            Camara Event types eligible to be delivered by this subscription.
            Note: for the Commonalities meta-release v0.4 we enforce to have only event type per subscription then for following meta-release use of array MUST be decided
             at API project level.
          type: array
          items:
            $ref: "#/components/schemas/SubscriptionEventType"

I think we can add this maximum:1 in our yaml. The template in commonalities is generic and should live for more than one release. Here we're crafting an yaml for implementation so better to be straightforward. @jlurien @alpaycetin74 different view?

I agree to setting the maximum to 1 in this version as that will impose implementations to follow the agreed current limit.

Copy link
Collaborator

@jlurien jlurien left a comment

Choose a reason for hiding this comment

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

I think we should include in our spec for this version the values that are allowed: protocol=HTTP, credentialType=ACCESSTOKEN and remove the content for all other options which are not applicable.

code/API_definitions/geofencing-subscriptions.yaml Outdated Show resolved Hide resolved
code/API_definitions/geofencing-subscriptions.yaml Outdated Show resolved Hide resolved
@jlurien
Copy link
Collaborator

jlurien commented Jun 12, 2024

FYI, @PedroDiez, as you have been more involved than me in this track in Commonalities

@alpaycetin74
Copy link
Collaborator

@bigludo7 @jlurien
What are we doing about this here? Are we setting here a maximum of 1 for now? Because we are not yet supporting multiple types, as this would be maybe an own PR / issue.
Wdyt?

        types:
          description: |
            Camara Event types eligible to be delivered by this subscription.
            Note: for the Commonalities meta-release v0.4 we enforce to have only event type per subscription then for following meta-release use of array MUST be decided
             at API project level.
          type: array
          items:
            $ref: "#/components/schemas/SubscriptionEventType"

I think we can add this maximum:1 in our yaml. The template in commonalities is generic and should live for more than one release. Here we're crafting an yaml for implementation so better to be straightforward. @jlurien @alpaycetin74 different view?

Yes, I find maximum=1 reasonable. Thank you.

@jlurien
Copy link
Collaborator

jlurien commented Jun 13, 2024

@bigludo7, as you are also adopting the subscription model to other APIs, what is the agreement in Commonalities? Are we supposed to use the common artifact in Commonalities, as it is, even with the options which are not applicable to the current version, or APIs can make adjustments? I suggested to remove protocols and credentialTypes which are not supported but Pedro told me that the agreement was to include all options from the beginning and specify errors for options not applicable.

@PedroDiez
Copy link

Hi all,

This is my understading about the agreement in commonalities: @bigludo7, @shilpa-padgaonkar, @rartych

  • Artifact, is a common baseline to be reused as-is in any API (in APIs with Instance-based (implicit) subscription, only applies sink and sinkCredential Model). That was the reason to model all the variants of Cloudevents and to add specific exceptions to address current simplifications. Benefit is that we will not need to update each time the model and avoid breaking-changes in the future.
  • If the template is not followed, then it is not a template and probably this will generate confusion and misalignments between Subproyects

cc @maxl2287

@bigludo7
Copy link
Collaborator

Hi all,

I'm globally aligned with https://github.com/PedroDiez statement... but I should confess one contradiction (with myself ...ouch) because I was also fine to add this max set to 1 for the attribute types to be perfectly explicit to have only one event type per subscription for this release.

For the protocol & tokenType I prefer to keep this in this yaml as defined in the template.

@jlurien
Copy link
Collaborator

jlurien commented Jun 13, 2024

Hi all,

I'm globally aligned with https://github.com/PedroDiez statement... but I should confess one contradiction (with myself ...ouch) because I was also fine to add this max set to 1 for the attribute types to be perfectly explicit to have only one event type per subscription for this release.

For the protocol & tokenType I prefer to keep this in this yaml as defined in the template.

Indeed I read first the issue about adding the maximum even if it was not in the artifact, and I thought that the same criteria would apply to the rest of non-applicable stuff for this version :-) I think we should have a consistent approach for this, as other APIs may choose to not add the maximum, and that would create inconsistency.

IMO, commonalities versions should reflect what is applicable to each version, and they will evolve as we support more options, but if the agreement is to model the operations as in the template, we should stick to whatever it is in the artifact for this version.

@maxl2287
Copy link
Contributor Author

maxl2287 commented Jun 13, 2024

Indeed I read first the issue about adding the maximum even if it was not in the artifact, and I thought that the same criteria would apply to the rest of non-applicable stuff for this version :-) I think we should have a consistent approach for this, as other APIs may choose to not add the maximum, and that would create inconsistency.

IMO, commonalities versions should reflect what is applicable to each version, and they will evolve as we support more options, but if the agreement is to model the operations as in the template, we should stick to whatever it is in the artifact for this version.

@jlurien - about maximum of types,
As it is written in the Commonalities-template:

        types:
          description: |
            Camara Event types eligible to be delivered by this subscription.
            Note: for the Commonalities meta-release v0.4 we enforce to have only event type per subscription then for following meta-release use of array MUST be decided
             at API project level.
          type: array
          items:
            type: string

(https://github.com/camaraproject/Commonalities/blob/main/artifacts/camara-cloudevents/event-subscription-template.yaml#L305C1-L312C25)

Or in API design guidelines:

Note: An array of types could be passed but as of now only one value MUST passed. Use of multiple value will be open later at API level.

Based on this notes it seems to be limited to a maximum of one item in the array (as of now).

(see https://github.com/camaraproject/Commonalities/blob/main/documentation/API-design-guidelines.md#resource-based-explicit-subscription)

So in my PoV we could set here a limit of 1.

And when we want to support multiple Types, we can still create an own issue for it.

Wdyt @jlurien @bigludo7
cc @PedroDiez @alpaycetin74

@maxl2287
Copy link
Contributor Author

maxl2287 commented Jun 13, 2024

@PedroDiez @jlurien @bigludo7
What about setting a minimum of Items to 1?
minItems: 1

Because otherwise it would also be possible to provide an empty array (what is I guess not the expectation, when creating subscriptions)

I have created an issue for that: camaraproject/Commonalities#235

@jlurien
Copy link
Collaborator

jlurien commented Jun 13, 2024

If that was the decision, I'm OK with keeping all unused values for protocol and credentialType. There are specific examples for errors INVALID_PROTOCOL and INVALID_CREDENTIAL for those. There is no specific code for the case when more that one event, or zero items, are sent, so it makes even more sense to add the limits minItems, maxItems in the schema, and rely on the generic 400 INVALID_ARGUMENT when a request body is not compliant.

@bigludo7
Copy link
Collaborator

Agreed also with @maxl2287 proposal for the min. I will take care of this one in Commonalities !

@maxl2287 maxl2287 force-pushed the feature/update-camara-subscriptions-model branch from 6a89f4f to d5b22fc Compare June 17, 2024 08:32
@maxl2287 maxl2287 self-assigned this Jun 17, 2024
@maxl2287
Copy link
Contributor Author

@jlurien & @bigludo7 ready to be reviewed again :)

bigludo7
bigludo7 previously approved these changes Jun 18, 2024
Copy link
Collaborator

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

LGTM/
For simplicity probably good to manage device identifier update defined in PR213 in another issue/PR.

@maxl2287 maxl2287 requested a review from bigludo7 June 18, 2024 20:09
Copy link
Collaborator

@bigludo7 bigludo7 left a comment

Choose a reason for hiding this comment

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

LGTM/

Copy link
Collaborator

@jlurien jlurien left a comment

Choose a reason for hiding this comment

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

LGTM

@bigludo7
Copy link
Collaborator

bigludo7 commented Jul 1, 2024

@maxl2287 We can merge this one, correct?

@maxl2287
Copy link
Contributor Author

maxl2287 commented Jul 1, 2024

@bigludo7 I am finished. So yes. :)

@bigludo7 bigludo7 merged commit 6480462 into camaraproject:main Jul 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants