Azure / Azure/data-api-builder

Multiple mutations not supported in PGSQL

Open
#2,485 1 comment 0 reactions 0 assignees View on GitHub
enhancement Multiple mutations triage
Dominant language
C#
Stars
1.5k
Forks
370
Avg merge
3d 17h
Merged PRs (30d)
8

Description

### What happened?

**Current behavior**
I am using the following [tutorial](https://learn.microsoft.com/en-us/azure/data-api-builder/how-to-multiple-mutations) and while using the following query
```
mutation {
createBook(
item: {
id: 1
title: "Introduction to Data API builder"
pages: 200
years: 2024
chapters: [
{
id: 2
name: "Configuration files", pages: 150
}
{
id: 3
name: "Running", pages: 50
}
]
}
) {
id
title
pages
years
chapters {
items {
name
pages
}
}
}
}
````
I get the following error;

```
{
"errors": [
{
"message": "The specified input object field `chapters` does not exist.",
"locations": [
{
"line": 8,
"column": 7
}
],
"path": [
"createBook"
],
"extensions": {
"field": "chapters",
"specifiedBy": "http://spec.graphql.org/October2021/#sec-Input-Object-Field-Names"
}
}
]
}
```

dab-config.json

```
{
"$schema": "https://github.com/Azure/data-api-builder/releases/download/v1.3.19/dab.draft.schema.json",
"data-source": {
"database-type": "postgresql",
"connection-string": "Host=localhost;Port=5431;Database=postgres;User ID=postgres;Password=password;",
"options": {}
},
"runtime": {
"rest": {
"enabled": true,
"path": "/api",
"request-body-strict": true
},
"graphql": {
"enabled": true,
"path": "/graphql",
"allow-introspection": true
},
"host": {
"cors": {
"origins": [],
"allow-credentials": false
},
"authentication": {
"provider": "StaticWebApps"
},
"mode": "development"
}
},
"entities": {
"Book": {
"source": {
"object": "books",
"type": "table"
},
"graphql": {
"enabled": true,
"type": {
"singular": "Book",
"plural": "Books"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*"
}
]
}
],
"relationships": {
"chapters": {
"cardinality": "many",
"target.entity": "Chapter",
"source.fields": [],
"target.fields": [],
"linking.source.fields": [],
"linking.target.fields": []
}
}
},
"Chapter": {
"source": {
"object": "chapters",
"type": "table"
},
"graphql": {
"enabled": true,
"type": {
"singular": "Chapter",
"plural": "Chapters"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*"
}
]
}
],
"relationships": {
"book": {
"cardinality": "one",
"target.entity": "Book",
"source.fields": [],
"target.fields": [],
"linking.source.fields": [],
"linking.target.fields": []
}
}
}
}
}
```

**Expected Behavior**
Book and its Chapters should get created.

### Version

1.3.19

### What database are you using?

PostgreSQL

### What hosting model are you using?

Local (including CLI)

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

GraphQL

### Relevant log output

```Text
{
"errors": [
{
"message": "The specified input object field `chapters` does not exist.",
"locations": [
{
"line": 8,
"column": 7
}
],
"path": [
"createBook"
],
"extensions": {
"field": "chapters",
"specifiedBy": "http://spec.graphql.org/October2021/#sec-Input-Object-Field-Names"
}
}
]
}
```

### Code of Conduct

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

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.