Skip to content

Commit

Permalink
Update default schema versions for the Sendgrid adapter to 3-0-0 (close
Browse files Browse the repository at this point in the history
  • Loading branch information
matus-tomlein authored and benjben committed Sep 7, 2023
1 parent a3c7fd6 commit e2848ab
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 115 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Schema for a SendGrid processed event. Property descriptions derived from the SendGrid documentation: https://sendgrid.com/docs/for-developers/tracking-events/event/",
"self": {
"vendor": "com.sendgrid",
"name": "processed",
"version": "3-0-0",
"format": "jsonschema"
},
"type": "object",
"properties": {
"timestamp": {
"description": "The timestamp of when the message was sent",
"type": "string",
"format": "date-time"
},
"email": {
"description": "The email address of the recipient",
"type": "string",
"maxLength": 320
},
"newsletter": {
"description": "Legacy Marketing Email tool fields",
"type": "object",
"properties": {
"newsletter_user_list_id": {
"type": "string"
},
"newsletter_id": {
"type": "string"
},
"newsletter_send_id": {
"type": "string"
}
},
"additionalProperties": true
},
"sg_event_id": {
"description": "A unique ID to this event that you can use for deduplication purposes. These IDs are up to 100 characters long and are URL safe.",
"type": "string",
"minLength": 22,
"maxLength": 4096
},
"smtp-id": {
"description": "A unique ID attached to the message by the originating system",
"type": "string"
},
"category": {
"description": "Categories are custom tags that you set for the purpose of organizing your emails. Categories can be set as an array or string, and they will be returned as such when posted in your event endpoint.",
"type": ["array", "string"],
"items": {
"type": "string"
}
},
"asm_group_id": {
"description": "The ID of the unsubscribe group the recipient’s email address is included in. ASM IDs correspond to the ID that is returned when you create an unsubscribe group.",
"type": "integer",
"minimum": 0,
"maximum": 9223372036854775807
},
"sg_message_id": {
"description": "A unique, internal SendGrid ID for the message. The first half of this is pulled from the smtp-id.",
"type": "string"
},
"send_at": {
"description": "To schedule a send request for a large batch of emails, use the send_at parameter which will send all emails at approximately the same time. send_at is a UNIX timestamp.",
"type": "integer",
"maximum": 2147483647,
"minimum": 0
},
"marketing_campaign_id": {
"description": "For emails sent through our Marketing Campaigns feature, we add Marketing Campaigns specific parameters to the Event Webhook. Both marketing_campaign_name and marketing_campaign_id are displayed as unique arguments in the event data.",
"type": "integer"
},
"marketing_campaign_name": {
"description": "For emails sent through our Marketing Campaigns feature, we add Marketing Campaigns specific parameters to the Event Webhook. Both marketing_campaign_name and marketing_campaign_id are displayed as unique arguments in the event data.",
"type": "string"
},
"marketing_campaign_version": {
"description": "Displayed in the event data for emails sent as part of an A/B Test. The value for marketing_campaign_version are returned as A, B, C, etc.",
"type": "string"
},
"marketing_campaign_split_id": {
"description": "Marketing campaign split id",
"type": "integer"
}
},
"additionalProperties": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class SendgridAdapterSpec extends Specification with CatsIO {
"event_vendor" -> "com.sendgrid",
"event_name" -> "processed",
"event_format" -> "jsonschema",
"event_version" -> "2-0-0",
"event_version" -> "3-0-0",
"event" -> "unstruct",
"unstruct_event" -> json"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/processed/jsonschema/2-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"sZROwMGMagFgnOEmSdvhig==","smtp-id":"<14c5d75ce93.dfd.64b469@ismtpd-555>","marketing_campaign_version":"B","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}""".noSpaces
"unstruct_event" -> json"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/processed/jsonschema/3-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"sZROwMGMagFgnOEmSdvhig==","smtp-id":"<14c5d75ce93.dfd.64b469@ismtpd-555>","marketing_campaign_version":"B","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}""".noSpaces
)
BlackBoxTesting.runTest(input, expected)
}
Expand Down
22 changes: 11 additions & 11 deletions modules/common/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@
"incident_notify_of_close": "iglu:com.pingdom/incident_notify_of_close/jsonschema/1-0-0"
},
"sendgrid": {
"processed": "iglu:com.sendgrid/processed/jsonschema/2-0-0",
"dropped": "iglu:com.sendgrid/dropped/jsonschema/2-0-0",
"delivered": "iglu:com.sendgrid/delivered/jsonschema/2-0-0",
"deferred": "iglu:com.sendgrid/deferred/jsonschema/2-0-0",
"bounce": "iglu:com.sendgrid/bounce/jsonschema/2-0-0",
"open": "iglu:com.sendgrid/open/jsonschema/2-0-0",
"click": "iglu:com.sendgrid/click/jsonschema/2-0-0",
"spamreport": "iglu:com.sendgrid/spamreport/jsonschema/2-0-0",
"unsubscribe": "iglu:com.sendgrid/unsubscribe/jsonschema/2-0-0",
"group_unsubscribe": "iglu:com.sendgrid/group_unsubscribe/jsonschema/2-0-0",
"group_resubscribe": "iglu:com.sendgrid/group_resubscribe/jsonschema/2-0-0"
"processed": "iglu:com.sendgrid/processed/jsonschema/3-0-0",
"dropped": "iglu:com.sendgrid/dropped/jsonschema/3-0-0",
"delivered": "iglu:com.sendgrid/delivered/jsonschema/3-0-0",
"deferred": "iglu:com.sendgrid/deferred/jsonschema/3-0-0",
"bounce": "iglu:com.sendgrid/bounce/jsonschema/3-0-0",
"open": "iglu:com.sendgrid/open/jsonschema/3-0-0",
"click": "iglu:com.sendgrid/click/jsonschema/3-0-0",
"spamreport": "iglu:com.sendgrid/spamreport/jsonschema/3-0-0",
"unsubscribe": "iglu:com.sendgrid/unsubscribe/jsonschema/3-0-0",
"group_unsubscribe": "iglu:com.sendgrid/group_unsubscribe/jsonschema/3-0-0",
"group_resubscribe": "iglu:com.sendgrid/group_resubscribe/jsonschema/3-0-0"
},
"statusgator": {
"status_change": "iglu:com.statusgator/status_change/jsonschema/1-0-0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,17 @@ object SpecHelpers {
)

