Skip to content

Commit

Permalink
Fixed null in config (#872)
Browse files Browse the repository at this point in the history
* Fixed null in config

* Made backwards compatible
  • Loading branch information
SimonCockx authored Nov 20, 2024
1 parent 6f1b774 commit f45ca93
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ public class TypeXMLConfiguration {
private final Optional<Map<String, String>> enumValues;

@JsonCreator
@Deprecated
public TypeXMLConfiguration(
@JsonProperty("substitutionFor") Optional<ModelSymbolId> substitutionFor,
@JsonProperty("xmlElementName") Optional<String> xmlElementName,
@JsonProperty("xmlRootElementName") @Deprecated Optional<String> xmlRootElementName,
@JsonProperty("xmlAttributes") Optional<Map<String, String>> xmlAttributes,
@JsonProperty("attributes") Optional<Map<String, AttributeXMLConfiguration>> attributes,
@JsonProperty("enumValues") Optional<Map<String, String>> enumValues) {
this(substitutionFor, xmlElementName.isPresent() ? xmlElementName : xmlRootElementName, xmlAttributes, attributes, enumValues);
}
public TypeXMLConfiguration(
@JsonProperty("substitutionFor") Optional<ModelSymbolId> substitutionFor,
@JsonProperty("xmlElementName") Optional<String> xmlElementName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.regnosys.rosetta.tools.modelimport;

import java.util.Collections;
import java.util.Map;
import java.util.Objects;

Expand All @@ -20,7 +21,7 @@ public ImportTargetConfig(
@JsonProperty("preferences") ImportTargetPreferences preferences) {
this.namespace = namespace;
this.namespaceDefinition = namespaceDefinition;
this.nameOverrides = nameOverrides;
this.nameOverrides = nameOverrides == null ? Collections.emptyMap() : nameOverrides;
this.preferences = preferences == null ? new ImportTargetPreferences(null, null, null) : preferences;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ void shouldLoadConfigFromFile() throws FileNotFoundException, IOException {
// assert
assertEquals("test.ns", config.getTarget().getNamespace());
assertEquals("Test namespace definition", config.getTarget().getNamespaceDefinition());
assertNotNull(config.getTarget().getNameOverrides());
assertNotNull(config.getTarget().getPreferences());
}

Expand Down

0 comments on commit f45ca93

Please sign in to comment.