Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
ca7a766
initial commit
ThisaruGuruge Sep 14, 2020
44a9135
Add gradle wrapper
ThisaruGuruge Sep 14, 2020
27db703
Fix gradle build
ThisaruGuruge Sep 14, 2020
d1a69b3
Modify structure
ThisaruGuruge Sep 28, 2020
7fe09ed
Add resource functions with other return types
ThisaruGuruge Oct 2, 2020
32c5b91
Enable checkstyle plugin
ThisaruGuruge Oct 2, 2020
ac72337
Enable spotbugs plugin
ThisaruGuruge Oct 2, 2020
67f88d7
Add tests for graphQL
ThisaruGuruge Oct 5, 2020
70029b4
Improce build.gradle
ThisaruGuruge Oct 5, 2020
5709b5d
Add java debug options to gradle build
ThisaruGuruge Oct 5, 2020
d5c94ca
Add java debug options to gradle build
ThisaruGuruge Oct 5, 2020
5b416f0
Initial implementation of the graphql engine
ThisaruGuruge Oct 5, 2020
ca1f556
Add upstream repo commits
ThisaruGuruge Oct 5, 2020
8c5cdc0
Update readme file
ThisaruGuruge Oct 5, 2020
791e185
Add a simple parser
ThisaruGuruge Oct 5, 2020
8bebe1e
Restructure the code
ThisaruGuruge Oct 5, 2020
ddb03e1
Restructure the code and update spotbugs version
ThisaruGuruge Oct 6, 2020
cdb4b1a
Mark functions isolated
ThisaruGuruge Oct 6, 2020
631324d
Update java package naming to io.ballerina
ThisaruGuruge Oct 6, 2020
c5206a8
Implement basic document result
ThisaruGuruge Oct 7, 2020
510a117
Update stdlib versions
ThisaruGuruge Oct 7, 2020
7f665fd
Update HTTP version
ThisaruGuruge Oct 7, 2020
1ff50ff
Add service configuration annotation
ThisaruGuruge Oct 7, 2020
53804af
Bind HTTP service and Listener to GraphQL listener
ThisaruGuruge Oct 9, 2020
c8f3931
Reformat the code to create engine object
ThisaruGuruge Oct 9, 2020
5dd1d23
Implement output JSON generation for a flat resource
ThisaruGuruge Oct 12, 2020
6a3402a
Add field not found error for the output object
ThisaruGuruge Oct 12, 2020
349d3ca
Migrate to Java 11
ThisaruGuruge Oct 12, 2020
ca99c15
Remove exporting the native module
ThisaruGuruge Oct 12, 2020
79d3016
Implement new parser for general notation
ThisaruGuruge Oct 13, 2020
1f6cef2
Replace fields strings with tokens
ThisaruGuruge Oct 13, 2020
1e81206
Add EOF validation and word validation to the parser
ThisaruGuruge Oct 13, 2020
b7e6227
Add extra escape characters for json error messages
ThisaruGuruge Oct 13, 2020
fabaef4
Add tests for parser
ThisaruGuruge Oct 13, 2020
f9e5850
Update test with wrong params
ThisaruGuruge Oct 13, 2020
dab6e8a
Add inputs for wrapper function
ThisaruGuruge Oct 13, 2020
e1d7eda
Add license headers
ThisaruGuruge Oct 13, 2020
aaaae26
add
ThisaruGuruge Oct 13, 2020
610ca2c
Improve error messages
ThisaruGuruge Oct 13, 2020
32b490f
Make columns count from 1 in parser
ThisaruGuruge Oct 13, 2020
be681ea
Make engine an object
ThisaruGuruge Oct 15, 2020
8ab2f4a
Fix spelling issues in variable naming
ThisaruGuruge Oct 15, 2020
0516fde
Restructure the error types
ThisaruGuruge Oct 15, 2020
4a0ed46
Refactor module structure
ThisaruGuruge Oct 15, 2020
be40642
Break parsing, validating, and execution into separate stages
ThisaruGuruge Oct 15, 2020
b35f529
Move request processing to separate function
ThisaruGuruge Oct 15, 2020
e950cbe
Add test groups to tests
ThisaruGuruge Oct 16, 2020
a331fdf
Change operation array to operation map in Document
ThisaruGuruge Oct 16, 2020
ba0697b
Add operation name functionality
ThisaruGuruge Oct 16, 2020
73002e5
Add functionality to handle GET requests
ThisaruGuruge Oct 16, 2020
bd07c4d
Add functionality to handle GET requests
ThisaruGuruge Oct 16, 2020
3250f20
Add test for listener happy path
ThisaruGuruge Oct 16, 2020
33b4ae6
Update http client call to new syntax
ThisaruGuruge Oct 19, 2020
3ed8ce8
Update to new ballerina runtime api names
ThisaruGuruge Oct 20, 2020
08d1fe8
Update listener tests
ThisaruGuruge Oct 20, 2020
a989a8d
Initial step of new parser
ThisaruGuruge Oct 21, 2020
a35b7ab
Improve parser to handle syntax errors
ThisaruGuruge Oct 21, 2020
434ff21
Complete the lexer
ThisaruGuruge Oct 26, 2020
8344bf6
Add negative value parsing support
ThisaruGuruge Oct 26, 2020
0562f16
Complete shorthand notation
ThisaruGuruge Oct 26, 2020
b534b00
Complete arguments for fields
ThisaruGuruge Oct 26, 2020
c531e91
Complete the parser
ThisaruGuruge Oct 27, 2020
c1bc75b
Add char reader tests
ThisaruGuruge Oct 27, 2020
b4f59a1
Add char reader tests
ThisaruGuruge Oct 27, 2020
35bce18
Complete the lexer
ThisaruGuruge Oct 27, 2020
0c99042
Add resource files for tests
ThisaruGuruge Oct 27, 2020
ebb22df
Bump ballerina lang version and add filepath
ThisaruGuruge Oct 27, 2020
8244ee1
Change version numbers
ThisaruGuruge Oct 27, 2020
b59d06b
Improve parser functionality
ThisaruGuruge Oct 28, 2020
f643e26
Add expected values for parser tests in separate file
ThisaruGuruge Oct 28, 2020
097cf92
Add filepath dependency
ThisaruGuruge Oct 28, 2020
b73d3b6
Add complex document parser test
ThisaruGuruge Oct 28, 2020
43dc1ee
Add new document with two anonymous functions
ThisaruGuruge Oct 28, 2020
62ce579
Add isEof funnction to char reader
ThisaruGuruge Oct 29, 2020
7ad1408
Update lexer types
ThisaruGuruge Oct 29, 2020
8812c2b
Improve lexer to handle Eof efficiently
ThisaruGuruge Oct 29, 2020
94887d2
Fix parser tests with new implementation
ThisaruGuruge Oct 29, 2020
4594150
Add token array as a buffer in lexer
ThisaruGuruge Oct 29, 2020
d60819f
Improve char reader, lexer and the parser
ThisaruGuruge Nov 1, 2020
f808e38
Add more tests for parser
ThisaruGuruge Nov 1, 2020
fd7dab8
add more documents for parsing tests
ThisaruGuruge Nov 1, 2020
964844c
add more documents for parsing tests
ThisaruGuruge Nov 1, 2020
b71bb9a
Complete validation
ThisaruGuruge Nov 2, 2020
79e2b74
Fix compiling issues in Engine and the listener
ThisaruGuruge Nov 2, 2020
b24ee54
Make comma insignificant
ThisaruGuruge Nov 5, 2020
eb26acc
Change T_WORD to T_TEXT
ThisaruGuruge Nov 5, 2020
b5711c2
Remove text type from argument types
ThisaruGuruge Nov 9, 2020
c65775b
Add test for insignificant comma
ThisaruGuruge Nov 9, 2020
f75e47b
Add commas to test insignificant comma
ThisaruGuruge Nov 9, 2020
c86452d
Separate parsing and validation
ThisaruGuruge Nov 9, 2020
4cdd097
Separate parsing and validation
ThisaruGuruge Nov 9, 2020
81c8da8
Separate Name and Value records from argument record
ThisaruGuruge Nov 9, 2020
63e4e84
Generate syntax tree
ThisaruGuruge Nov 9, 2020
b7a80c7
Update syntax to tree implementation
ThisaruGuruge Nov 10, 2020
ec30c61
Add syntax tree implementation enabling visitors
ThisaruGuruge Nov 10, 2020
aa58f55
Implement visitor
ThisaruGuruge Nov 12, 2020
2581c45
Implement visitor pattern
ThisaruGuruge Nov 13, 2020
da77441
Change next to read
ThisaruGuruge Nov 13, 2020
cc1eb27
Change readStringToken to readStringLiteral
ThisaruGuruge Nov 13, 2020
c5a5054
Change DECIMAL to DOT
ThisaruGuruge Nov 13, 2020
df0ed47
Rename constants and function as per the review
ThisaruGuruge Nov 13, 2020
09a84ae
Change 'type to kind
ThisaruGuruge Nov 13, 2020
1f979ba
Change lexer to use new char reader
ThisaruGuruge Nov 16, 2020
70d4efc
Migrate to new runtime changes
ThisaruGuruge Nov 16, 2020
5720a5d
Remove redundant type definition
ThisaruGuruge Nov 16, 2020
75a77e7
Update visitor returns types
ThisaruGuruge Nov 16, 2020
bd00c25
Update lexer tests
ThisaruGuruge Nov 18, 2020
2dab816
Change AbstractNode to Node
ThisaruGuruge Nov 18, 2020
a8c5e6c
Migrate to file API change
ThisaruGuruge Nov 19, 2020
09faa87
revert unnecessary content removal
ThisaruGuruge Nov 19, 2020
5e59e2f
Change parser to a recursive descent parser
ThisaruGuruge Nov 19, 2020
bb51408
Replace regex pattern matching with native character matching function
ThisaruGuruge Nov 19, 2020
c627012
Migrate to Package API changes
ThisaruGuruge Nov 22, 2020
d0ad182
Remove cache issue workarounds from build file
ThisaruGuruge Nov 23, 2020
a643bc2
Implement more than one anonymous operation validation
ThisaruGuruge Nov 23, 2020
dbda81b
Move char reader to a separate module
ThisaruGuruge Nov 25, 2020
a0de18d
Update dependency versions
ThisaruGuruge Dec 1, 2020
2a2db54
Modularize the package with the package API changes
ThisaruGuruge Dec 1, 2020
3c5b347
Migrate to service typing
ThisaruGuruge Dec 7, 2020
2c4eea9
Remove reflect dependency
ThisaruGuruge Dec 8, 2020
142228e
Generate Schema record for flat services
ThisaruGuruge Dec 8, 2020
4a49af8
Implement Schema generration for resources returning record types
ThisaruGuruge Dec 8, 2020
34e2a0a
Make Schema record comply with the graphql spec
ThisaruGuruge Dec 8, 2020
84ff4d0
Fix issues when generating schema record
ThisaruGuruge Dec 8, 2020
295eda3
Remove unnecessary constructor
ThisaruGuruge Dec 8, 2020
ebdcc95
Complete schema generation except for introspection types
ThisaruGuruge Dec 8, 2020
d85593a
Add introspection types to the Schema record
ThisaruGuruge Dec 8, 2020
8158166
Replace array with maps in Schema
ThisaruGuruge Dec 9, 2020
7a15166
Make Node properties private
ThisaruGuruge Dec 9, 2020
1c47ca0
Implement field validation
ThisaruGuruge Dec 9, 2020
394e451
Import stringutils module
ThisaruGuruge Dec 9, 2020
f60ad2e
Complete validation stage
ThisaruGuruge Dec 9, 2020
626bf6d
Update README file with build steps
ThisaruGuruge Dec 10, 2020
815aeec
Update Package.md file
ThisaruGuruge Dec 10, 2020
04bf0ad
Update gradle wrapper version
ThisaruGuruge Dec 10, 2020
0427ede
Update gradle wrapper version
ThisaruGuruge Dec 10, 2020
0ea038a
Temporary disable reflect module
ThisaruGuruge Dec 10, 2020
f536849
Remove unnecessary classes and rearrange the code
ThisaruGuruge Dec 10, 2020
98deaa6
Update doc comments
ThisaruGuruge Dec 10, 2020
7da4811
Implement subfield validation
ThisaruGuruge Dec 10, 2020
742eea4
Implement execution for primitive type resources
ThisaruGuruge Dec 10, 2020
05288f0
Revert accidently committed version numbers
ThisaruGuruge Dec 10, 2020
ec080eb
Complete functionality of Scalar type resource execution
ThisaruGuruge Dec 10, 2020
ff514fa
Fix anonymous function not returning result issue
ThisaruGuruge Dec 10, 2020
d531a47
Add github workflow config files
ThisaruGuruge Dec 10, 2020
81c3468
Fix indentations in githib workflow yml files
ThisaruGuruge Dec 10, 2020
3cfc81a
Remove redundant build
ThisaruGuruge Dec 10, 2020
7d098e3
Disable windows test
ThisaruGuruge Dec 10, 2020
d32c1f2
Migrate to Ballerina Future
ThisaruGuruge Dec 11, 2020
8b909a1
Fix invalid location retrieval
ThisaruGuruge Dec 11, 2020
5361e14
Fix argument processing issue
ThisaruGuruge Dec 11, 2020
2d35bc0
Address the code review suggestions
ThisaruGuruge Dec 11, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build

