Skip to content

Commit

Permalink
Align event notification with CloudEvents spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jlurien committed Oct 6, 2023
1 parent efb1d23 commit 8dc6961
Showing 1 changed file with 48 additions and 68 deletions.
116 changes: 48 additions & 68 deletions code/API_definitions/qod-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -731,82 +731,52 @@ components:
- Tbps

EventNotification:
type: object
description: Event compliant with the CloudEvents specification
required:
- event
- id
- source
- specversion
- type
- time
properties:
event:
$ref: "#/components/schemas/Event"
eventSubscriptionId:
id:
description: Identifier of this event, that must be unique in the source context.
type: string
description: 'The ID of explicit subscription or none in case of implicit subscription'
example:
{
"event": {
"eventId": "5698d710-9b1b-4695-a958-7b228f08128c",
"eventType": "QOS_STATUS_CHANGED",
"eventTime": "2023-05-30T10:18:28Z",
"eventDetail": {
"sessionId": "7698d710-98b7-4695-a958-7b228f08128c",
"qosStatus": "UNAVAILABLE",
"statusInfo": "DURATION_EXPIRED"
}
}
}

Event:
description: The event being notified
type: object
required:
- eventType
- eventTime
properties:
eventId:
$ref: "#/components/schemas/EventId"
eventType:
$ref: "#/components/schemas/EventType"
eventTime:
$ref: "#/components/schemas/EventTime"
source:
description: Identifies the context in which an event happened in the specific Provider Implementation.
type: string
format: uri-reference
type:
description: The type of the event.
type: string
enum:
- 'org.camaraproject.sim-swap.v0.swapped'
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:
description: |
Timestamp of when the occurrence happened. It must follow RFC 3339
type: string
format: date-time
discriminator:
propertyName: eventType
propertyName: 'type'
mapping:
QOS_STATUS_CHANGED: "#/components/schemas/QosStatusChangedEvent"
example:
{
"eventId": "5698d710-9b1b-4695-a958-7b228f08128c",
"eventType": "QOS_STATUS_CHANGED",
"eventTime": "2023-05-30T10:18:28Z",
"eventDetail": {
"sessionId": "7698d710-98b7-4695-a958-7b228f08128c",
"qosStatus": "UNAVAILABLE",
"statusInfo": "DURATION_EXPIRED"
}
}

EventId:
type: string
format: uuid
example: 5698d710-9b1b-4695-a958-7b228f08128c
description: Unique identifier of the event
org.camaraproject.qod.v0.qos-status-changed: '#/components/schemas/EventQosStatusChanged'

Check failure on line 772 in code/API_definitions/qod-api.yaml

View workflow job for this annotation

GitHub Actions / MegaLinter

772:13 [indentation] wrong indentation: expected 10 but found 12

EventType:
type: string
enum:
- QOS_STATUS_CHANGED
description: Type of the event

EventTime:
type: string
format: date-time
example: 2023-05-30T10:18:28Z
description: Date time when the event occurred

QosStatusChangedEvent:
EventQosStatusChanged:
allOf:
- $ref: "#/components/schemas/Event"
- $ref: "#/components/schemas/EventNotification"
- type: object
properties:
eventDetail:
data:
type: object
description: Event details depending on the event type
required:
Expand All @@ -820,7 +790,17 @@ components:
statusInfo:
$ref: "#/components/schemas/StatusInfo"
required:
- eventDetail
- data
example:
id: 83a0d986-0866-4f38-b8c0-fc65bfcda452
source: 'https://api.example.com/qod/v0/sessions/123e4567-e89b-12d3-a456-426614174000'
specversion: '1.0'
type: 'org.camaraproject.qod.v0.qos-status-changed'
time: '2021-12-12T00:00:00Z'
data:
sessionId: '123e4567-e89b-12d3-a456-426614174000'
qosStatus: 'UNAVAILABLE'
statusInfo: 'DURATION_EXPIRED'

StatusInfo:
description: |
Expand Down

0 comments on commit 8dc6961

Please sign in to comment.