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

Update for GraphQL 5 #17

Merged
merged 2 commits into from
Apr 22, 2022
Merged

Update for GraphQL 5 #17

merged 2 commits into from
Apr 22, 2022

Conversation

Shane32
Copy link
Owner

@Shane32 Shane32 commented Apr 22, 2022

No description provided.

@Shane32 Shane32 self-assigned this Apr 22, 2022
@github-actions
Copy link

Coverage Report

Totals Coverage
Statements: 97.32% ( 109 / 112 )
Methods: 90% ( 36 / 40 )

@Shane32
Copy link
Owner Author

Shane32 commented Apr 22, 2022

@sungam3r The new features in the GraphQL v5 (mostly the AutoRegisteringObjectGraphType class) allowed me to eliminate 5,000 lines of code from this project while supporting nearly all of the same features.

@Shane32 Shane32 merged commit 47745da into master Apr 22, 2022
@Shane32 Shane32 deleted the updates_for_graphql_v5 branch April 22, 2022 23:34

namespace Sample
{
public class RequiredAttribute : GraphQL.GraphQLAttribute

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move into core repo?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh... we could. With NRT it's pretty pointless, but it probably depends on how it's actually used. I had RequiredAttribute, OptionalAttribute, RequiredListAttribute and OptionalListAttribute with a pile of tests for each written here previously. It is extremely easy to rewrite these attributes if they are needed with the new way the attributes are applied ( nice teamwork here 👍 👍 👍 ) . I just didn't feel like updating the sample project in this repo, so I just moved the class over to the sample project.

So, to answer your question, I wouldn't. But if you think so, sure.

There is two attributes I think we should consider adding:

  • An attribute that sets the 'base' graph type (i.e. the graph type of the base clr type) without having to apply the list/non-null wrappers. (Right now the InputType or OutputType attributes overwrite the entire graph type, so any list/non-null wrappers need to be specified in the attribute.)
  • A couple special attributes for date or timespan fields to define which exact graph type was intended.

Btw, I did try to eliminate the need for this project altogether, but I found that my code works very well with the DI-injection supported here, so I'm still using it. It is rather nice being able to DI-inject services into the constructor of mutation graphs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that it would be useful to fill the main project with additional attributes even as examples and even if these attributes will be rarely in demand.

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.

None yet

2 participants