Skip to content

Commit e96ad59

Browse files
committed
Updated openapi spec
Signed-off-by: Jim Zhang <[email protected]>
1 parent fd8372a commit e96ad59

File tree

3 files changed

+38
-3
lines changed

3 files changed

+38
-3
lines changed

internal/events/api/event.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const (
2222
EventPayloadType_Bytes = "bytes" // default data type of the event payload, no special processing is done before returning to the subscribing client
2323
EventPayloadType_String = "string" // event payload will be an UTF-8 encoded string
2424
EventPayloadType_StringifiedJSON = "stringifiedJSON" // event payload will be a structured map with UTF-8 encoded string values
25+
EventPayloadType_JSON = "json" // equivalent to "stringifiedJSON"
2526
)
2627

2728
// persistedFilter is the part of the filter we record to storage
@@ -52,7 +53,7 @@ type SubscriptionInfo struct {
5253
Signer string `json:"signer"`
5354
FromBlock string `json:"fromBlock,omitempty"`
5455
Filter persistedFilter `json:"filter"`
55-
PayloadType string `json:"payloadType,omitempty"` // optional. data type of the payload bytes; "bytes", "string" or "stringifiedJSON". Default to "bytes"
56+
PayloadType string `json:"payloadType,omitempty"` // optional. data type of the payload bytes; "bytes", "string" or "stringifiedJSON/json". Default to "bytes"
5657
}
5758

5859
// GetID returns the ID (for sorting)

internal/events/evtprocessor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func (ep *evtProcessor) processEventEntry(subInfo *api.SubscriptionInfo, entry *
7373
switch payloadType {
7474
case api.EventPayloadType_String:
7575
entry.Payload = string(entry.Payload.([]byte))
76-
case api.EventPayloadType_StringifiedJSON:
76+
case api.EventPayloadType_StringifiedJSON, api.EventPayloadType_JSON:
7777
structuredMap := make(map[string]interface{})
7878
err := json.Unmarshal(entry.Payload.([]byte), &structuredMap)
7979
if err != nil {

openapi/spec.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,10 +393,44 @@ components:
393393
enum:
394394
- websocket
395395
- webhook
396+
default: websocket
396397
websocket:
397398
oneOf:
398399
- $ref: "#/components/schemas/websocket_info"
399400
- $ref: "#/components/schemas/webhook_info"
401+
suspended:
402+
type: boolean
403+
default: false
404+
description: if set to 'true', the stream will be suspended
405+
batchSize:
406+
type: integer
407+
default: 1
408+
description: how many events should be packed in each event batch to deliver to the client. Range is 1-1000
409+
batchTimeoutMS:
410+
type: integer
411+
default: 5000
412+
description: if there are pending events to deliver, but the batch size has not been reached, this is the maximum amount of milliseconds to wait before delivering the current batch
413+
errorHandling:
414+
type: string
415+
description: when the delivery should be blocked when the event listener client failed to take delivery, or skip and continue
416+
enum:
417+
- block
418+
- skip
419+
default: skip
420+
retryTimeoutSec:
421+
type: integer
422+
description: total amount of time (in seconds) to retry a failed event delivery
423+
blockedReryDelaySec:
424+
type: integer
425+
description: amount of time (in seconds) to wait before retrying a failed delivery
426+
timestamps:
427+
type: boolean
428+
default: false
429+
description: Chaincode events from Fabric do not contain timestamps. If set to 'true', FabConnect to make a call to Fabric to download the block to obtain the timestamp, and set on the event. Note doing this incurs time overhead in events processing
430+
timestampCacheSize:
431+
type: integer
432+
default: 1000
433+
description: The size of the internal cache for the blocknumber <-> timestamp map
400434
subscription_input:
401435
type: "object"
402436
properties:
@@ -416,7 +450,7 @@ components:
416450
type: string
417451
default: string
418452
enum:
419-
- stringifiedJSON
453+
- json
420454
- string
421455
filter:
422456
type: object

0 commit comments

Comments
 (0)