-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
186 additions
and
0 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
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
76 changes: 76 additions & 0 deletions
76
common/deployment/src/main/java/io/quarkiverse/roq/deployment/config/RoqJacksonConfig.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,76 @@ | ||
package io.quarkiverse.roq.deployment.config; | ||
|
||
import java.time.ZoneId; | ||
import java.util.Optional; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import io.quarkus.runtime.annotations.ConfigPhase; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
import io.smallrye.config.ConfigMapping; | ||
import io.smallrye.config.WithDefault; | ||
|
||
@ConfigMapping(prefix = "quarkus.roq.jackson") | ||
@ConfigRoot(phase = ConfigPhase.BUILD_TIME) | ||
public interface RoqJacksonConfig { | ||
|
||
/** | ||
* If enabled, Jackson will fail when encountering unknown properties. | ||
* <p> | ||
* You can still override it locally with {@code @JsonIgnoreProperties(ignoreUnknown = false)}. | ||
*/ | ||
@WithDefault("false") | ||
boolean failOnUnknownProperties(); | ||
|
||
/** | ||
* If enabled, Jackson will fail when no accessors are found for a type. | ||
* This is enabled by default to match the default Jackson behavior. | ||
*/ | ||
@WithDefault("true") | ||
boolean failOnEmptyBeans(); | ||
|
||
/** | ||
* If enabled, Jackson will serialize dates as numeric value(s). | ||
* When disabled, they are serialized in ISO 8601 format. | ||
*/ | ||
@WithDefault("false") | ||
boolean writeDatesAsTimestamps(); | ||
|
||
/** | ||
* If enabled, Jackson will serialize durations as numeric value(s). | ||
* When disabled, they are serialized in ISO 8601 format. | ||
* This is enabled by default to match the default Jackson behavior. | ||
*/ | ||
@WithDefault("true") | ||
boolean writeDurationsAsTimestamps(); | ||
|
||
/** | ||
* If enabled, Jackson will ignore case during Enum deserialization. | ||
*/ | ||
@WithDefault("false") | ||
boolean acceptCaseInsensitiveEnums(); | ||
|
||
/** | ||
* If set, Jackson will default to using the specified timezone when formatting dates. | ||
* Some examples values are "Asia/Jakarta" and "GMT+3". | ||
* If not set, Jackson will use its own default. | ||
*/ | ||
@WithDefault("UTC") | ||
Optional<ZoneId> timezone(); | ||
|
||
/** | ||
* Define which properties of Java Beans are to be included in serialization. | ||
*/ | ||
Optional<JsonInclude.Include> serializationInclusion(); | ||
|
||
/** | ||
* Defines how names of JSON properties ("external names") are derived | ||
* from names of POJO methods and fields ("internal names"). | ||
* The value can be one of the one of the constants in {@link com.fasterxml.jackson.databind.PropertyNamingStrategies}, | ||
* so for example, {@code LOWER_CAMEL_CASE} or {@code UPPER_CAMEL_CASE}. | ||
* | ||
* The value can also be a fully qualified class name of a {@link com.fasterxml.jackson.databind.PropertyNamingStrategy} | ||
* subclass. | ||
*/ | ||
Optional<String> propertyNamingStrategy(); | ||
} |
18 changes: 18 additions & 0 deletions
18
...eployment/src/main/java/io/quarkiverse/roq/deployment/items/RoqObjectMapperBuildItem.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,18 @@ | ||
package io.quarkiverse.roq.deployment.items; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import io.quarkus.builder.item.SimpleBuildItem; | ||
|
||
public final class RoqObjectMapperBuildItem extends SimpleBuildItem { | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public RoqObjectMapperBuildItem(ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper; | ||
} | ||
|
||
public ObjectMapper getObjectMapper() { | ||
return objectMapper; | ||
} | ||
} |
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
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