Skip to content

Commit

Permalink
Merge pull request #1582 from MohamedSabthar/id-spec
Browse files Browse the repository at this point in the history
Add example for list of IDs
  • Loading branch information
MohamedSabthar authored Aug 22, 2023
2 parents 0828c44 + 8d30377 commit dcee64e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions docs/spec/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
_Owners_: @shafreenAnfar @DimuthuMadushan @ThisaruGuruge @MohamedSabthar \
_Reviewers_: @shafreenAnfar @ThisaruGuruge @DimuthuMadushan @ldclakmal \
_Created_: 2022/01/06 \
_Updated_: 2023/08/17 \
_Updated_: 2023/08/22 \
_Edition_: Swan Lake \
_GraphQL Specification_: [October 2021](https://spec.graphql.org/October2021/)

Expand Down Expand Up @@ -695,14 +695,20 @@ When the `@graphql:ID` annotation is used, the generated schema will show the fi

>**Note:** If the `@graphql:ID` annotation is used for a field, the values of those fields will always be serialized as strings.

###### Example: Scalar type ID
>**Note:** Applying a `@graphql:ID` annotation to an array indicates it as a list of `ID` elements.

###### Example: ID Scalar Type
```ballerina
service on new graphql:Listener(9090) {

resource function get profileById(@graphql:ID int id) returns Profile {
// ...
}

resource function get profileByIds(@graphql:ID int[] ids) returns Profile[] {
// ...
}

resource function get studentByStringId(@graphql:ID string id) returns Student {
// ...
}
Expand All @@ -722,7 +728,7 @@ public distinct service class Student {
final string id;
final string name;

function init(@graphql:ID string id, string name) {
function init(string id, string name) {
self.id = id;
self.name = name;
}
Expand Down

0 comments on commit dcee64e

Please sign in to comment.