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

Add DirectiveAttribute #3886

Merged
merged 1 commit into from Jan 5, 2024
Merged

Add DirectiveAttribute #3886

merged 1 commit into from Jan 5, 2024

Conversation

Shane32
Copy link
Member

@Shane32 Shane32 commented Jan 5, 2024

Samples and tests in PR #3885

This new directive mirrors the existing MetadataAttribute which allows adding arbitrary metadata to type-first schemas.

@Shane32 Shane32 self-assigned this Jan 5, 2024
@Shane32 Shane32 added this to the 7.8 milestone Jan 5, 2024
@Shane32 Shane32 requested a review from gao-artur January 5, 2024 19:48
@codecov-commenter
Copy link

Codecov Report

Attention: 44 lines in your changes are missing coverage. Please review.

Comparison is base (2ba9b26) 84.36% compared to head (6b4dbf5) 84.18%.
Report is 2 commits behind head on master.

Files Patch % Lines
src/GraphQL/Attributes/DirectiveAttribute.cs 0.00% 44 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3886      +/-   ##
==========================================
- Coverage   84.36%   84.18%   -0.18%     
==========================================
  Files         420      421       +1     
  Lines       19470    19514      +44     
  Branches     3041     3043       +2     
==========================================
+ Hits        16426    16428       +2     
- Misses       2329     2372      +43     
+ Partials      715      714       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

/// The <paramref name="argsAndValues"/> parameter must contain an even number of elements, where
/// the first element of each pair is the argument name and the second element is the argument value.
/// </remarks>
public DirectiveAttribute(string name, params object[] argsAndValues)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth adding an analyzer to ensure an even number of elements and the argument names are strings?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably pretty low on the priority list. Sure that would be nice, and it could check that the first element of each pair was a string too. Keep people from doing stuff like [Directive("maxlength", 5)] when they meant to do [Directive("maxlength", "value", 5)]

@Shane32 Shane32 merged commit 3e2a7b2 into master Jan 5, 2024
13 checks passed
@Shane32 Shane32 deleted the add_directive branch January 5, 2024 20:27
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

3 participants