camaraproject / DeviceStatus

Repository to describe, develop, document and test the Device Status API family
Apache License 2.0
11 stars 33 forks source link

Use simple string for "type" in CloudEvent #107

Closed maxl2287 closed 5 months ago

maxl2287 commented 8 months ago

Problem description I am looking from a developer POV and we are using code-generators to generate the code based on the CAMARA specifications. When generating enums, e.g. here SubscriptionEventType, they will be generated like

  ROAMING_STATUS("org.camaraproject.device-status.v0.roaming-status"),

  ROAMING_ON("org.camaraproject.device-status.v0.roaming-on"),

  ROAMING_OFF("org.camaraproject.device-status.v0.roaming-off"),

  ....

The in the spec described enums cannot be used in the CloudEvent, as we want here the String (e.g. org.camaraproject.device-status.v0.roaming-status).

    SubscriptionEventType:
      type: string
      description: |
        roaming-status - Event triggered when the device switch from roaming ON to roaming OFF and conversely

        roaming-on - Event triggered when the device switch from roaming OFF to roaming ON

        roaming-off - Event triggered when the device switch from roaming ON to roaming OFF

        roaming-change-country - Event triggered when the device in roaming change country code

        connectivity-data - Event triggered when the device is connected to the network for Data usage.

        connectivity-sms - Event triggered when the device is connected to the network for SMS usage

        connectivity-disconnected - Event triggered when the device is not connected.

        subscription-ends - Event triggered when the subscription is terminated
      enum:
        - org.camaraproject.device-status.v0.roaming-status
        - org.camaraproject.device-status.v0.roaming-on
        - org.camaraproject.device-status.v0.roaming-off
        - org.camaraproject.device-status.v0.roaming-change-country
        - org.camaraproject.device-status.v0.connectivity-data
        - org.camaraproject.device-status.v0.connectivity-sms
        - org.camaraproject.device-status.v0.connectivity-disconnected
        - org.camaraproject.device-status.v0.subscription-ends

    CloudEvent:
      <...>
      properties:
       <...>
        type:
          $ref: "#/components/schemas/SubscriptionEventType"

Possible evolution With this change we are not forced anymore to provide a Enum (e.g. ROAMING_STATUS), but can use the value of this enum (e.g. org.camaraproject.device-status.v0.roaming-status)

        type:
          type: string
          description: Specifies the type of event for which the event will be sent.
sachinvodafone commented 8 months ago

I have requested our DevOps team to confirm if they encounter the same challenge. I will provide confirmation on this matter soon.

maxl2287 commented 7 months ago

@sachinvodafone any new information from the DevOps-team? @akoshunyadi / @bigludo7 can we talk about that again to just make the type as "string" in CloudEvent?

shilpa-padgaonkar commented 7 months ago

https://github.com/camaraproject/Commonalities/issues/149

bigludo7 commented 5 months ago

@maxl2287 my colleague Patrice put a comment here: https://github.com/camaraproject/Commonalities/issues/159 Very interested on your feedback ... in order to understand the issue.

maxl2287 commented 5 months ago

@maxl2287 my colleague Patrice put a comment here: camaraproject/Commonalities#159 Very interested on your feedback ... in order to understand the issue.

Commented on that as well.

maxl2287 commented 5 months ago

I will close this issue as it was already discussed with @shilpa-padgaonkar.