graphql-platform
graphql-platform copied to clipboard
WIP: Add failing tests for extending Code-First types
While playing around with Type Extension I've noticed that the following two cases do not work:
Extending a Code-first type from the Annotation-based approach:
public class CodeFirstType : ObjectType
{
protected override void Configure(IObjectTypeDescriptor descriptor)
{
descriptor.Name("Query");
descriptor.Field("field1").Resolve("");
}
}
[ExtendObjectType(typeof(CodeFirstType))]
public class ExtendCodeFirstType
{
public string Field2 => "";
}
Extending a Code-first type using ExtendsType<T>()
:
public class CodeFirstType : ObjectType
{
protected override void Configure(IObjectTypeDescriptor descriptor)
{
descriptor.Name("Query");
descriptor.Field("field1").Resolve("");
}
}
public class CodeFirstTypeExtension : ObjectTypeExtension
{
protected override void Configure(IObjectTypeDescriptor descriptor)
{
descriptor.ExtendsType<CodeFirstType>();
descriptor.Field("field2").Resolve("");
}
}
I wasn't sure whether these are intentional limitations or whether they are bugs and how to best go about solving them. In the end I just added these tests to showcase the issue.
Kudos, SonarCloud Quality Gate passed!
0 Bugs
0 Vulnerabilities
0 Security Hotspots
4 Code Smells
No Coverage information
0.0% Duplication
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.