-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #287 from Ishad-M-I-M/service-id-support
Annotate GraphQL ID Types with `@graphql:ID` Annotation in Service Generation
- Loading branch information
Showing
7 changed files
with
180 additions
and
12 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
15 changes: 15 additions & 0 deletions
15
graphql-cli/src/test/resources/serviceGen/expectedServices/serviceForSchemaWithIDTypeApi.bal
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,15 @@ | ||
import ballerina/graphql; | ||
|
||
configurable int port = 9090; | ||
|
||
service SchemaWithIDTypeApi on new graphql:Listener(port) { | ||
# Fetch a book by its id | ||
# + id - The id of the book to fetch | ||
resource function get book(@graphql:ID string id) returns Book? { | ||
} | ||
|
||
# Fetch a list of books by their ids | ||
# + ids - The list of book ids to fetch | ||
resource function get books(@graphql:ID string[] ids) returns Book[] { | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
graphql-cli/src/test/resources/serviceGen/expectedServices/typesWithIDTypeRecordsAllowed.bal
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,20 @@ | ||
import ballerina/graphql; | ||
|
||
type SchemaWithIDTypeApi service object { | ||
*graphql:Service; | ||
# Fetch a book by its id | ||
# + id - The id of the book to fetch | ||
resource function get book(@graphql:ID string id) returns Book?; | ||
# Fetch a list of books by their ids | ||
# + ids - The list of book ids to fetch | ||
resource function get books(@graphql:ID string[] ids) returns Book[]; | ||
}; | ||
|
||
# Represents a book written by an author | ||
public type Book record {| | ||
# The id of the book, unique identifier | ||
@graphql:ID | ||
string id; | ||
# The title of the book | ||
string title; | ||
|}; |
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
21 changes: 21 additions & 0 deletions
21
graphql-cli/src/test/resources/serviceGen/graphqlSchemas/valid/SchemaWithIDTypeApi.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,21 @@ | ||
type Query { | ||
"Fetch a book by its id" | ||
book( | ||
"The id of the book to fetch" | ||
id: ID! | ||
): Book | ||
|
||
"Fetch a list of books by their ids" | ||
books( | ||
"The list of book ids to fetch" | ||
ids: [ID!]! | ||
): [Book!]! | ||
} | ||
|
||
"Represents a book written by an author" | ||
type Book { | ||
"The id of the book, unique identifier" | ||
id: ID! | ||
"The title of the book" | ||
title: String! | ||
} |
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