camaraproject / DeviceLocation

Repository to describe, develop, document and test the DeviceLocation API family
Apache License 2.0
20 stars 31 forks source link

"subject" - parameter is missing in CloudEvents #187

Closed maxl2287 closed 2 months ago

maxl2287 commented 2 months ago

Problem description The "subject" is an optional field used for CloudEvents. Even when it's not used for CAMARA notifications, it's mandatory to be set in some Event-Hub services.

Expected behavior Add the "subject" as optional parameter

    CloudEvent:
      description: The Cloud-Event used for the callback.
      type: object
      required:
        - id
        - source
        - type
        - specversion
        - time
      properties:
        id:
          description: Identifier of this event, that must be unique in the source context.
          type: string
       subject:
          description: Describes the subject of the event
          type: string
        source:
          $ref: "#/components/schemas/Source"
        type:
          $ref: "#/components/schemas/NotificationEventType"
        specversion:
          description: Version of the specification to which this event conforms (must be 1.0 if it conforms to cloudevents 1.0.2 version)
          type: string
          enum:
            - "1.0"
        datacontenttype:
          description: 'media-type that describes the event payload encoding, must be "application/json" for CAMARA APIs'
          type: string
          enum:
            - application/json
        time:
          $ref: "#/components/schemas/EventTime"
      discriminator:
        propertyName: "type"
        mapping:
          org.camaraproject.geofencing.v0.area-left: "#/components/schemas/EventAreaLeft"
          org.camaraproject.geofencing.v0.area-entered: "#/components/schemas/EventAreaEntered"
          org.camaraproject.geofencing.v0.subscription-ends: "#/components/schemas/EventSubscriptionEnds"

Reference

https://github.com/camaraproject/Commonalities/blob/main/documentation/API-design-guidelines.md#122-event-notification

jlurien commented 2 months ago

Hi,

In the guidelines it is said:

name type attribute description cardinality
subject string describes the subject of the event - Not used in CAMARA notification. optional

We should align this in the guidelines. Either we keep it in the schema as optional and remove the "Not used in CAMARA notification.", or we keep the current schema without subject.

Are other APIs documenting subject?

maxl2287 commented 2 months ago

Hi,

In the guidelines it is said:

name type attribute description cardinality subject string describes the subject of the event - Not used in CAMARA notification. optional We should align this in the guidelines. Either we keep it in the schema as optional and remove the "Not used in CAMARA notification.", or we keep the current schema without subject.

Are other APIs documenting subject?

No I haven't find any API, which has defined "subject".

But in the Guidelines it's also written as:

For consistency across CAMARA APIs, the uniform CloudEvents model must be used with following rules:

So in my understanding the model has to be used like described in the table and needs to offer the possibility to set an optional "subject".

maxl2287 commented 2 months ago

I will close this issue. The subject can be left empty as I mixed up "subject" with "source".

The "source" cannot be empty on the external provider (of course), but this is already defined in this spec.

My fault! 😸