-
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.
Implement service generation with @graphql:ID annotation in service f…
…unctions
- Loading branch information
1 parent
c36f23d
commit 804f9de
Showing
6 changed files
with
177 additions
and
68 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; | ||
|}; |
22 changes: 22 additions & 0 deletions
22
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,22 @@ | ||
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