Azure / Azure/azure-functions-host

Referencing arrays in function bindings in HTTP triggered functions

Open
#7,817 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

#### Is your question related to a specific version? If so, please specify:

#### What language does your question apply to? (e.g. C#, JavaScript, Java, All)
Javascript

#### Question
I'm trying to figure out how to reference array properties in binding expressions from the request body of an Http triggered function. I can't find any documentation on it, and everything I've tried doesnt work:

- `arr.0.property`
- Fails with the error message: `Error while accessing 'arr': property doesn't exist.`
- `arr.*.property`
- Fails with an invalid binding expression
- `arr[0].property`
- Fails with an invalid binding expression
- `arr.property`
- Fails with the error message: `Error while accessing 'arr': property doesn't exist.`

Here's an example request body:
```
{
"arr": [{
"property": "val"
}]
}
```

Here is my `function.json`:
```
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"route" :"{path}/{id?}",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "blobOutput",
"type": "blob",
"path": "container/{arr.0.property}"
"direction": "out"
}
],
"scriptFile": "../dist/function/index.js"
}
```

Any guidance would be great. Thanks

Contributor guide

Open the contributing guide

Research direction

Start with the binding-expression documentation and the shown function.json, then compare the attempted array expressions with the HTTP request body example. Done means documenting the supported syntax for array properties, or clearly stating the limitation and any supported alternative.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, javascript
Domain
api, backend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.