Azure / Azure/data-api-builder
[Bug]: Breaking Change Child entity error if array type
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
Description
### What happened?
Really appreciate the hard work that went into solving #2694 and the haste of which this was included in the latest release candidate. Upon trying to test the fix I ran into an issue.
**Background**:
- I am running the official image mcr.microsoft.com/azure-databases/data-api-builder:1.5.29-rc
- This issue is new to this release. No issues with release 1.4.35
**Error message**:
"InputObject `EPCHistoryOrderByInput` has no fields declared. (HotChocolate.Types.InputObjectType)"
**Symptoms**:
- DAB starts and reports healthy
- Returns HTTP 500 when trying to fetch schema through ChilliCream UI
- **Any** request to /graphql returns HTTP 500
**Repeatability**:
- The schema below causes these symptoms, specifically the `EPCHistory` type with a single `array` field.
Schema which errors:
```
type EPCTransaction {
Inspection_Date: String
Floor_Area_Msq2: Float
}
type EPCHistory {
transaction: [EPCTransaction]
}
type epc @model {
id: String
History: EPCHistory
}
```
- This issue can be overcome by including a `non-array` type dummy field.
Schema which does not error:
```
type EPCTransaction {
Inspection_Date: String
Floor_Area_Msq2: Float
}
type EPCHistory {
transaction: [EPCTransaction]
DummyField: String
}
type epc @model {
id: String
History: EPCHistory
}
```
### Version
1.5.29-rc
### What database are you using?
CosmosDB NoSQL
### What hosting model are you using?
Local (including CLI)
### Which API approach are you accessing DAB through?
GraphQL
### Relevant log output
```Text
fail: Microsoft.AspNetCore.Server.Kestrel[13]
Connection id "0HND4QMO1GJQV", Request id "0HND4QMO1GJQV:00000001": An unhandled exception was thrown by the application.
HotChocolate.SchemaException: For more details look at the `Errors` property.
1. InputObject `EPCHistoryOrderByInput` has no fields declared. (HotChocolate.Types.InputObjectType)
2. InputObject `PPHistoryOrderByInput` has no fields declared. (HotChocolate.Types.InputObjectType)
at HotChocolate.Configuration.TypeInitializer.EnsureNoErrors()
at HotChocolate.Configuration.TypeInitializer.CompleteTypes()
at HotChocolate.Configuration.TypeInitializer.Initialize()
at HotChocolate.SchemaBuilder.Setup.InitializeTypes(SchemaBuilder builder, IDescriptorContext context, IReadOnlyList`1 types, LazySchema lazySchema)
at HotChocolate.SchemaBuilder.Setup.Create(SchemaBuilder builder, LazySchema lazySchema, IDescriptorContext context)
at HotChocolate.SchemaBuilder.Create(IDescriptorContext context)
at HotChocolate.SchemaBuilder.HotChocolate.ISchemaBuilder.Create(IDescriptorContext context)
at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaAsync(NameString schemaName, RequestExecutorSetup options, RequestExecutorOptions executorOptions, IServiceProvider serviceProvider, TypeModuleChangeMonitor typeModuleChangeMonitor, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorResolver.CreateSchemaServicesAsync(NameString schemaName, RequestExecutorSetup options, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorNoLockAsync(NameString schemaName, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorResolver.GetRequestExecutorAsync(NameString schemaName, CancellationToken cancellationToken)
at HotChocolate.Execution.RequestExecutorProxy.GetRequestExecutorAsync(CancellationToken cancellationToken)
at HotChocolate.AspNetCore.HttpPostMiddlewareBase.HandleRequestAsync(HttpContext context, AllowedContentType contentType)
at HotChocolate.AspNetCore.HttpPostMiddlewareBase.InvokeAsync(HttpContext context)
at Microsoft.AspNetCore.Builder.EndpointRouteBuilderExtensions.<>c__DisplayClass12_0.<b__1>d.MoveNext()
--- End of stack trace from previous location ---
at Azure.DataApiBuilder.Core.Authorization.ClientRoleHeaderAuthorizationMiddleware.Invoke(HttpContext httpContext) in /_/src/Core/Authorization/ClientRoleHeaderAuthorizationMiddleware.cs:line 35
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Azure.DataApiBuilder.Core.AuthenticationHelpers.ClientRoleHeaderAuthenticationMiddleware.InvokeAsync(HttpContext httpContext) in /_/src/Core/AuthenticationHelpers/ClientRoleHeaderAuthenticationMiddleware.cs:line 158
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Azure.DataApiBuilder.Service.Startup.<>c__DisplayClass19_0.<b__3>d.MoveNext() in /_/src/Service/Startup.cs:line 471
--- End of stack trace from previous location ---
at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Azure.DataApiBuilder.Core.Services.PathRewriteMiddleware.InvokeAsync(HttpContext httpContext) in /_/src/Core/Services/PathRewriteMiddleware.cs:line 89
at Azure.DataApiBuilder.Core.Services.CorrelationIdMiddleware.Invoke(HttpContext httpContext) in /_/src/Core/Services/CorrelationIdMiddleware.cs:line 53
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
```
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
Contributor guide
Assessment
This issue has not been assessed yet.