forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkusio#20602 from radcortez/fix-20494
Moved SmallRyeGraphQLConfigMapping to the runtime dependency
- Loading branch information
Showing
8 changed files
with
67 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...eployment/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
...rc/test/java/io/quarkus/smallrye/graphql/deployment/SmallRyeGraphQLConfigMappingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package io.quarkus.smallrye.graphql.deployment; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLConfigMapping; | ||
import io.smallrye.config.SmallRyeConfig; | ||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
|
||
class SmallRyeGraphQLConfigMappingTest { | ||
@Test | ||
void graphQlRelocates() { | ||
SmallRyeConfig config = new SmallRyeConfigBuilder() | ||
.withDefaultValue("quarkus.smallrye-graphql.show-runtime-exception-message", "org.acme.CustomRuntimeException") | ||
.withInterceptors(new SmallRyeGraphQLConfigMapping()) | ||
.build(); | ||
|
||
assertEquals("org.acme.CustomRuntimeException", config.getRawValue("mp.graphql.showErrorMessage")); | ||
} | ||
|
||
@Test | ||
void graphQlRelocatesDiscovered() { | ||
SmallRyeConfig config = new SmallRyeConfigBuilder() | ||
.withDefaultValue("quarkus.smallrye-graphql.show-runtime-exception-message", "org.acme.CustomRuntimeException") | ||
.addDiscoveredInterceptors() | ||
.build(); | ||
|
||
assertEquals("org.acme.CustomRuntimeException", config.getRawValue("mp.graphql.showErrorMessage")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 25 additions & 25 deletions
50
...hql/deployment/SmallRyeGraphQLConfig.java → ...raphql/runtime/SmallRyeGraphQLConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,154 +1,154 @@ | ||
package io.quarkus.smallrye.graphql.deployment; | ||
package io.quarkus.smallrye.graphql.runtime; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import io.quarkus.runtime.annotations.ConfigDocSection; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.graphql.schema.helper.TypeAutoNameStrategy; | ||
import io.smallrye.graphql.spi.config.LogPayloadOption; | ||
|
||
@ConfigRoot(name = "smallrye-graphql") | ||
@ConfigRoot(name = "smallrye-graphql", phase = ConfigPhase.BUILD_AND_RUN_TIME_FIXED) | ||
public class SmallRyeGraphQLConfig { | ||
|
||
/** | ||
* The rootPath under which queries will be served. Default to graphql | ||
* By default, this value will be resolved as a path relative to `${quarkus.http.root-path}`. | ||
*/ | ||
@ConfigItem(defaultValue = "graphql") | ||
String rootPath; | ||
public String rootPath; | ||
|
||
/** | ||
* Enable metrics. By default this is false. If set to true, a metrics extension is required. | ||
*/ | ||
@ConfigItem(name = "metrics.enabled") | ||
Optional<Boolean> metricsEnabled; | ||
public Optional<Boolean> metricsEnabled; | ||
|
||
/** | ||
* Enable tracing. By default this will be enabled if the tracing extension is added. | ||
*/ | ||
@ConfigItem(name = "tracing.enabled") | ||
Optional<Boolean> tracingEnabled; | ||
public Optional<Boolean> tracingEnabled; | ||
|
||
/** | ||
* Enable validation. By default this will be enabled if the Hibernate Validator extension is added. | ||
*/ | ||
@ConfigItem(name = "validation.enabled") | ||
Optional<Boolean> validationEnabled; | ||
public Optional<Boolean> validationEnabled; | ||
|
||
/** | ||
* Enable eventing. Allow you to receive events on bootstrap and execution. | ||
*/ | ||
@ConfigItem(name = "events.enabled", defaultValue = "false") | ||
boolean eventsEnabled; | ||
public boolean eventsEnabled; | ||
|
||
/** | ||
* Enable GET Requests. Allow queries via HTTP GET. | ||
*/ | ||
@ConfigItem(name = "http.get.enabled") | ||
Optional<Boolean> httpGetEnabled; | ||
public Optional<Boolean> httpGetEnabled; | ||
|
||
/** | ||
* Enable Query parameter on POST Requests. Allow POST request to override or supply values in a query parameter. | ||
*/ | ||
@ConfigItem(name = "http.post.queryparameters.enabled") | ||
Optional<Boolean> httpPostQueryParametersEnabled; | ||
public Optional<Boolean> httpPostQueryParametersEnabled; | ||
|
||
/** | ||
* Change the type naming strategy. | ||
*/ | ||
@ConfigItem(defaultValue = "Default") | ||
TypeAutoNameStrategy autoNameStrategy; | ||
public TypeAutoNameStrategy autoNameStrategy; | ||
|
||
/** | ||
* List of extension fields that should be included in the error response. | ||
* By default none will be included. Examples of valid values include | ||
* [exception,classification,code,description,validationErrorType,queryPath] | ||
*/ | ||
@ConfigItem | ||
Optional<List<String>> errorExtensionFields; | ||
public Optional<List<String>> errorExtensionFields; | ||
|
||
/** | ||
* List of Runtime Exceptions class names that should show the error message. | ||
* By default Runtime Exception messages will be hidden and a generic `Server Error` message will be returned. | ||
*/ | ||
@ConfigItem | ||
Optional<List<String>> showRuntimeExceptionMessage; | ||
public Optional<List<String>> showRuntimeExceptionMessage; | ||
|
||
/** | ||
* List of Checked Exceptions class names that should hide the error message. | ||
* By default Checked Exception messages will show the exception message. | ||
*/ | ||
@ConfigItem | ||
Optional<List<String>> hideCheckedExceptionMessage; | ||
public Optional<List<String>> hideCheckedExceptionMessage; | ||
|
||
/** | ||
* The default error message that will be used for hidden exception messages. | ||
* Defaults to "Server Error" | ||
*/ | ||
@ConfigItem | ||
Optional<String> defaultErrorMessage; | ||
public Optional<String> defaultErrorMessage; | ||
|
||
/** | ||
* Print the data fetcher exception to the log file. Default `true` in dev and test mode, default `false` in prod. | ||
*/ | ||
@ConfigItem | ||
Optional<Boolean> printDataFetcherException; | ||
public Optional<Boolean> printDataFetcherException; | ||
|
||
/** | ||
* Make the schema available over HTTP. | ||
*/ | ||
@ConfigItem(defaultValue = "true") | ||
boolean schemaAvailable; | ||
public boolean schemaAvailable; | ||
|
||
/** | ||
* Include the Scalar definitions in the schema. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
boolean schemaIncludeScalars; | ||
public boolean schemaIncludeScalars; | ||
|
||
/** | ||
* Include the schema internal definition in the schema. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
boolean schemaIncludeSchemaDefinition; | ||
public boolean schemaIncludeSchemaDefinition; | ||
|
||
/** | ||
* Include Directives in the schema. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
boolean schemaIncludeDirectives; | ||
public boolean schemaIncludeDirectives; | ||
|
||
/** | ||
* Include Introspection Types in the schema. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
boolean schemaIncludeIntrospectionTypes; | ||
public boolean schemaIncludeIntrospectionTypes; | ||
|
||
/** | ||
* Log the payload (and optionally variables) to System out. | ||
*/ | ||
@ConfigItem(defaultValue = "off") | ||
LogPayloadOption logPayload; | ||
public LogPayloadOption logPayload; | ||
|
||
/** | ||
* Set the Field visibility. | ||
*/ | ||
@ConfigItem(defaultValue = "default") | ||
String fieldVisibility; | ||
public String fieldVisibility; | ||
|
||
/** | ||
* Exceptions that should be unwrapped (class names). | ||
*/ | ||
@ConfigItem | ||
Optional<List<String>> unwrapExceptions; | ||
public Optional<List<String>> unwrapExceptions; | ||
|
||
/** | ||
* SmallRye GraphQL UI configuration | ||
*/ | ||
@ConfigItem | ||
@ConfigDocSection | ||
SmallRyeGraphQLUIConfig ui; | ||
|
||
public SmallRyeGraphQLUIConfig ui; | ||
} |
2 changes: 1 addition & 1 deletion
2
...loyment/SmallRyeGraphQLConfigMapping.java → ...runtime/SmallRyeGraphQLConfigMapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...l/runtime/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.quarkus.smallrye.graphql.runtime.SmallRyeGraphQLConfigMapping |