Bad schema issue, all properties invalid - Snowplow Mini


#1

Hi,

I am getting an invalid property error for every key in the object when testing a custom schema on Snowplow Mini. Can anyone spot anything that I am doing wrong?

The error:

"message": "error: object instance has properties which are not allowed by the schema: [\"answer_time\",\"bill_cost\",\"bill_rate\",\"duration\",\"id_call_detail\",\"id_call_history\",\"is_completed\",\"is_to_external\",\"other_party\",\"parent_detail_num\",\"spec_dst_type\",\"start_time\",\"status\",\"step_number\"]\n level: \"error\"\n schema: {\"loadingURI\":\"#\",\"pointer\":\"\"}\n instance: {\"pointer\":\"\"}\n domain: \"validation\"\n keyword: \"additionalProperties\"\n unwanted: [\"answer_time\",\"bill_cost\",\"bill_rate\",\"duration\",\"id_call_detail\",\"id_call_history\",\"is_completed\",\"is_to_external\",\"other_party\",\"parent_detail_num\",\"spec_dst_type\",\"start_time\",\"status\",\"step_number\"]\n"

The request: (ue_px decoded)

{"schema":"iglu:com.snowplowanalytics.snowplow/unstruct_event/jsonschema/1-0-0","data":{"schema":"iglu:com.3cx/call_detail/jsonschema/1-0-0","data":{"id_call_detail":480948,"id_call_history":337569,"step_number":1,"parent_detail_num":0,"dest_num":911,"spec_dst_type":0,"start_time":"2016-05-18T03:24:48+10:00","duration":32.339,"answer_time":"2016-05-18T03:24:48+10:00","status":"Completed","is_completed":1,"is_to_external":0,"dest_dn":911,"other_party":10000,"bill_rate":0,"bill_cost":0}}}

The call_detail schema:

{"$schema":"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#","description":"Schema for a 3CX call detail event","self":{"vendor":"com.3cx","name":"call_detail","format":"jsonschema","version":"1-0-0"},"type":"object","properties":{"_id":{"type":"string"},"duration":{"type":"number"},"start_time":{"type":"string","format":"date-time"},"spec_dst_type":{"type":"integer"},"bill_prefix":{"type":"string"},"id_call_detail":{"type":"integer"},"bill_rate":{"type":"integer"},"step_number":{"type":"integer"},"dest_dn":{"type":"integer"},"is_completed":{"type":"integer"},"dest_num":{"type":"integer"},"id_call_history":{"type":"integer"},"status":{"type":"string"},"answer_time":{"type":"string","format":"date-time"},"other_party":{"type":"integer"},"is_to_external":{"type":"integer"},"bill_cost":{"type":"number"},"bill_rate_name":{"type":"string"},"parent_detail_num":{"type":"integer"},"ts":{"type":"string","format":"date-time"}},"additionalProperties":false}


#2

Hi Nathan,

That’s really odd - I’ve checked that the JSON data validates against your schema.

The error message suggests that Snowplow Mini is validating the data against another schema - one that doesn’t contain the different fields in the JSON i.e. answer_time, bill_cost. Is it possible that you’ve uploaded an incorrect schema to Snowplow Mini? Note that if you’ve updated a schema, you’ll need to reboot the instance to refresh the schema cache. (See this post for schema caching details.)

I would recommend:

  1. Check fetching the schema from Iglu Server on Snowplow Mini to confirm the correct version has been uploaded
  2. Reboot the instance

Let me know if that addresses the issue,

Yali


Cannot read uploaded schema in Snowplow Mini
#3

Hi Yali,

Looks like a caching issue. Rebooted the server and it started working. I assume that the PUT to update the schema would work as both the web request to the API and the database query showed the correct schema, didn’t realise it was also cached elsewhere.

Thanks for the help