Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to register some scalars from graphql-java-extended-scalars #1956

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion 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.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-api</artifactId>
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.5.2-SNAPSHOT</version>
<version>2.6.0-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.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-generator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion 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.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-implementation-vertx</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion 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.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion client/tck/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.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-client-tck</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion common/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-common-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion common/schema-builder/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-common-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-schema-builder</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion common/schema-model/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-common-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-schema-model</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ public static Reference getIDScalar(String className) {
.build();
}

// this is for the UUID from graphql-java-extended-scalars
// if used, it will override the original UUID type that is mapped to a String in the schema
public static void addUuid() {
populateScalar(UUID.class.getName(), "UUID", String.class.getName());
}

static {
// The main java type should go first.

Expand Down Expand Up @@ -185,7 +191,7 @@ private static void populateScalar(String className, String scalarName, String e
scalarMap.put(className, reference);

// looking up by name
scalarNameMap.putIfAbsent(scalarName, reference);
scalarNameMap.put(scalarName, reference);

//Currently, each scalar is formatted as String
formattedScalarMap.put(className, new Reference.Builder()
Expand Down
2 changes: 1 addition & 1 deletion docs/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-documentation</artifactId>
Expand Down
9 changes: 8 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>

<artifactId>smallrye-graphql-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>

<packaging>pom</packaging>
<name>SmallRye: GraphQL Parent</name>
Expand Down Expand Up @@ -38,6 +38,7 @@
<version.jakarta.websocket>2.0.0</version.jakarta.websocket>
<version.graphql-java-federation>2.1.1</version.graphql-java-federation>
<version.graphql-java>21.1</version.graphql-java>
<version.extended-scalars>21.0</version.extended-scalars>
<verison.io.micrometer>1.11.3</verison.io.micrometer>
<version.vertx>4.4.5</version.vertx>
<version.smallrye-opentelemetry>2.4.0</version.smallrye-opentelemetry>
Expand Down Expand Up @@ -352,6 +353,12 @@
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
<version>${version.extended-scalars}</version>
</dependency>

<!-- Tests -->
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
Expand Down
2 changes: 1 addition & 1 deletion release/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-release</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/implementation-cdi/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-cdi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/implementation-servlet/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-servlet</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion server/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql</artifactId>
Expand Down Expand Up @@ -71,6 +71,11 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
</dependency>

<!-- i18n -->
<dependency>
<groupId>org.jboss.logging</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.UUID;

import graphql.Scalars;
import graphql.scalars.ExtendedScalars;
import graphql.schema.GraphQLScalarType;
import io.smallrye.graphql.scalar.number.BigDecimalScalar;
import io.smallrye.graphql.scalar.number.BigIntegerScalar;
Expand Down Expand Up @@ -46,6 +47,11 @@ public static boolean isGraphQLScalarType(String className) {
return SCALAR_MAP.containsKey(className);
}

public static void addUuid() {
SCALAR_MAP.put(UUID.class.getName(), ExtendedScalars.UUID);
SCALARS_BY_NAME.put(ExtendedScalars.UUID.getName(), ExtendedScalars.UUID);
}

// Scalar map we can just create now.
private static final Map<String, GraphQLScalarType> SCALAR_MAP = new HashMap<>();

Expand Down
2 changes: 1 addition & 1 deletion server/integration-tests-jdk16/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>smallrye-graphql-server-parent</artifactId>
<groupId>io.smallrye</groupId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion server/integration-tests/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion server/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-server-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/runner/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-runner</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion server/tck/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-server-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-tck</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tools/gradle-plugin/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-tools-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tools/maven-plugin-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-tools-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tools/maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-graphql-tools-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion tools/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-tools-parent</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ui/graphiql/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-ui-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-ui-graphiql</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion ui/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-parent</artifactId>
<version>2.5.2-SNAPSHOT</version>
<version>2.6.0-SNAPSHOT</version>
</parent>

<artifactId>smallrye-graphql-ui-parent</artifactId>
Expand Down
Loading