샘플 데이터 API 작성기 구성
이 샘플 구성에서는 엔드 투 엔드 시나리오를 보여 했습니다. 이 시나리오에서는 Azure SQL Database를 백업 데이터베이스로 사용하고 호스트로 Azure Static Web Apps.
이 샘플은 라이브러리 샘플 SQL 스크립트에 제공된 테이블 및 데이터에서 파생됩니다.
{
"$schema": "https://github.com/Azure/data-api-builder/releases/download/v0.10.23/dab.draft.schema.json",
"data-source": {
"database-type": "mssql",
"connection-string": "@env('my-connection-string')",
"options": {
"set-session-context": false
}
},
"runtime": {
"rest": {
"enabled": true,
"path": "/api",
"request-body-strict": false
},
"graphql": {
"enabled": true,
"path": "/graphql",
"allow-introspection": true
},
"host": {
"cors": {
"origins": [],
"allow-credentials": false
},
"authentication": {
"provider": "StaticWebApps"
},
"mode": "development"
}
},
"entities": {
"authors": {
"source": {
"object": "[dbo].[authors]",
"type": "table",
"key-fields": [ "id" ]
},
"graphql": {
"enabled": true,
"type": {
"singular": "authors",
"plural": "authors"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*",
"fields": {
"exclude": [ "middle_name" ],
"include": [
"id",
"first_name",
"last_name"
]
}
}
]
}
],
"mappings": { "id": "key" },
"relationships": {
"books": {
"cardinality": "many",
"target.entity": "books",
"source.fields": [],
"target.fields": [],
"linking.object": "dbo.books_authors",
"linking.source.fields": [ "author_id" ],
"linking.target.fields": [ "book_id" ]
}
}
},
"series": {
"source": {
"object": "[dbo].[series]",
"type": "table",
"key-fields": [ "id" ]
},
"graphql": {
"enabled": true,
"type": {
"singular": "series",
"plural": "series"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*"
}
]
}
],
"relationships": {
"books": {
"cardinality": "many",
"target.entity": "books",
"source.fields": [ "id" ],
"target.fields": [ "series_id" ],
"linking.source.fields": [],
"linking.target.fields": []
}
}
},
"books": {
"source": {
"object": "[dbo].[books]",
"type": "table",
"key-fields": [ "id" ]
},
"graphql": {
"enabled": true,
"type": {
"singular": "books",
"plural": "books"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*"
}
]
}
],
"relationships": {
"series": {
"cardinality": "one",
"target.entity": "series",
"source.fields": [ "series_id" ],
"target.fields": [ "id" ],
"linking.source.fields": [],
"linking.target.fields": []
},
"authors": {
"cardinality": "many",
"target.entity": "authors",
"source.fields": [],
"target.fields": [],
"linking.object": "dbo.books_authors",
"linking.source.fields": [ "book_id" ],
"linking.target.fields": [ "author_id" ]
}
}
},
"books_authors": {
"source": {
"object": "[dbo].[books_authors]",
"type": "table",
"key-fields": [
"book_id",
"author_id"
]
},
"graphql": {
"enabled": false,
"type": {
"singular": "books_authors",
"plural": "books_authors"
}
},
"rest": {
"enabled": true
},
"permissions": [
{
"role": "anonymous",
"actions": [
{
"action": "*"
}
]
}
]
}
}
}