Skip to content

Commit

Permalink
Merge pull request #16 from ashley-taylor/master
Browse files Browse the repository at this point in the history
add one of support and remove jackson
  • Loading branch information
ashleyt authored Oct 17, 2024
2 parents 4aa8283 + ee2f11c commit 394a9a4
Show file tree
Hide file tree
Showing 135 changed files with 7,325 additions and 4,026 deletions.
109 changes: 85 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,90 @@
name: Release
on:
workflow_dispatch
permissions:
contents: write
packages: write
on:
workflow_dispatch:
inputs:
releaseType:
type: choice
description: "Release type"
required: true
default: minor
options:
- patch
- minor
- major
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Release
uses: qcastel/[email protected]
with:
release-branch-name: "master"
maven-args: "-P sonatype"
git-release-bot-name: "release-bot"
git-release-bot-email: "[email protected]"

gpg-enabled: "true"
gpg-key-id: ${{ secrets.GPG_KEY_ID }}
gpg-key: ${{ secrets.GPG_KEY }}

maven-repo-server-id: sonatype
maven-repo-server-username: ${{ secrets.MVN_REPO_PRIVATE_REPO_USER }}
maven-repo-server-password: ${{ secrets.MVN_REPO_PRIVATE_REPO_PASSWORD }}

access-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v4

- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- uses: whelk-io/maven-settings-xml-action@v22
with:
servers: >
[
{ "id": "sonatype", "username": "${{ secrets.MVN_REPO_PRIVATE_REPO_USER }}", "password": "${{ secrets.MVN_REPO_PRIVATE_REPO_PASSWORD }}" }
]
- name: set name
run: |
git config --global user.name "release-bot";
git config --global user.email "[email protected]";
- name: add key
run: |
echo "${{ secrets.GPG_KEY }}" | base64 -d > private.key
gpg --batch --import ./private.key
rm ./private.key
gpg --list-secret-keys --keyid-format LONG
- name: Get current development version
id: get_version
run: |
VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed 's/-SNAPSHOT//' )
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Generate versions
id: generate_versions
uses: WyriHaximus/[email protected]
with:
version: ${{ steps.get_version.outputs.version }}

- name: Pick release version
id: pick_release_version
run: |
VERSION=$(
case ${{ github.event.inputs.releaseType }} in
("minor") echo "${{ steps.generate_versions.outputs.minor }}" ;;
("major") echo "${{ steps.generate_versions.outputs.major }}" ;;
("patch") echo "${{ steps.generate_versions.outputs.patch }}" ;;
esac
)
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: prepare
run: |
mvn release:prepare -Dusername=${{ secrets.GITHUB_TOKEN }} \
-DreleaseVersion=${{ steps.pick_release_version.outputs.version }} \
-DdevelopmentVersion=${{ steps.pick_release_version.outputs.version }}-SNAPSHOT \
-P sonatype
- name: release
run: |
mvn release:perform -Dusername=${{ secrets.GITHUB_TOKEN }} \
-DreleaseVersion=${{ steps.pick_release_version.outputs.version }} \
-DdevelopmentVersion=${{ steps.pick_release_version.outputs.version }}-SNAPSHOT \
-Darguments="-DskipTests" \
-P sonatype
29 changes: 15 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
name: Test
on:
on:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build with Maven
run: mvn -B test --file pom.xml
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 21
distribution: zulu
- name: Build with Maven
run: mvn -B test --file pom.xml
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target/
/.classpath
/.project
.settings
.settings
.idea/*

36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -337,12 +337,42 @@ public class AssetRestrict implements RestrictType<Animal> {

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

```java
@Retention(RUNTIME)
@Directive(AdminOnly.AdminOnlyDirective.class)
@Directive( { Introspection.DirectiveLocation.FIELD_DEFINITION } )
public @interface CustomDirective {
String input();
}
```
This directive can now be placed where set:
```java
@Query
@CustomDirective(input = "Custom Directive Contents")
public static String sayHello() {
return "Hello world";
}
```
Which will then end up on the schema like so
```graphql
directive @CustomDirective(input: String!) on FIELD_DEFINITION

type Query {
sayHello: String! @CustomDirective(input: "Custom Directive Contents")
}
```

## DataFetcherWrapper
Similar to the setup of a Directive the DataFetcherWrapper is created as an
annotation. This annotation is then passed into the DirectiveCaller allowing
you to add options to the annotation if need be

```java
@Retention(RUNTIME)
@DataFetcherWrapper(AdminOnly.AdminOnlyDirective.class)
public @interface AdminOnly {
...
}
Expand Down
Loading

0 comments on commit 394a9a4

Please sign in to comment.