Skip to content

Commit

Permalink
Merge pull request #1 from smallrye/main
Browse files Browse the repository at this point in the history
[pull] main from smallrye:main
  • Loading branch information
rubik-cube-man authored Aug 12, 2024
2 parents 37a74d4 + 266bc1e commit ae297cb
Show file tree
Hide file tree
Showing 116 changed files with 1,483 additions and 337 deletions.
4 changes: 2 additions & 2 deletions .github/project.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: SmallRye GraphQL
release:
current-version: 2.8.1
next-version: 2.8.2-SNAPSHOT
current-version: 2.9.1
next-version: 2.9.2-SNAPSHOT
Binary file removed .github/release/maven-settings.xml.gpg
Binary file not shown.
Binary file removed .github/release/smallrye-sign.asc.gpg
Binary file not shown.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ jobs:
- name: checkout Quarkus repository
uses: actions/checkout@v2
with:
repository: quarkusio/quarkus
ref: main
repository: mskacelik/quarkus
ref: srgql-2.9.1
path: quarkus

- uses: actions/[email protected]
Expand All @@ -120,7 +120,7 @@ jobs:
cd quarkus && \
mvn install -Dsmallrye-graphql.version=$SMALLRYE_VERSION -Dquickly && \
mvn verify -Dsmallrye-graphql.version=$SMALLRYE_VERSION -Dnative \
-pl extensions/smallrye-graphql-client/deployment,extensions/smallrye-graphql-client/runtime,extensions/smallrye-graphql/deployment,extensions/smallrye-graphql/runtime,integration-tests/smallrye-graphql,integration-tests/smallrye-graphql-client,integration-tests/hibernate-orm-graphql-panache,extensions/oidc-client-graphql/deployment,extensions/oidc-client-graphql/runtime
-pl extensions/smallrye-graphql-client/deployment,extensions/smallrye-graphql-client/runtime,extensions/smallrye-graphql/deployment,extensions/smallrye-graphql/runtime,integration-tests/smallrye-graphql,integration-tests/smallrye-graphql-client,integration-tests/hibernate-orm-graphql-panache,extensions/oidc-client-graphql/deployment,extensions/oidc-client-graphql/runtime,tcks/microprofile-graphql -Ptcks
quality:
needs: [build]
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@ jobs:
- uses: actions/[email protected]
with:
java-version: 11
server-id: 'oss.sonatype'
server-username: 'MAVEN_DEPLOY_USERNAME'
server-password: 'MAVEN_DEPLOY_TOKEN'
gpg-private-key: ${{secrets.MAVEN_GPG_PRIVATE_KEY}}
gpg-passphrase: 'MAVEN_GPG_PASSPHRASE'

- name: Install graphviz
run: sudo apt install graphviz

- name: maven release ${{steps.metadata.outputs.current-version}}
env:
MAVEN_DEPLOY_USERNAME: ${{secrets.MAVEN_DEPLOY_USERNAME}}
MAVEN_DEPLOY_TOKEN: ${{secrets.MAVEN_DEPLOY_TOKEN}}
MAVEN_GPG_PASSPHRASE: ${{secrets.MAVEN_GPG_PASSPHRASE}}
run: |
java -version
gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.SECRET_PASSPHRASE}}" --output smallrye-sign.asc .github/release/smallrye-sign.asc.gpg
gpg --quiet --batch --yes --decrypt --passphrase="${{secrets.SECRET_PASSPHRASE}}" --output maven-settings.xml .github/release/maven-settings.xml.gpg
gpg --fast-import --no-tty --batch --yes smallrye-sign.asc
git config --global user.name "SmallRye CI"
git config --global user.email "[email protected]"
git checkout -b release
Expand All @@ -47,10 +53,10 @@ jobs:
git add tools/gradle-plugin/gradle.properties
git commit -m "Update Gradle plugin version"
# make sure the server/integration-tests-jdk16 gets its version updated too: include the jdk16plus profile
mvn -X -e -B release:prepare -Prelease -Pjdk16plus -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} -s maven-settings.xml
mvn -X -e -B release:prepare -Prelease -Pjdk16plus -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
git checkout ${{github.base_ref}}
git rebase release
mvn -X -e -B release:perform -Prelease -Pjdk16plus -s maven-settings.xml
mvn -X -e -B release:perform -Prelease -Pjdk16plus
git push
git push --tags
Expand Down
16 changes: 11 additions & 5 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:subscriptions-transport-ws: https://github.com/apollographql/subscriptions-transport-ws
:graphql-ws: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
:graphql-federation: https://www.apollographql.com/docs/federation
:vertx: https://vertx.io/

