Open dgcaron opened 1 year ago
ok, manually defining the missing input types works om a sense that the api now returns rows and expects the correct partials.
in my case this was
type Setting @model {
id: ID
data: SettingsData
}
union SettingsData = Type1 | Type2 | Type3
input SettingsDataOrderByInput {
type: String
}
input SettingsDataFilterInput {
type: String
}
however, the data object remains empty. is there any guidance on how to set this up correctly?
@dgcaron Thanks for reporting the issue, we will check and get back on this! If possible can you provide a sample document?
you mean a database configuration? this would represent my current setup. As a workaround i tried to add a policy to filter items in advance but that doesn't seem to be supported for cosmosdb (as it has no effect)
{
"$schema": "https://dataapibuilder.azureedge.net/schemas/v0.5.34/dab.draft.schema.json",
"data-source": {
"database-type": "cosmosdb_nosql",
"options": {
"database": "...",
"schema": "staticwebapp.database.schema.gql"
},
"connection-string": "..."
},
"runtime": {
"graphql": {
"allow-introspection": true,
"enabled": true,
"path": "/graphql"
},
"host": {
"mode": "production",
"cors": {
"origins": [],
"allow-credentials": false
},
"authentication": {
"provider": "StaticWebApps"
}
}
},
"entities": {
"Settings": {
"source": "settings",
"permissions": [
{
"actions": [
{
"action": "read"
}
],
"role": "anonymous"
}
]
}
}
}
and
type Settings @model {
id: ID
type: string
data: SettingsData
}
union SettingsData = Type1 | Type2
type Type1 {
prop1: string
}
type Type1 {
prop2: string
}
input SettingsDataOrderByInput {
type: String
}
input SettingsDataFilterInput {
type: String
}
and example document would be
{
"id": "<some random guid>",
"type": "Type1",
"data": {
"prop1": "test"
}
}
I would say the bug is most likely within https://github.com/Azure/data-api-builder/blob/main/src/Service.GraphQLBuilder/Queries/InputTypeBuilder.cs#L112 and we're not handling the union type properly as it didn't generate the input type and then it also didn't generate the property correctly on the model.
Hi, just checking if there is any movement on this issue?
What happened?
I have setup a graphql endpoint using cosmos db and have defined a union type like described here https://graphql.org/learn/schema/#union-types. when i call the graphql endpoint it returns an 500 status code
Version
0.5.35
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
Code of Conduct