Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not decode iglu json webhook ue_pr paramter on coerce #144

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 0.7.2 (2024-06-26)
--------------------------
Do not decode iglu json webhook ue_pr paramter on coerce (close #144)

Version 0.7.1 (2024-06-18)
--------------------------
Make NVP codec isomorphic (close #143)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,13 @@ object payload {
cp
}
case e @ Payload.EnrichmentPayload(_, p) if p.vendor == "com.snowplowanalytics.iglu" =>
extractData(e)
.flatMap { case (schema, data) =>
data
.as[List[NVP]](json.nvpsDecoder)
.map(nvps => querystring.fromNVP(nvps :+ NVP("schema", Some(schema))))
.leftMap(err => UncoerciblePayload(e, err.toString))
}
.map { querystring =>
val cp = convert(p)
cp.querystring = querystring
cp
}

extractData(e).map { case (schema, data) =>
val cp = convert(p)
cp.body = data.noSpaces
cp.querystring = s"schema=$schema"
cp.contentType = "application/json"
cp
}
case Payload.EnrichmentPayload(_, p) => convert(p).asRight
case p => Left(UncocoerciblePayload(p.toString, "Unsupported request format"))
}
Expand Down
35 changes: 15 additions & 20 deletions core/src/test/resources/expected_payloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -224,24 +224,19 @@
"event_version": "2-0-0"
},
{
"platform": "app",
"etl_tstamp": "1970-01-18T08:40:00",
"collector_tstamp": "2024-02-02T12:51:38.534",
"event": "unstruct",
"v_tracker": "com.snowplowanalytics.iglu-v1",
"v_collector": "ssc-2.10.0-kinesis",
"user_ipaddress": "34.76.244.217",
"network_userid": "ccbd375d-e37f-4919-811c-780f460a3ed4",
"page_url": "https://www.lorem.com/Ipsum-dolor-sit-AMET",
"page_urlscheme": "https",
"page_urlhost": "www.lorem.com",
"page_urlport": 443,
"page_urlpath": "/Ipsum-dolor-sit-AMET",
"useragent": "python-requests/2.31.0",
"derived_tstamp": "2024-02-02T12:51:38.534",
"event_vendor": "com.snowplowanalytics.iglu",
"event_name": "anything-a",
"event_format": "jsonschema",
"event_version": "1-0-0"
}
"platform" : "app",
"etl_tstamp" : "1970-01-18T08:40:00",
"collector_tstamp" : "2024-02-02T12:51:38.534",
"event" : "unstruct",
"v_tracker" : "com.snowplowanalytics.iglu-v1",
"v_collector" : "ssc-2.10.0-kinesis",
"user_ipaddress" : "34.76.244.217",
"network_userid" : "ccbd375d-e37f-4919-811c-780f460a3ed4",
"useragent" : "python-requests/2.31.0",
"derived_tstamp" : "2024-02-02T12:51:38.534",
"event_vendor" : "com.snowplowanalytics.iglu",
"event_name" : "anything-a",
"event_format" : "jsonschema",
"event_version" : "1-0-0"
}
]
Loading