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

Fix DateTimeOffset as Variable #222

Merged
merged 3 commits into from
Aug 1, 2022
Merged

Conversation

LordJZ
Copy link
Contributor

@LordJZ LordJZ commented Apr 6, 2020

No description provided.

@codecov
Copy link

codecov bot commented Apr 6, 2020

Codecov Report

Merging #222 (621915a) into master (332e997) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head 621915a differs from pull request most recent head 0e1e302. Consider uploading reports for the commit 0e1e302 to get more accurate results

@@            Coverage Diff             @@
##           master     #222      +/-   ##
==========================================
+ Coverage   78.83%   78.84%   +0.01%     
==========================================
  Files          73       73              
  Lines        2447     2449       +2     
  Branches      357      358       +1     
==========================================
+ Hits         1929     1931       +2     
  Misses        441      441              
  Partials       77       77              
Impacted Files Coverage Δ
...kit.GraphQL.Core/Core/Syntax/VariableDefinition.cs 78.94% <100.00%> (+2.47%) ⬆️

Copy link
Contributor Author

@LordJZ LordJZ left a comment

Choose a reason for hiding this comment

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

Related: #214 #215 #203

Comment on lines +84 to +100
[IntegrationTest]
public async Task DateTime_Filter_Works()
{
var query = new GraphQL.Query()
.Viewer.ContributionsCollection(from: Variable.Var("start"))
.Select(c => c.User.Name);

var vars = new Dictionary<string, object>
{
{ "start", new DateTimeOffset(2000, 1, 2, 3, 4, 5, default) }
};

var response = await Connection.Run(query.Compile(), vars);

// no server error
Assert.NotNull(response);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

any better location for this?

Comment on lines +321 to +340
[Fact]
public void DateTimeOffsetVariable()
{
var expected = @"query($start: DateTime) {
user(login: ""grokys"") {
contributionsCollection(from: $start) {
latestRestrictedContributionDate
}
}
}";

var expression = new Query()
.User("grokys")
.ContributionsCollection(@from: Variable.Var("start"))
.Select(c => c.LatestRestrictedContributionDate);

var query = expression.Compile();

Assert.Equal(expected, query.ToString(), ignoreLineEndingDifferences: true);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could put this into Core like in #214, but I need a DateTimeOffset parameter for this

@0xced
Copy link
Contributor

0xced commented Apr 29, 2021

@jcansdale Looks good to me, either this pull request or #226 can be merged to add support for DateTimeOffset as variable.

Copy link
Contributor

@nickfloyd nickfloyd left a comment

Choose a reason for hiding this comment

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

Thanks for the work here (@LordJZ & @0xced) ❤️

@nickfloyd nickfloyd merged commit d9ea24d into octokit:master Aug 1, 2022
@LordJZ LordJZ deleted the dto-variable branch August 10, 2022 11:36
This pull request was closed.
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.

4 participants