Azure / Azure/data-api-builder

Add validation to the mapping for each entity on bootstrap

Đang mở
#425 4 bình luận 0 reaction 1 người được giao Được @aaronburtle nhận Xem trên GitHub
validation
Ngôn ngữ chính
C#
Star
1.5k
Fork
370
Merge trung bình
3 ngày 22 giờ
Pull request đã merge (30 ngày)
9

Mô tả

## Background
**Mappings** define what names we want to be externally usable in order to access underlying database object associated with a given entity.

Reminder, the entity mapping section is used as follows per https://learn.microsoft.com/en-us/azure/data-api-builder/reference-configuration#format-49

```json
"mappings": {
"" : "",
"" : "",
"" : ""
}
```

### Validation

- Don't allow multiple column names to map to the same exposed name
- Don't allow multiple exposed names to map to the same backing column.

### Examples

For example,
- Entity **Book** with fields `id`, `title`, and `author`

```tsql
SELECT id, title, author FROM dbo.book
```

| id | title | author |
|---|---|---|
| 1 | MyBook | Me! |
| 2 | MyMystery | You! |

Mappings
```json
mappings: {
"title" : "author"
}
```

We can no longer have a request like the following return the "expected" value of the author field (also unclear how the GraphQL Schema generator deals with this and what fields are actually present on the request:

```graphql
query bookQuery {
books {
id
title
author
}

The `author` is un-reachable because the unmapped backing column "author" is not mapped and is overridden by the mapping for "title" .

### Expectation
In this case we should return a warning to the user that they have conflicts in their mapping. Either during startup? or request time?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.