val sendgridSchemas = SendgridSchemas(
processed = "iglu:com.sendgrid/processed/jsonschema/2-0-0",
dropped = "iglu:com.sendgrid/dropped/jsonschema/2-0-0",
delivered = "iglu:com.sendgrid/delivered/jsonschema/2-0-0",
bounce = "iglu:com.sendgrid/bounce/jsonschema/2-0-0",
deferred = "iglu:com.sendgrid/deferred/jsonschema/2-0-0",
open = "iglu:com.sendgrid/open/jsonschema/2-0-0",
click = "iglu:com.sendgrid/click/jsonschema/2-0-0",
unsubscribe = "iglu:com.sendgrid/unsubscribe/jsonschema/2-0-0",
group_unsubscribe = "iglu:com.sendgrid/group_unsubscribe/jsonschema/2-0-0",
group_resubscribe = "iglu:com.sendgrid/group_resubscribe/jsonschema/2-0-0",
spamreport = "iglu:com.sendgrid/spamreport/jsonschema/2-0-0"
processed = "iglu:com.sendgrid/processed/jsonschema/3-0-0",
dropped = "iglu:com.sendgrid/dropped/jsonschema/3-0-0",
delivered = "iglu:com.sendgrid/delivered/jsonschema/3-0-0",
bounce = "iglu:com.sendgrid/bounce/jsonschema/3-0-0",
deferred = "iglu:com.sendgrid/deferred/jsonschema/3-0-0",
open = "iglu:com.sendgrid/open/jsonschema/3-0-0",
click = "iglu:com.sendgrid/click/jsonschema/3-0-0",
unsubscribe = "iglu:com.sendgrid/unsubscribe/jsonschema/3-0-0",
group_unsubscribe = "iglu:com.sendgrid/group_unsubscribe/jsonschema/3-0-0",
group_resubscribe = "iglu:com.sendgrid/group_resubscribe/jsonschema/3-0-0",
spamreport = "iglu:com.sendgrid/spamreport/jsonschema/3-0-0"
)

val googleAnalyticsSchemas = GoogleAnalyticsSchemas(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers {
)

val expectedJson =
"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/processed/jsonschema/2-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"sZROwMGMagFgnOEmSdvhig==","smtp-id":"\u003c14c5d75ce93.dfd.64b469@ismtpd-555\u003e","marketing_campaign_version":"B","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}"""
"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/processed/jsonschema/3-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"sZROwMGMagFgnOEmSdvhig==","smtp-id":"\u003c14c5d75ce93.dfd.64b469@ismtpd-555\u003e","marketing_campaign_version":"B","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}"""

val actual = adapterWithDefaultSchemas.toRawEvents(payload, SpecHelpers.client)
actual must beValid(
Expand Down Expand Up @@ -575,7 +575,7 @@ class SendgridAdapterSpec extends Specification with ValidatedMatchers {
val expectedJsonProcessed =
"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.custom/processed/jsonschema/1-2-3","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"sZROwMGMagFgnOEmSdvhig==","smtp-id":"\u003c14c5d75ce93.dfd.64b469@ismtpd-555\u003e","marketing_campaign_version":"B","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}"""
val expectedJsonDeferred =
"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/deferred/jsonschema/2-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"jWmZXTZbtHTV2-S47asrww==","smtp-id":"<14c5d75ce93.dfd.64b469@ismtpd-555>","marketing_campaign_version":"B","response":"400 try again later","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","attempt":"5","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}"""
"""{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.sendgrid/deferred/jsonschema/3-0-0","data":{"timestamp":"2015-11-03T11:20:15.000Z","email":"[email protected]","marketing_campaign_name":"campaign name","sg_event_id":"jWmZXTZbtHTV2-S47asrww==","smtp-id":"<14c5d75ce93.dfd.64b469@ismtpd-555>","marketing_campaign_version":"B","response":"400 try again later","marketing_campaign_id":12345,"marketing_campaign_split_id":13471,"category":"cat facts","attempt":"5","sg_message_id":"14c5d75ce93.dfd.64b469.filter0001.16648.5515E0B88.0"}}}"""

val actual = adapter.toRawEvents(payload, SpecHelpers.client)
actual must beValid(
Expand Down

0 comments on commit e2848ab

Please sign in to comment.