snowplow / enrich

Snowplow Enrichment jobs and library
https://snowplowanalytics.com
Other
21 stars 39 forks source link

SendGrid webhook: make schema configurable #791

Closed benjben closed 1 year ago

benjben commented 1 year ago

Context

network/json-schema-validator library uses a manually-maintained list of TLDs to validate the emails, which can cause the emails sent via SendGrid webhook to fail validation because their domain is not known.

A possible solution is to make the schema hard coded in Sendgrid adapter configurable.

Guide

Enrich has kind of 3 steps:

The configuration format (for example for Kinesis) is defined in here. We probably want to add a new section that could look like this :

"adapters": {
  "sendgrid": {
    "schema": "iglu://..."
  }
}

There are several sbt modules:

When running enrich-kinesis for instance, the starting point is here. It then goes here and then goes to common-fs2's Run here. It creates an Environment here. In our case we'll need to take the schema defined in the config and pass it to the AdapterRegistry here when creating the Environment