-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a few bugs in the generator (#787)
- Loading branch information
Showing
15 changed files
with
35,081 additions
and
13,067 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
cynic-querygen/tests/queries/github/inline-fragment-with-renames.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
query RepoIssues($first: Int!) { | ||
repository(owner: "obmarg", name: "cynic") { | ||
one: issueOrPullRequest(number: 100) { | ||
... on Issue { | ||
body | ||
assignees(first: $first) { | ||
totalCount | ||
} | ||
} | ||
... on PullRequest { | ||
body | ||
assignees(first: $first) { | ||
totalCount | ||
} | ||
} | ||
} | ||
two: issueOrPullRequest(number: 200) { | ||
... on Issue { | ||
closed | ||
assignees(first: $first) { | ||
totalCount | ||
} | ||
} | ||
... on PullRequest { | ||
changedFiles | ||
assignees(first: $first) { | ||
totalCount | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
query ProjectMetadataQuery($id: ID!, $after: String) { | ||
node(id: $id) { | ||
... on ProjectV2 { | ||
id | ||
title | ||
number | ||
public | ||
readme | ||
shortDescription | ||
url | ||
fields(first: 100) { | ||
totalCount | ||
pageInfo { | ||
hasNextPage | ||
endCursor | ||
hasPreviousPage | ||
startCursor | ||
} | ||
nodes { | ||
... on ProjectV2SingleSelectField { | ||
name | ||
dataType | ||
options { | ||
id | ||
name | ||
nameHTML | ||
} | ||
} | ||
... on ProjectV2Field { | ||
name | ||
dataType | ||
} | ||
... on ProjectV2IterationField { | ||
name | ||
dataType | ||
configuration { | ||
duration | ||
startDay | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
83 changes: 83 additions & 0 deletions
83
cynic-querygen/tests/snapshots/github_tests__inline_fragment_with_renames.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
source: cynic-querygen/tests/github-tests.rs | ||
expression: "document_to_fragment_structs(query, schema,\n &QueryGenOptions::default()).expect(\"QueryGen Failed\")" | ||
--- | ||
#[derive(cynic::QueryVariables, Debug)] | ||
pub struct RepoIssuesVariables { | ||
pub first: i32, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
#[cynic(graphql_type = "Query", variables = "RepoIssuesVariables")] | ||
pub struct RepoIssues { | ||
#[arguments(owner: "obmarg", name: "cynic")] | ||
pub repository: Option<Repository>, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
#[cynic(variables = "RepoIssuesVariables")] | ||
pub struct Repository { | ||
#[arguments(number: 100)] | ||
#[cynic(rename = "issueOrPullRequest")] | ||
pub one: Option<IssueOrPullRequest>, | ||
#[arguments(number: 200)] | ||
#[cynic(rename = "issueOrPullRequest")] | ||
pub two: Option<IssueOrPullRequest2>, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
#[cynic(variables = "RepoIssuesVariables")] | ||
pub struct PullRequest { | ||
pub changed_files: i32, | ||
#[arguments(first: $first)] | ||
pub assignees: UserConnection, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
#[cynic(graphql_type = "PullRequest", variables = "RepoIssuesVariables")] | ||
pub struct PullRequest2 { | ||
pub body: String, | ||
#[arguments(first: $first)] | ||
pub assignees: UserConnection, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
#[cynic(variables = "RepoIssuesVariables")] | ||
pub struct Issue { | ||
pub closed: bool, | ||
#[arguments(first: $first)] | ||
pub assignees: UserConnection, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
#[cynic(graphql_type = "Issue", variables = "RepoIssuesVariables")] | ||
pub struct Issue2 { | ||
pub body: String, | ||
#[arguments(first: $first)] | ||
pub assignees: UserConnection, | ||
} | ||
|
||
#[derive(cynic::QueryFragment, Debug)] | ||
pub struct UserConnection { | ||
pub total_count: i32, | ||
} | ||
|
||
#[derive(cynic::InlineFragments, Debug)] | ||
#[cynic(variables = "RepoIssuesVariables")] | ||
pub enum IssueOrPullRequest { | ||
Issue2(Issue2), | ||
PullRequest2(PullRequest2), | ||
#[cynic(fallback)] | ||
Unknown | ||
} | ||
|
||
#[derive(cynic::InlineFragments, Debug)] | ||
#[cynic(graphql_type = "IssueOrPullRequest", variables = "RepoIssuesVariables")] | ||
pub enum IssueOrPullRequest2 { | ||
Issue(Issue), | ||
PullRequest(PullRequest), | ||
#[cynic(fallback)] | ||
Unknown | ||
} | ||
|
||
|
Oops, something went wrong.