Azure / Azure/data-api-builder

[Bug]: array "contains" not supported when using filter

オープン
#2,058 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug graphql triage
主要言語
C#
スター
1.5k
フォーク
370
平均マージ
3日 22時間
マージ済み PR(30日)
9

説明

### What happened?

**Simplified Schema**
````
type NestedData {
author: String
nestedArray: [String]
}

type SomeEntity @model {
contentId: String
outsideArray: [String]
nestedData: [NestedData]
}
````
**Config**
````json
"entities": {
"SomeEntity": {
"source": "test",
"rest": false,
"graphql": true,
"permissions": [
{
"role": "anonymous",
"actions": [
"*"
]
}
]
},
"NestedData": {
"source": "test",
"rest": false,
"graphql": true,
"permissions": [
{
"role": "anonymous",
"actions": [
"*"
]
}
]
}
}
````
**Query**
````
someEntities(
first: 5
filter: {
and: [
{ nestedData: { author: { eq: "author1" } } }
{ nestedData: { nestedArray: { contains: "item1" } } }
]
}
) {
items {
contentId,
outsideArray
nestedData{
nestedArray
}
}
}
````

**Output: No Data**
````json
{
"data": {
"someEntities": {
"items": []
}
}
}
````

**Query**
````
someEntities(
first: 5
filter: {
and: [
{ nestedData: { author: { eq: "author1" } } }
]
}
) {
items {
contentId,
outsideArray
nestedData{
nestedArray
}
}
}
````

**Output: Returns Data**
````json
{
"data": {
"someEntities": {
"items": [
{
"contentId": "Content2",
"outsideArray": [
"item1",
"item2"
],
"nestedData": [
{
"nestedArray": [
"item1",
"item2"
]
},
{
"nestedArray": [
"item2",
"item3"
]
},
{
"nestedArray": []
},
{
"nestedArray": [
"item4",
"item5"
]
}
]
}
]
}
}
}
````

**Note:** Filtering without array contains clause works. However, including array contains (e.g. { nestedData: { nestedArray: { contains: "item1" } } } ) fails for the same data

### Version

Microsoft.DataApiBuilder 0.11.6-rc+f557b4da4c350f878d9a44632037daef9349f769

### What database are you using?

CosmosDB NoSQL

### What hosting model are you using?

Static Web Apps (SWA)

### Which API approach are you accessing DAB through?

GraphQL

### Relevant log output

```Text
{
"data": {
"someEntities": {
"items": []
}
}
}
```

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reproducing the two GraphQL queries from the simplified schema and entity configuration against Cosmos DB, comparing the author-only filter with the combined nestedArray.contains filter. Done means the combined filter returns the matching entity containing the requested array item instead of an empty result.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, graphql
領域
api, databases
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。