graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

WIP: Add failing tests for extending Code-First types

Open tobias-tengler opened this issue 2 years ago • 3 comments

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.

tobias-tengler avatar Mar 20 '22 14:03 tobias-tengler

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 4 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarcloud[bot] avatar Mar 20 '22 14:03 sonarcloud[bot]

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.

stale[bot] avatar May 19 '22 15:05 stale[bot]

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Aug 17 '22 14:08 CLAassistant