Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

Groovy mapping error for array: type must be compatible with java string #246

Closed
tatianafrank opened this issue Jun 7, 2019 · 1 comment

Comments

@tatianafrank
Copy link

I am integrating divolte with kafka. I have a custom event with a field that is an array of strings. I've defined the field in the avsc schema file like so:

{ "name": "countries", "type": ["null", {"type": "array", "items": "string"}]

and in the mapping.groovy file like so:
map eventParameter('countries') onto 'countries'
but I am getting the below error:

Exception in thread "main" io.divolte.server.recordmapping.SchemaMappingException: Cannot map the result of eventParameter(countries) onto field countries: type must be compatible with java.lang.String

Please tell me what I'm doing the wrong. This is a simple array such as:
"countries": ["us", "china"]

@tatianafrank
Copy link
Author

I worked around this issue by using this format in the mapping.groovy file: map eventParameters().path('$.countries.*') onto 'countries'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant