Hi Snowplowers,
I’m experiencing a weird behavior with this schema and the latest Snowplow mini, I wonder if someone can give me some insight on this.
I open the following browser tabs:
- https://www.base64encode.org/
- https://www.base64decode.org/
- https://codebeautify.org/jsonviewer
- Snowplow Mini Kibana - 0.11.0
Consider this very simple schema: schemas/com.shopify/refund/jsonschema/1-0-0. (Discourse doesn’t let me attach a txt file)
{
"$schema": "http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#",
"description": "Schema for Shopify refund events ",
"self": {
"vendor": "com.shopify",
"name": "refund",
"format": "jsonschema",
"version": "1-0-0"
},
"type": "object",
"properties": {
"id": {
"type": "integer",
"description": "The refund id",
"minimum": 0,
"maximum": 9223372036854775807
},
"order_id": {
"type": "integer",
"description": "The order id",
"minimum": 0,
"maximum": 9223372036854775807
},
"created_at": {
"description": "Cart event created at",
"type": ["string","null"],
"format": "date-time"
},
"note": {
"description": "The refund note",
"type": ["string","null"],
"maxLength": 255
},
"user_id": {
"type": ["integer","null"],
"description": "The user id",
"minimum": 0,
"maximum": 9223372036854775807
},
"processed_at": {
"description": "Cart event created at",
"type": ["string","null"],
"format": "date-time"
},
"restock": {
"type": ["boolean","null"],
"description": "Restock"
},
"total_duties_set": {
"description": "The total duties set",
"type": ["object","null"],
"properties": {
"shop_money": {
"description": "The total duties shop money amount",
"type": ["object","null"],
"properties": {
"amount": {
"type": ["string","null"],
"description": "Amount",
"maxLength": 255
},
"currency_code": {
"type": ["string","null"],
"description": "Total duties shop money currency code",
"maxLength": 5
}
}
},
"presentment_money": {
"description": "The total duties presentment money",
"type": ["object","null"],
"properties": {
"amount": {
"type": ["string","null"],
"description": "The total duties presentment money amount",
"maxLength": 255
},
"currency_code": {
"type": ["string","null"],
"description": "The total duties presentment money currency code",
"maxLength": 5
}
}
}
}
},
"admin_graphql_api_id": {
"description": "The refund note",
"type": ["string","null"],
"maxLength": 255
}
},
"minProperties": 1,
"required": ["id","order_id"],
"additionalProperties": true
}
- 1 property minimum
- Required properties of id and order_id
- additionalProperties: true, meaning we can send more properties and the hit is still valid.
Reproduce:
-
I validate the schema with
igluctl lint schemas/
and it says OK: com.shopify/refund/jsonschema/1-0-0 -
I upload this schema to Mini (and my Micro also reads local Iglu repo)
-
I verify the schema is uploaded to mini http://xxxxxxxxxxx:8081/api/schemas/com.shopify/refund/jsonschema/1-0-0
-
I create a postman POST hit to Snowplow mini https://mysnowplowmini.com/com.snowplowanalytics.snowplow/tp2 with following body:
{
“schema”: “iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4”,
“data”: [
{
“aid”: “shopify”,
“tna”: “spfy”,
“url”: “https://test.myshopify.com/refunds/create”,
“tv”: “2020-10”,
“e”: “ue”,
“se_ca”: “webhook”,
“se_ac”: “create”,
“se_la”: “refund”,
“p”: “app”,
“cs”: “UTF-8”,
“ue_px”:“ewogICJzY2hlbWEiOiAiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvdW5zdHJ1Y3RfZXZlbnQvanNvbnNjaGVtYS8xLTAtMCIsCiAgImRhdGEiOiB7CiAgICAic2NoZW1hIjogImlnbHU6Y29tLnNob3BpZnkvcmVmdW5kL2pzb25zY2hlbWEvMS0wLTAiLAogICAgImRhdGEiOiB7CiAgICAgICJpZCI6IDY4MjE3OTMzMDIwNiwKICAgICAgIm9yZGVyX2lkIjogMjg2MjU2MDgzNzc5MCwKICAgICAgImNyZWF0ZWRfYXQiOiAiMjAyMC0xMS0wNFQxOToxOTo0NC0wNTowMCIsCiAgICAgICJub3RlIjogIiIsCiAgICAgICJ1c2VyX2lkIjogNjYxNDUxMjQ1MTAsCiAgICAgICJwcm9jZXNzZWRfYXQiOiAiMjAyMC0xMS0wNFQxOToxOTo0NC0wNTowMCIsCiAgICAgICJyZXN0b2NrIjogZmFsc2UsCiAgICAgICJkdXRpZXMiOiBbXSwKICAgICAgImFkbWluX2dyYXBocWxfYXBpX2lkIjogImdpZDovL3Nob3BpZnkvUmVmdW5kLzY4MjE3OTMzMDIwNiIsCiAgICAgICJyZWZ1bmRfbGluZV9pdGVtcyI6IFtdCiAgICB9CiAgfQp9”
}
]
}
If I execute the hit and go to Mini I can see the event on good in Kibana.
Now I add the following to my payload:
"total_duties_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "USD"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "USD"
}
},
This one (you will need to Base64 decode ue_px to see it) and when firing this to Snowplow Mini the hit doesn’t show up either in good or bad.
{
“schema”: “iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4”,
“data”: [
{
“aid”: “shopify”,
“tna”: “spfy”,
“url”: “https://test.myshopify.com/refunds/create”,
“tv”: “2020-10”,
“e”: “ue”,
“se_ca”: “webhook”,
“se_ac”: “create”,
“se_la”: “refund”,
“p”: “app”,
“cs”: “UTF-8”,
“ue_px”:“ewogICJzY2hlbWEiOiAiaWdsdTpjb20uc25vd3Bsb3dhbmFseXRpY3Muc25vd3Bsb3cvdW5zdHJ1Y3RfZXZlbnQvanNvbnNjaGVtYS8xLTAtMCIsCiAgImRhdGEiOiB7CiAgICAic2NoZW1hIjogImlnbHU6Y29tLnNob3BpZnkvcmVmdW5kL2pzb25zY2hlbWEvMS0wLTAiLAogICAgImRhdGEiOiB7CiAgICAgICJpZCI6IDY4MjE3OTMzMDIwNiwKICAgICAgIm9yZGVyX2lkIjogMjg2MjU2MDgzNzc5MCwKICAgICAgImNyZWF0ZWRfYXQiOiAiMjAyMC0xMS0wNFQxOToxOTo0NC0wNTowMCIsCiAgICAgICJub3RlIjogIiIsCiAgICAgICJ1c2VyX2lkIjogNjYxNDUxMjQ1MTAsCiAgICAgICJwcm9jZXNzZWRfYXQiOiAiMjAyMC0xMS0wNFQxOToxOTo0NC0wNTowMCIsCiAgICAgICJyZXN0b2NrIjogZmFsc2UsCiAgICAgICJkdXRpZXMiOiBbXSwKICAgICAgInRvdGFsX2R1dGllc19zZXQiOiB7CiAgICAgICAgInNob3BfbW9uZXkiOiB7CiAgICAgICAgICAiYW1vdW50IjogIjAuMDAiLAogICAgICAgICAgImN1cnJlbmN5X2NvZGUiOiAiVVNEIgogICAgICAgIH0sCiAgICAgICAgInByZXNlbnRtZW50X21vbmV5IjogewogICAgICAgICAgImFtb3VudCI6ICIwLjAwIiwKICAgICAgICAgICJjdXJyZW5jeV9jb2RlIjogIlVTRCIKICAgICAgICB9CiAgICAgIH0sCiAgICAgICJhZG1pbl9ncmFwaHFsX2FwaV9pZCI6ICJnaWQ6Ly9zaG9waWZ5L1JlZnVuZC82ODIxNzkzMzAyMDYiLAogICAgICAicmVmdW5kX2xpbmVfaXRlbXMiOiBbXQogICAgfQogIH0KfQ”
}
]
}
Now the funny thing is both hits show up as good on Snowplow Micro.
{“total”:2,“good”:2,“bad”:0}
The problem seems to be this data and I cant seem to figure out why:
"total_duties_set": {
"shop_money": {
"amount": "0.00",
"currency_code": "USD"
},
"presentment_money": {
"amount": "0.00",
"currency_code": "USD"
}
},
What am I missing here?
Joao