Azure / Azure/azure-functions-nodejs-library

Should we auto parse json trigger inputs or leave as string

Open
#21 0 comments 0 reactions 0 assignees View on GitHub
breaking needs discussion P3
Dominant language
TypeScript
Stars
70
Forks
35
Avg merge
4d 18h
Merged PRs (30d)
6

Description

By default, we try to parse trigger inputs (for example, a queue/event hub/service bus message) as if they were JSON and leave them as a string if that fails. However, that can _occasionally_ lead to weird behavior. For example, in [this "copy blob" example](https://github.com/ejizba/func-nodejs-prototype/blob/main/src/functions/copyBlob1.ts) it takes a blob input and copies it to a blob output. If the blob being copied is a json file, it will lose all formatting after it's copied because we parsed and serialized it instead of just leaving it as a string throughout the transaction.

Fwiw, it appears C# functions leaves these as strings, so we're also inconsistent across languages.

We could always make this a toggle-able option, but now would be a good time to decide if we want to change the default as a part of the v4 breaking change release.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.