-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update default schema versions for the Sendgrid adapter to 3-0-0 (close
#797)
- Loading branch information
1 parent
a3c7fd6
commit e2848ab
Showing
6 changed files
with
115 additions
and
115 deletions.
There are no files selected for viewing
89 changes: 0 additions & 89 deletions
89
...2/src/test/resources/iglu-client-embedded/schemas/com.sendgrid/processed/jsonschema/2-0-0
This file was deleted.
Oops, something went wrong.
89 changes: 89 additions & 0 deletions
89
...2/src/test/resources/iglu-client-embedded/schemas/com.sendgrid/processed/jsonschema/3-0-0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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( | ||
|
@@ -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( | ||
|