Skip to content

fix: align event subscription/notification to Commonalities r3.2#84

Open
mohdfarhanakram wants to merge 2 commits intocamaraproject:mainfrom
mohdfarhanakram:fix/align-event-subscription-commonalities-r3.2
Open

fix: align event subscription/notification to Commonalities r3.2#84
mohdfarhanakram wants to merge 2 commits intocamaraproject:mainfrom
mohdfarhanakram:fix/align-event-subscription-commonalities-r3.2

Conversation

@mohdfarhanakram
Copy link
Copy Markdown
Contributor

What type of PR is this?

correction

What this PR does / why we need it:

Aligns the Session Insights API event subscription and notification model to the CAMARA Commonalities r3.2 Event Subscription and Notification Guide.

  • Aligned sink definition with URI format, HTTPS pattern validation, and example
  • Replaced plain string sinkCredential with proper SinkCredential object schema (with AccessTokenCredential, PlainCredential, RefreshTokenCredential subtypes)
  • Added 400 INVALID_SINK error response (along with INVALID_CREDENTIAL, INVALID_TOKEN, INVALID_ARGUMENT) with examples
  • Renamed subscription-endssubscription-ended with terminationReason enum (NETWORK_TERMINATED, SUBSCRIPTION_EXPIRED, MAX_EVENTS_REACHED, ACCESS_TOKEN_EXPIRED, SUBSCRIPTION_DELETED)
  • Added subscription-started lifecycle event with initiationReason
  • Added subscription-updated lifecycle event with updateReason
  • Renamed EventTypeSubscriptionEventType with description
  • Fixed types / subscribedEventTypes property name mismatch in SessionRequest (required field referenced non-existent property)
  • Added SubscriptionStatus enum (ACTIVATION_REQUESTED, ACTIVE, INACTIVE, EXPIRED, DELETED)
  • Renamed startTimestartsAt per r3.2 convention
  • Removed sinkCredential from response schemas (must not be returned per security guidelines)

Which issue(s) this PR fixes:

Fixes #70

Special notes for reviewers:

  • Credential schemas (SinkCredential, AccessTokenCredential, etc.) follow the exact same pattern used in QualityOnDemand
  • MQTT protocol support is kept as-is but sink credential now uses the proper object schema for both HTTP and MQTT
  • The subscribedEventTypestypes fix also corrects a bug where SessionRequest.required referenced a non-existent property name

Changelog input

Aligned event subscription/notification model to Commonalities r3.2. Added SinkCredential schemas, subscription lifecycle events, SubscriptionEventType enum, SubscriptionStatus, and INVALID_SINK error response.

Additional documentation

Kevsy
Kevsy previously approved these changes Apr 7, 2026
Copy link
Copy Markdown
Contributor

@Kevsy Kevsy 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
Copy Markdown
Contributor

@benhepworth benhepworth left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @mohdfarhanakram - great progress aligning with Commonalities r3.2. Most everything is pretty solid - just a few recommendations that I added in-line. Summary of these recommendations:

  • suggest renaming BadRequest400 to CreateSessionBadRequest400 and then creating a new Generic400 for the other calls since the sink specific errors only apply when creating a session (see model QoD uses for reference)
  • question about uri for http/mqtt - http is a URI but not technically for mqtt, which is why the original was a string - needs more discussion with the group, will address on the next call.
  • made status required in SessionBase since there should always be a current state of the subscription (equivalent of QoD qosStatus, which is required in it's SessionInfo).

$ref: "#/components/schemas/Protocol"
sink:
type: string
format: uri
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should discuss this more - the reason it was originally a string is because a MQTT topic is not technically a URI by definition.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

will look up in Commonalities to align with that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should leave this as a string for the generic SessionBase.sink since both HTTP and MQTT share it -- and add format:uri to HTTPSessionRequest.sink

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated - removed format: URI from SessionBase.sink so it stays as a plain string (since MQTT topics aren't URIs). HTTPSessionRequest.sink retains format: URI as expected.

- Align sink and sinkCredential definitions to CAMARA Event Guide
- Add SinkCredential, AccessTokenCredential, PlainCredential, RefreshTokenCredential schemas
- Add sink URI pattern validation and 400 INVALID_SINK error response
- Rename subscription-ends to subscription-ended with terminationReason enum
- Add subscription-started and subscription-updated lifecycle events
- Rename EventType to SubscriptionEventType
- Fix types/subscribedEventTypes property name mismatch in SessionRequest
- Add SubscriptionStatus enum to SessionBase
- Rename startTime to startsAt per r3.2 convention
- Remove sinkCredential from response schemas (security compliance)
@mohdfarhanakram mohdfarhanakram force-pushed the fix/align-event-subscription-commonalities-r3.2 branch from 777f0d1 to 6119f83 Compare April 10, 2026 02:37
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.

Align event subscription/notification to Commonalities r3.2

3 participants