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

HTTP API: Allow Metadata Upserts with lists or numbers #2880

Closed
steffh opened this issue Feb 22, 2022 · 1 comment · Fixed by #2957
Closed

HTTP API: Allow Metadata Upserts with lists or numbers #2880

steffh opened this issue Feb 22, 2022 · 1 comment · Fixed by #2957

Comments

@steffh
Copy link
Collaborator

steffh commented Feb 22, 2022

Is your feature request related to a problem? Please describe.

As documented here (https://airy.co/docs/core/api/endpoints/metadata), metadata upserts can only contain values of type string or object values (i.e. no lists or numbers).

In practice, it's sometimes hard to check for the type of each key, especially when dealing with external APIs (e.g. responses from DialogFlow, etc.) and having to convert all values to strings. Otherwise, these requests often result in HTTP 400 responses.

Describe the solution you'd like

We could allow for lists or numbers inside the user-defined data object by stringifying all metadata values per default before storing them and parsing them back to JSON before delivering them via the HTTP API, web socket or webhooks.

@chrismatix
Copy link
Contributor

Tl;dr This should be much easier to do than anticipated. I hadn't thought about it back then @juan-sebastian and @abhi-airy, but it should be possible to add an optional field to the backend/avro/metadata.avsc that explicates the type of the value (string, list, number) with string being the null default.

Then in the MetadataObjectMapper we can set/read this field. The only caveat of course is that you won't be able to concurrently edit lists, but I guess that's to be expected

@chrismatix chrismatix self-assigned this Mar 23, 2022
@chrismatix chrismatix added this to To do in Engineering WIP via automation Mar 23, 2022
@chrismatix chrismatix moved this from To do to In progress in Engineering WIP Mar 23, 2022
Engineering WIP automation moved this from In progress to Done Mar 24, 2022
chrismatix pushed a commit that referenced this issue Mar 24, 2022
* [#2880] Support all JSON data types for metadata

* [#2799] Fix log statements in connectors

* lint

* fix tests

* Fix tests (again)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

2 participants