Skip to content

Commit

Permalink
Update Kotlinx Serialization JsonConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Nov 27, 2023
1 parent 8d4b5c5 commit 1ce610c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ public class JsonConfig {
@ConfigItem(defaultValue = "false")
public boolean decodeEnumsCaseInsensitive = false;

/**
* Specifies if trailing comma is allowed.
*/
@ConfigItem(defaultValue = "false")
public boolean allowTrailingComma = false;

@Override
public String toString() {
return new StringJoiner(", ", JsonConfig.class.getSimpleName() + "[", "]")
Expand All @@ -144,6 +150,7 @@ public String toString() {
.add("allowSpecialFloatingPointValues=" + allowSpecialFloatingPointValues)
.add("useAlternativeNames=" + useAlternativeNames)
.add("decodeEnumsCaseInsensitive=" + decodeEnumsCaseInsensitive)
.add("allowTrailingComma=" + allowTrailingComma)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class JsonProducer {
useAlternativeNames = configuration.json.useAlternativeNames
useArrayPolymorphism = configuration.json.useArrayPolymorphism
decodeEnumsCaseInsensitive = configuration.json.decodeEnumsCaseInsensitive
allowTrailingComma = configuration.json.allowTrailingComma

configuration.json.namingStrategy.ifPresent { strategy ->
loadStrategy(this, strategy, this@JsonProducer)
Expand Down

0 comments on commit 1ce610c

Please sign in to comment.