Skip to content

Commit 394a9a4

Browse files
authored
Merge pull request #16 from ashley-taylor/master
add one of support and remove jackson
2 parents 4aa8283 + ee2f11c commit 394a9a4

File tree

135 files changed

+7325
-4026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

135 files changed

+7325
-4026
lines changed

.github/workflows/release.yml

Lines changed: 85 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,90 @@
11
name: Release
2-
on:
3-
workflow_dispatch
2+
permissions:
3+
contents: write
4+
packages: write
5+
on:
6+
workflow_dispatch:
7+
inputs:
8+
releaseType:
9+
type: choice
10+
description: "Release type"
11+
required: true
12+
default: minor
13+
options:
14+
- patch
15+
- minor
16+
- major
417
jobs:
518
release:
619
runs-on: ubuntu-latest
720
steps:
8-
- uses: actions/checkout@v2
9-
- name: Set up JDK 11
10-
uses: actions/setup-java@v1
11-
with:
12-
java-version: 11
13-
- name: Release
14-
uses: qcastel/[email protected]
15-
with:
16-
release-branch-name: "master"
17-
maven-args: "-P sonatype"
18-
git-release-bot-name: "release-bot"
19-
git-release-bot-email: "[email protected]"
20-
21-
gpg-enabled: "true"
22-
gpg-key-id: ${{ secrets.GPG_KEY_ID }}
23-
gpg-key: ${{ secrets.GPG_KEY }}
24-
25-
maven-repo-server-id: sonatype
26-
maven-repo-server-username: ${{ secrets.MVN_REPO_PRIVATE_REPO_USER }}
27-
maven-repo-server-password: ${{ secrets.MVN_REPO_PRIVATE_REPO_PASSWORD }}
28-
29-
access-token: ${{ secrets.GITHUB_TOKEN }}
21+
- uses: actions/checkout@v4
22+
23+
- uses: actions/cache@v4
24+
with:
25+
path: ~/.m2/repository
26+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27+
restore-keys: |
28+
${{ runner.os }}-maven-
29+
- name: Set up JDK 21
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: 21
33+
distribution: zulu
34+
- uses: whelk-io/maven-settings-xml-action@v22
35+
with:
36+
servers: >
37+
[
38+
{ "id": "sonatype", "username": "${{ secrets.MVN_REPO_PRIVATE_REPO_USER }}", "password": "${{ secrets.MVN_REPO_PRIVATE_REPO_PASSWORD }}" }
39+
]
40+
- name: set name
41+
run: |
42+
git config --global user.name "release-bot";
43+
git config --global user.email "[email protected]";
44+
45+
- name: add key
46+
run: |
47+
echo "${{ secrets.GPG_KEY }}" | base64 -d > private.key
48+
gpg --batch --import ./private.key
49+
rm ./private.key
50+
gpg --list-secret-keys --keyid-format LONG
51+
52+
- name: Get current development version
53+
id: get_version
54+
run: |
55+
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//' )
56+
echo "version=$VERSION" >> $GITHUB_OUTPUT
57+
58+
- name: Generate versions
59+
id: generate_versions
60+
uses: WyriHaximus/[email protected]
61+
with:
62+
version: ${{ steps.get_version.outputs.version }}
63+
64+
- name: Pick release version
65+
id: pick_release_version
66+
run: |
67+
VERSION=$(
68+
case ${{ github.event.inputs.releaseType }} in
69+
("minor") echo "${{ steps.generate_versions.outputs.minor }}" ;;
70+
("major") echo "${{ steps.generate_versions.outputs.major }}" ;;
71+
("patch") echo "${{ steps.generate_versions.outputs.patch }}" ;;
72+
esac
73+
)
74+
echo "version=$VERSION" >> $GITHUB_OUTPUT
75+
76+
77+
- name: prepare
78+
run: |
79+
mvn release:prepare -Dusername=${{ secrets.GITHUB_TOKEN }} \
80+
-DreleaseVersion=${{ steps.pick_release_version.outputs.version }} \
81+
-DdevelopmentVersion=${{ steps.pick_release_version.outputs.version }}-SNAPSHOT \
82+
-P sonatype
83+
84+
- name: release
85+
run: |
86+
mvn release:perform -Dusername=${{ secrets.GITHUB_TOKEN }} \
87+
-DreleaseVersion=${{ steps.pick_release_version.outputs.version }} \
88+
-DdevelopmentVersion=${{ steps.pick_release_version.outputs.version }}-SNAPSHOT \
89+
-Darguments="-DskipTests" \
90+
-P sonatype

.github/workflows/test.yml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
name: Test
2-
on:
2+
on:
33
push:
44

55
jobs:
66
build:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/cache@v1
11-
with:
12-
path: ~/.m2/repository
13-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
14-
restore-keys: |
15-
${{ runner.os }}-maven-
16-
- name: Set up JDK 11
17-
uses: actions/setup-java@v1
18-
with:
19-
java-version: 11
20-
- name: Build with Maven
21-
run: mvn -B test --file pom.xml
9+
- uses: actions/checkout@v4
10+
- uses: actions/cache@v4
11+
with:
12+
path: ~/.m2/repository
13+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
14+
restore-keys: |
15+
${{ runner.os }}-maven-
16+
- name: Set up JDK 21
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: 21
20+
distribution: zulu
21+
- name: Build with Maven
22+
run: mvn -B test --file pom.xml

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/target/
22
/.classpath
33
/.project
4-
.settings
4+
.settings
5+
.idea/*
6+

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,42 @@ public class AssetRestrict implements RestrictType<Animal> {
337337

338338
## Directives
339339
These are similar to GraphQL directives but just implemented on the java model
340-
You define a custom annotation and add the `@Directive` to it
341-
This annotation in then passed into the DirectiveCaller allowing you to add options to the annotation if need be
340+
You define a custom annotation and add the `@Directive` to it.
341+
The directive annotation must contain an array of DirectiveLocations which will be used in the GraphQL definition.
342+
Any function defined in the annotation will be placed on the schema definition as an argument.
342343

343344
```java
344345
@Retention(RUNTIME)
345-
@Directive(AdminOnly.AdminOnlyDirective.class)
346+
@Directive( { Introspection.DirectiveLocation.FIELD_DEFINITION } )
347+
public @interface CustomDirective {
348+
String input();
349+
}
350+
```
351+
This directive can now be placed where set:
352+
```java
353+
@Query
354+
@CustomDirective(input = "Custom Directive Contents")
355+
public static String sayHello() {
356+
return "Hello world";
357+
}
358+
```
359+
Which will then end up on the schema like so
360+
```graphql
361+
directive @CustomDirective(input: String!) on FIELD_DEFINITION
362+
363+
type Query {
364+
sayHello: String! @CustomDirective(input: "Custom Directive Contents")
365+
}
366+
```
367+
368+
## DataFetcherWrapper
369+
Similar to the setup of a Directive the DataFetcherWrapper is created as an
370+
annotation. This annotation is then passed into the DirectiveCaller allowing
371+
you to add options to the annotation if need be
372+
373+
```java
374+
@Retention(RUNTIME)
375+
@DataFetcherWrapper(AdminOnly.AdminOnlyDirective.class)
346376
public @interface AdminOnly {
347377
...
348378
}

0 commit comments

Comments
 (0)