on:
repository_dispatch:
types: [ stdlib-publish-snapshot ]
push:
branches:
- master
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
env:
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew publish
- name: Dispatch Dependent Module Builds
if: github.event.action != 'stdlib-publish-snapshot'
run: |
echo "Triggering dependent module builds..." && \
curl -u ${{ secrets.BALLERINA_BOT_USERNAME }} -X POST \
https://api.github.com/repos/ballerina-platform/ballerina-standard-library/dispatches \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--data '{
"event_type": "stdlib-module-push",
"client_payload": {
"module": "${{ github.repository }}"
}
}'
58 changes: 58 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish release

on:
workflow_dispatch:
repository_dispatch:
types: [ stdlib-release-pipeline ]

jobs:
publish-release:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set version env variable
run: echo "VERSION=$((grep -w 'version' | cut -d= -f2) < gradle.properties | cut -d- -f1)" >> $GITHUB_ENV
- name: Pre release depenency version update
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
echo "Version: ${VERSION}"
git config user.name ${{ secrets.BALLERINA_BOT_USERNAME }}
git config user.email ${{ secrets.BALLERINA_BOT_EMAIL }}
git checkout -b release-${VERSION}
sed -i 's/ballerinaLangVersion=\(.*\)-SNAPSHOT/ballerinaLangVersion=\1/g' gradle.properties
sed -i 's/stdlib\(.*\)=\(.*\)-SNAPSHOT/stdlib\1=\2/g' gradle.properties
git add gradle.properties
git commit -m "Move dependencies to stable version" || echo "No changes to commit"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Publish artifact
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
BALLERINA_CENTRAL_ACCESS_TOKEN: ${{ secrets.BALLERINA_CENTRAL_ACCESS_TOKEN }}
packageUser: ${{ secrets.BALLERINA_BOT_USERNAME }}
packagePAT: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
./gradlew release -Prelease.useAutomaticVersion=true
./gradlew -Pversion=${VERSION} publish -x test
- name: Create Github release from the release tag
run: |
curl --request POST 'https://api.github.com/repos/ballerina-platform/module-ballerina-graphql/releases' \
--header 'Accept: application/vnd.github.v3+json' \
--header 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--header 'Content-Type: application/json' \
--data-raw '{
"tag_name": "v'"$VERSION"'",
"name": "module-ballerina-graphql-v'"$VERSION"'"
}'
- name: Post release PR
env:
GITHUB_TOKEN: ${{ secrets.BALLERINA_BOT_TOKEN }}
run: |
curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
bin/hub pull-request -m "[Automated] Sync master after "$VERSION" release"
33 changes: 33 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Pull Request Build

