diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 70d4c206..9c8138dc 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -73,7 +73,7 @@ jobs:
- name: Generate new public Json Schema
shell: bash
- run: ./mvnw install -Dmaven.plugin.validation=NONE -DskipSign -ntp -P framework-only
+ run: ./mvnw install -DskipTests -Dmaven.plugin.validation=NONE -DskipSign -ntp -P framework-only
- name: Commit files and generate new tag
run: |
diff --git a/docs/README.md b/docs/README.md
index 2f41e583..b01c2799 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -648,12 +648,12 @@ config:
priority: 0 # Sets the order of evaluation of this interpolator among others. Higher priority wins.
prefix: spectrum # Variable prefix
delimiter: . # Variable tokens' delimiter
- transformCase: none # Function to specify how to transform the original camelCase of the key to match the external variable to search
+ transformCase: NONE # Function to specify how to transform the original camelCase of the key to match the external variable to search
properties: # Properties interpolator
priority: 1 # Sets the order of evaluation of this interpolator among others. Higher priority wins.
prefix: spectrum # Variable prefix
delimiter: . # Variable tokens' delimiter
- transformCase: none # Function to specify how to transform the original camelCase of the key to match the external variable to search
+ transformCase: NONE # Function to specify how to transform the original camelCase of the key to match the external variable to search
inPlace: # In-place configuration file interpolator
priority: 2 # Sets the order of evaluation of this interpolator among others. Higher priority wins.
enabled: true
@@ -669,6 +669,9 @@ The other keys are explained in the corresponding sections.
### In-place Interpolation
+> ⚠️ **Interpolating data*.yaml**
+> The `in-place interpolation` is the only way to inject values into the `data*.yaml`, other interpolators won't work.
+
You can interpolate values directly in the `configuration*.yaml` and `data*.yaml` with a dollar-string in one of the following two ways,
depending on the type needed as result. Let's suppose we have the variable `key = 123`:
@@ -842,10 +845,11 @@ config:
priority: 0
prefix: spectrum
delimiter: .
- transformCase: none
+ transformCase: NONE
```
This means every configuration key will be searched in env vars, with the `spectrum` prefix and words delimited by a dot.
+The name of the variable to resolve is the json path of the corresponding configuration key.
For instance, you can inject the `application.baseUrl` setting an env variable named `spectrum.application.baseUrl`.
To give you another example, you can use this config to inject env vars like `APPLICATION_BASEURL`:
@@ -858,16 +862,16 @@ config:
environment:
prefix: ''
delimiter: _
- transformCase: upper
+ transformCase: UPPER
```
Allowed values for the `transformCase` property are:
| Value | Description | Example |
|---------|-----------------------------------------------------------------------------------|---------------------|
-| `none` | searches a key with the same case of the property, which is `camelCase` (default) | application.baseUrl |
-| `lower` | searches a lowercase key | application.baseurl |
-| `upper` | searches a uppercase key | APPLICATION.BASEURL |
+| `NONE` | searches a key with the same case of the property, which is `camelCase` (default) | application.baseUrl |
+| `LOWER` | searches a lowercase key | application.baseurl |
+| `UPPER` | searches a uppercase key | APPLICATION.BASEURL |
> ⚠️ **Priority**
> Pay attention to the priority: by default, the `inPlace` interpolator takes precedence over this one.
@@ -899,10 +903,11 @@ config:
priority: 1
prefix: spectrum
delimiter: .
- transformCase: none
+ transformCase: NONE
```
This means every configuration key will be searched in system properties, with the `spectrum` prefix and words delimited by a dot.
+The name of the variable to resolve is the json path of the corresponding configuration key.
For instance, you can inject the `application.baseUrl` setting the system property `-Dspectrum.application.baseUrl`.
To give you another example, you can use this config to inject system properties like `-DAPPLICATION_BASEURL`:
@@ -915,16 +920,16 @@ config:
properties:
prefix: ''
delimiter: _
- transformCase: upper
+ transformCase: UPPER
```
Allowed values for the `transformCase` property are:
| Value | Description | Example |
|---------|-----------------------------------------------------------------------------------|---------------------|
-| `none` | searches a key with the same case of the property, which is `camelCase` (default) | application.baseUrl |
-| `lower` | searches a lowercase key | application.baseurl |
-| `upper` | searches a uppercase key | APPLICATION.BASEURL |
+| `NONE` | searches a key with the same case of the property, which is `camelCase` (default) | application.baseUrl |
+| `LOWER` | searches a lowercase key | application.baseurl |
+| `UPPER` | searches a uppercase key | APPLICATION.BASEURL |
> ⚠️ **Priority**
> Pay attention to the priority: by default, the `inPlace` interpolator takes precedence over this one.
diff --git a/it/src/test/resources/configuration.yaml b/it/src/test/resources/configuration.yaml
index 55a8dfed..9fa6a229 100644
--- a/it/src/test/resources/configuration.yaml
+++ b/it/src/test/resources/configuration.yaml
@@ -3,7 +3,7 @@ config:
environment:
priority: 10
delimiter: _
- transformCase: upper
+ transformCase: UPPER
properties: { }
application:
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/deserializers/interpolation/interpolators/ExternalInterpolator.java b/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/deserializers/interpolation/interpolators/ExternalInterpolator.java
index e63fe011..ad961fb1 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/deserializers/interpolation/interpolators/ExternalInterpolator.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/deserializers/interpolation/interpolators/ExternalInterpolator.java
@@ -9,12 +9,10 @@
import java.util.function.Function;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
-import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonStreamContext;
import lombok.AllArgsConstructor;
-import lombok.Generated;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
@@ -73,17 +71,10 @@ void getKeyPathTokens(final List accumulator, final JsonStreamContext co
@AllArgsConstructor
enum TransformCase {
- NONE("none", s -> s),
- LOWER("lower", String::toLowerCase),
- UPPER("upper", String::toUpperCase);
+ NONE(s -> s),
+ LOWER(String::toLowerCase),
+ UPPER(String::toUpperCase);
- private final String value;
private final Function function;
-
- @JsonValue
- @Generated
- public String getValue() {
- return value;
- }
}
}
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/json_schema/JsonSchemaInternalGeneratorModule.java b/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/json_schema/JsonSchemaInternalGeneratorModule.java
index f81eed93..f495e1f1 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/json_schema/JsonSchemaInternalGeneratorModule.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/internals/jackson/json_schema/JsonSchemaInternalGeneratorModule.java
@@ -37,7 +37,10 @@ public void applyToConfigBuilder(final SchemaGeneratorConfigBuilder schemaGenera
protected SchemaGeneratorConfigBuilder commonSetupFor(final SchemaGeneratorConfigBuilder schemaGeneratorConfigBuilder) {
schemaGeneratorConfigBuilder
.with(new JacksonModule(SKIP_SUBTYPE_LOOKUP, FLATTENED_ENUMS_FROM_JSONVALUE))
- .with(FORBIDDEN_ADDITIONAL_PROPERTIES_BY_DEFAULT, MAP_VALUES_AS_ADDITIONAL_PROPERTIES, NULLABLE_FIELDS_BY_DEFAULT);
+ .with(FORBIDDEN_ADDITIONAL_PROPERTIES_BY_DEFAULT,
+ MAP_VALUES_AS_ADDITIONAL_PROPERTIES,
+ TRANSIENT_FIELDS,
+ NULLABLE_FIELDS_BY_DEFAULT);
schemaGeneratorConfigBuilder
.forFields()
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/Configuration.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/Configuration.java
index 2d101b27..e2388bb2 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/Configuration.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/Configuration.java
@@ -41,9 +41,8 @@ public class Configuration {
private static final Configuration INSTANCE = new Configuration();
@Setter
- @JsonIgnore
@JsonPropertyDescription("Generic configuration. This node is read only from the base configuration.yaml")
- private Config config;
+ private transient Config config;
@JsonPropertyDescription("Common vars to interpolate other String values in the configuration")
private Map vars;
diff --git a/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java b/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java
index 484a3090..eee0f5cb 100644
--- a/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java
+++ b/spectrum/src/main/java/io/github/giulong/spectrum/utils/YamlUtils.java
@@ -1,5 +1,6 @@
package io.github.giulong.spectrum.utils;
+import static com.fasterxml.jackson.databind.MapperFeature.PROPAGATE_TRANSIENT_MARKER;
import static com.fasterxml.jackson.databind.SerializationFeature.FAIL_ON_EMPTY_BEANS;
import static lombok.AccessLevel.PRIVATE;
@@ -45,6 +46,7 @@ public final class YamlUtils {
private final ObjectMapper yamlMapper = YAMLMapper
.builder()
.defaultMergeable(true)
+ .configure(PROPAGATE_TRANSIENT_MARKER, true)
.addModules(
new JavaTimeModule(),
buildModuleFor(Object.class, InterpolatedObjectDeserializer.getInstance()),
diff --git a/spectrum/src/main/resources/yaml/configuration.default.yaml b/spectrum/src/main/resources/yaml/configuration.default.yaml
index ad251611..0b5bb465 100644
--- a/spectrum/src/main/resources/yaml/configuration.default.yaml
+++ b/spectrum/src/main/resources/yaml/configuration.default.yaml
@@ -5,12 +5,12 @@ config:
priority: 0 # Sets the order of evaluation of this interpolator among others. Higher priority wins.
prefix: spectrum # Variable prefix
delimiter: . # Variable tokens' delimiter
- transformCase: none # Function to specify how to transform the original camelCase of the key to match the external variable to search
+ transformCase: NONE # Function to specify how to transform the original camelCase of the key to match the external variable to search
properties: # Properties interpolator
priority: 1 # Sets the order of evaluation of this interpolator among others. Higher priority wins.
prefix: spectrum # Variable prefix
delimiter: . # Variable tokens' delimiter
- transformCase: none # Function to specify how to transform the original camelCase of the key to match the external variable to search
+ transformCase: NONE # Function to specify how to transform the original camelCase of the key to match the external variable to search
inPlace: # In-place configuration file interpolator
priority: 2 # Sets the order of evaluation of this interpolator among others. Higher priority wins.
enabled: true