{{ message }}
Repository navigation
Support schema types that share one dotnet type (EF property bags) - #581
Open
lukemurray wants to merge 1 commit into
Open
lukemurray wants to merge 1 commit into
lukemurray wants to merge 1 commit into
Conversation
Tables known only at runtime map to EF shared-type entities - property
bags, Dictionary<string, object>, with no class per table - so several
schema types share one dotnet type and each field names its type with
Returns("Type"). Three places took the type from the dotnet type instead:
- UseFilter looked its context up by dotnet type and got the first schema
type registered for it. The filter now starts from the filtered field's
schema type and follows each field's through references and collection
methods, falling back to the dotnet type where the field's schema type
is not of the expression's (a paged field's Page/Connection wrapper).
- Returns(string) put the schema type's dotnet type in ReturnType, leaving
a list field with no element type, so UseSort failed on it. It now keeps
the field's own dotnet type, as GqlTypeInfo does everywhere else.
- A dictionary is enumerable, so a field returning one was a list. A field
returning the named type itself is now a single object.
Bumps to 6.4.0: main's 6.3.1 has not been released, and this adds to the
API.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Lets several schema types share one dotnet type - the case for EF Core shared-type entities, where tables known only at runtime are property bags (
Dictionary<string, object>) with no class per table. Each field names its schema type withReturns("Type"), and the schema now takes it from the field.What was broken, and the fix
UseFilter()Field 'score' not found on type 'Author'author.name) and collection methods (priorities.any(...)), tracked onEqlCompileContext. Falls back to the dotnet-type lookup where the field's schema type is not of the expression's - a paged field'sPage/Connectionwrapper over its collection - so paging and aggregate filters are unchanged.UseSort()on a field withReturns("Type")Value cannot be null. (Parameter 'type')Returns(string)put the schema type's dotnet type inReturnType.TypeDotnet, so a list field had no element type. It now keeps the field's own type (List<T>etc.), asGqlTypeInfodoes everywhere else.Could not find extension method SelectExpressionUtil.BuildEntityQueryExpressiongains an overload taking the schema type; the existing signature is kept, so this is binary compatible.One behaviour change, called out in the changelog:
ReturnType.TypeDotnetof a field that usedReturns("Type")is now the field's own dotnet type rather than the named type's. Code reading it as the element type should useGetEnumerableOrArrayType().Version
mainwas at 6.3.1, which has not been released (NuGet's latest is 6.3.0). This adds to the API, so it bumps to 6.4.0, and the unreleased 6.3.1 changelog section becomes 6.4.0's.Tests
SharedDotnetTypeTests(in memory): selection, both directions of a relation, filter (direct, through a reference, throughany), sort, andReturnTypeafterReturns.SharedTypeEntityTests(EF Core over SQLite, which throws if anything does not translate): the same over real shared-type entities.Found while building dynamic per-app schemas for Tredle, where each app's tables come from its own migrations.
Also noticed:
.config/dotnet-tools.jsonnames the CSharpier commanddotnet-csharpier, but CSharpier 1.0.0 ships it ascsharpier, sodotnet tool restorefails. Not changed here.🤖 Generated with Claude Code