on: [ pull_request ]

jobs:
ubuntu-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build

windows-build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew.bat build -x test
24 changes: 24 additions & 0 deletions .github/workflows/stdlib-workflow-trigger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Stdlib Dependency Update

on:
push:
branches:
- master
paths:
- 'build.gradle'
- 'gradle.properties'

jobs:
trigger-workflow:
runs-on: ubuntu-latest
if: github.repository_owner == 'ballerina-platform'
steps:
- name: Initiating repository event
run: |
curl -u ${{ secrets.BALLERINA_BOT_USERNAME }} -X POST \
https://api.github.com/repos/ballerina-platform/ballerina-standard-library/dispatches \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: token ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--data '{
"event_type": "dependency-update"
}'
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
.mtj.tmp/

# Package Files #
!gradle/wrapper/gradle-wrapper.jar
*.jar
*.war
*.nar
Expand All @@ -19,5 +20,21 @@
*.tar.gz
*.rar

# System files
.DS_Store

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# IDE-related files
.idea
.code

# Build Files
.gradle
target
build

# Ballerina
velocity.log*
*Ballerina.lock
73 changes: 71 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,71 @@
# module-ballerina-graphql
This is the Ballerina GraphQL module, which is a part of Ballerina Language Standard Library
Ballerina GraphQL Library
===================

The GraphQL library is one of the standard library modules of the <a target="_blank" href="https://ballerina.io/">Ballerina</a> language.

## Building from the Source

### Setting Up the Prerequisites

1. Download and install Java SE Development Kit (JDK) version 11 (from one of the following locations).

* [Oracle](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)
* [OpenJDK](https://adoptopenjdk.net/)

> **Note:** Set the JAVA_HOME environment variable to the path name of the directory into which you installed JDK.

2. Generate a Github access token with read package permissions, then set the following `env` variables:
```
export packageUser=<Your GitHub Username>
export packagePAT=<GitHub Personal Access Token>
```

### Building the Source

Execute the commands below to build from the source.

1. To build the library:
```
./gradlew clean build
```

2. To run the tests:
```
./gradlew clean test
```

3. To run a group of tests
```
./gradlew clean test -Pgroups=<test_group_names>
```

4. To build the module without the tests:
```
./gradlew clean build -x test
```

5. To debug module implementation:
```
./gradlew clean build -Pdebug=<port>
```

6. To debug the module with Ballerina language:
```
./gradlew clean build -PbalJavaDebug=<port>
```

## Contributing to Ballerina

As an open source project, Ballerina welcomes contributions from the community.

For more information, go to the [contribution guidelines](https://github.com/ballerina-platform/ballerina-lang/blob/master/CONTRIBUTING.md).

## Code of Conduct

All the contributors are encouraged to read the [Ballerina Code of Conduct](https://ballerina.io/code-of-conduct).

## Useful Links

* Discuss the code changes of the Ballerina project in [ballerina-dev@googlegroups.com](mailto:ballerina-dev@googlegroups.com).
* Chat live with us via our [Slack channel](https://ballerina.io/community/slack/).
* Post all technical questions on Stack Overflow with the [#ballerina](https://stackoverflow.com/questions/tagged/ballerina) tag.
46 changes: 46 additions & 0 deletions build-config/checkstyle/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

plugins {
id "de.undercouch.download"
}

task downloadMultipleFiles(type: Download) {
src([
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.3/checkstyle/checkstyle.xml',
'https://raw.githubusercontent.com/wso2/code-quality-tools/v1.3/checkstyle/suppressions.xml'
])
overwrite false
onlyIfNewer true
dest buildDir
}

jar {
enabled = false
}

clean {
enabled = false
}

artifacts.add('default', file("$project.buildDir/checkstyle.xml")) {
builtBy('downloadMultipleFiles')
}

artifacts.add('default', file("$project.buildDir/suppressions.xml")) {
builtBy('downloadMultipleFiles')
}
Loading