image:https://github.com/smallrye/smallrye-graphql/workflows/SmallRye%20Build/badge.svg?branch=main[link=https://github.com/smallrye/smallrye-graphql/actions?query=workflow%3A%22SmallRye+Build%22]
image:https://sonarcloud.io/api/project_badges/measure?project=smallrye_smallrye-graphql&metric=alert_status["Quality Gate Status", link="https://sonarcloud.io/dashboard?id=smallrye_smallrye-graphql"]
Expand Down Expand Up @@ -62,17 +63,22 @@ The 1.5.x branch will be maintained for the `javax` namespace, and the main (2.x

* link:server/api[API] (pulling in the MicroProfile API) and allowing us to experiment with api feature not yet in the spec. Code from here might move the the spec at some point.
* link:server/implementation[Implementation] of the Eclipse MicroProfile GraphQL API.
* link:server/implementation-cdi[CDI] Module that allows lookup of GraphQL Endpoints via CDI
* link:server/implementation-servlet[Servlet] Making the implementation available via Servlet
* link:server/implementation-cdi[CDI] Module that allows lookup of GraphQL Endpoints via CDI.
* link:server/implementation-servlet[Servlet] Making the implementation available via Servlet.
* link:server/tck[TCK] Test suite to run the implementation against the {microprofile-graphql}[Eclipse MicroProfile GraphQL] TCK.
* link:server/runner[Runner] Manual TCK testing with GraphiQL
* link:server/integration-tests[IT] To run some Integration tests
* link:server/runner[Runner] Manual TCK testing with GraphiQL.
* link:server/integration-tests[IT] To run some Integration tests.

==== Client

* link:client/api[Client API] (pulling in the MicroProfile Client API) and allowing us to experiment with api feature not yet in the spec. Code from here might move the the spec at some point.
* link:client/api[Client API] (pulling in the MicroProfile Client API) and allowing us to experiment with API feature not yet in the spec. Code from here might move the spec at some point.
* link:client/implementation[Client Implementation] of the Eclipse MicroProfile GraphQL Client API.
* link:client/tck[Client TCK] Test suite to run the client-implementation against the {microprofile-graphql}[Eclipse MicroProfile GraphQL] Client TCK.
* link:client/implementation-vertx[Client Implementation Vert.x] Module for {vertx}[Vert.x] handling for the client.
* link:client/generator[Client Generator] Module generating Type-Safe Client APIs with annotation processing.
* link:client/generator-test[Client Generator Test] Module containing tests for client generators.
* link:client/model[Client Model] defines Type-Safe's client model (GraphQL operations).
* link:client/model-builder[Client Model Builder] that generates Client Model from Jandex.

==== Tools

Expand Down
8 changes: 1 addition & 7 deletions client/api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-parent</artifactId>
<version>2.8.2-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-api</artifactId>
Expand All @@ -30,18 +30,12 @@
<artifactId>microprofile-config-api</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>mutiny</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-model</artifactId>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class NameValidation {
/**
* The regular expression patterns for a valid GraphQL names.
*/
private static final String _NAME_REGEX = "[a-zA-Z_][a-zA-Z0-9_]*";
private static final String _IGNORED_TOKENS_REGEX = "[,\\s]*"; // for now, whitespaces and commas
private static final String _NAME_REGEX = _IGNORED_TOKENS_REGEX + "[a-zA-Z_][a-zA-Z0-9_]*" + _IGNORED_TOKENS_REGEX;
private static final String _FIELD_NAME_REGEX = "^" + _NAME_REGEX + "(:" + _NAME_REGEX + ")?$";
private static final Pattern NAME_PATTERN = Pattern.compile(_NAME_REGEX);
private static final Pattern FIELD_NAME_PATTERN = Pattern.compile(_FIELD_NAME_REGEX);
Expand Down
2 changes: 1 addition & 1 deletion client/generator-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-parent</artifactId>
<version>2.8.2-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-generator-test</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-parent</artifactId>
<version>2.8.2-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-generator</artifactId>
Expand Down
24 changes: 22 additions & 2 deletions client/implementation-vertx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-parent</artifactId>
<version>2.8.2-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-implementation-vertx</artifactId>
Expand All @@ -18,7 +18,7 @@
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-model-builder</artifactId>
<artifactId>smallrye-graphql-client-model</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
Expand All @@ -29,6 +29,16 @@
<artifactId>microprofile-config-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- The Client API is copied into SmallRye for now -->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.microprofile.graphql</groupId>-->
Expand All @@ -50,5 +60,15 @@
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-model-builder</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.junit.jupiter.api.Test;
import org.junit.platform.suite.api.ExcludeClassNamePatterns;

import io.smallrye.graphql.client.GraphQLClient;
import io.smallrye.graphql.client.model.ClientModelBuilder;
import io.smallrye.graphql.client.model.ClientModels;
import tck.graphql.typesafe.Animal;
Expand Down Expand Up @@ -87,7 +86,6 @@ private static Index createIndexExcludingClasses(File directory, String classNam
// SOME OTHER CLASSES TO BE ADDED TO INDEX
try {
indexer.indexClass(Input.class);
indexer.indexClass(GraphQLClient.class);
indexer.indexClass(Closeable.class);
indexer.indexClass(AutoCloseable.class);
} catch (IOException e) {
Expand Down
24 changes: 15 additions & 9 deletions client/implementation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-parent</artifactId>
<version>2.8.2-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client</artifactId>
Expand Down Expand Up @@ -56,6 +56,11 @@
<artifactId>jakarta.json-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.json.bind</groupId>
<artifactId>jakarta.json.bind-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config</artifactId>
Expand All @@ -66,18 +71,14 @@
<artifactId>jakarta.enterprise.cdi-api</artifactId>
</dependency>

<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.reactive</groupId>
<artifactId>mutiny</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-client-model</artifactId> <!--Method Key-->
</dependency>

<!-- logging and i18n -->
<dependency>
Expand Down Expand Up @@ -118,5 +119,10 @@
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse</groupId>
<artifactId>yasson</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.smallrye.graphql.client.impl;

import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
Expand All @@ -8,18 +9,15 @@
import jakarta.json.JsonBuilderFactory;
import jakarta.json.JsonObject;
import jakarta.json.JsonObjectBuilder;
import jakarta.json.JsonStructure;
import jakarta.json.JsonValue;
import jakarta.json.bind.Jsonb;
import jakarta.json.bind.JsonbBuilder;

import org.eclipse.yasson.internal.JsonBinding;

import io.smallrye.graphql.client.Request;

public class RequestImpl implements Request {

private static final JsonBuilderFactory jsonBuilderFactory = Json.createBuilderFactory(null);
private static final JsonBuilderFactory JSON = Json.createBuilderFactory(null);
private static final Jsonb JSONB = JsonbBuilder.create();

private final String document;
private Map<String, Object> variables;
Expand All @@ -32,7 +30,7 @@ public RequestImpl(String document) {

@Override
public String toJson() {
JsonObjectBuilder queryBuilder = jsonBuilderFactory.createObjectBuilder().add("query", document);
JsonObjectBuilder queryBuilder = JSON.createObjectBuilder().add("query", document);
if (!variables.isEmpty()) {
queryBuilder.add("variables", _formatJsonVariables());
}
Expand All @@ -44,7 +42,7 @@ public String toJson() {

@Override
public JsonObject toJsonObject() {
JsonObjectBuilder queryBuilder = jsonBuilderFactory.createObjectBuilder().add("query", document);
JsonObjectBuilder queryBuilder = JSON.createObjectBuilder().add("query", document);
if (!variables.isEmpty()) {
queryBuilder.add("variables", _formatJsonVariables());
}
Expand All @@ -55,7 +53,7 @@ public JsonObject toJsonObject() {
}

private JsonObject _formatJsonVariables() {
JsonObjectBuilder varBuilder = jsonBuilderFactory.createObjectBuilder();
JsonObjectBuilder varBuilder = JSON.createObjectBuilder();

variables.forEach((k, v) -> {
// Other types to process here
Expand All @@ -69,14 +67,12 @@ private JsonObject _formatJsonVariables() {
varBuilder.add(k, (Boolean) v);
} else if (v instanceof Long) {
varBuilder.add(k, (Long) v);
} else if (v instanceof Double) {
varBuilder.add(k, (Double) v);
} else if (v == null) {
varBuilder.addNull(k);
} else {
try (Jsonb jsonb = JsonbBuilder.create()) {
JsonStructure struct = ((JsonBinding) jsonb).toJsonStructure(v);
varBuilder.add(k, struct);
} catch (Exception ignore) {
}
varBuilder.add(k, Json.createReader(new StringReader(JSONB.toJson(v))).read());
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public String getKey() {
}

public MethodKey getMethodKey() {
return new MethodKey(method.getReturnType(), method.getName(), method.getParameterTypes());
return new MethodKey(method.getName(), method.getParameterTypes());
}

public OperationType getOperationType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public void testPrimitiveTypesToJson() {

request.setVariable("key", "foo");
assertEquals("{\"query\":\"example\",\"variables\":{\"key\":\"foo\"}}", request.toJson());

request.setVariable("key", 5L);
assertEquals("{\"query\":\"example\",\"variables\":{\"key\":5}}", request.toJson());

request.setVariable("key", 5.5);
assertEquals("{\"query\":\"example\",\"variables\":{\"key\":5.5}}", request.toJson());
}

@Test
Expand Down
Loading

0 comments on commit ae297cb

Please sign in to comment.