Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine Attribute Support #1306

Merged
merged 9 commits into from
Dec 19, 2019
Merged

Conversation

michaelstaib
Copy link
Member

@michaelstaib michaelstaib commented Dec 18, 2019

This PR introduces new type attributes to force the type discovery to recognize a struct for instance as a ObjectType.

Also we have fixed the UsePagingAttribute and reworked the attribute base to include the annotated element and the descriptor context.

Last but not least we added the ExtendObjectTypeAttribute.

ISchema schema = SchemaBuilder.New()
    .AddType<StructQuery>()
    .AddType<StructQueryExtension>()
    .ModifyOptions(o => o.RemoveUnreachableTypes = true)
    .Create();

[ObjectType(Name = "Query")]
public struct StructQuery
{
    public string? Foo { get; }
}

[ExtendObjectType(Name = "Query")]
public class StructQueryExtension
{
    public string? Bar { get; }
}

will result in:

type Query {
    bar: String
    foo: String
}

@michaelstaib michaelstaib added this to the 10.3.0 milestone Dec 18, 2019
@michaelstaib michaelstaib self-assigned this Dec 18, 2019
@michaelstaib michaelstaib merged commit b4c04a5 into version_10_0_0_master Dec 19, 2019
@michaelstaib michaelstaib deleted the attribute_support branch December 19, 2019 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant