@@ -157,6 +157,7 @@ void projectNextRelationship(
157157 NodeLabelToken sourceNodeLabels = NodeLabelTokens .missing ();
158158 NodeLabelToken targetNodeLabels = NodeLabelTokens .missing ();
159159
160+ this .configValidator .validateConfigs (nodesConfig , relationshipConfig );
160161 if (nodesConfig instanceof MapValue ) {
161162 sourceNodePropertyValues = GraphImporter .propertiesConfig ("sourceNodeProperties" , (MapValue ) nodesConfig );
162163 sourceNodeLabels = labelsConfig ("sourceNodeLabels" , (MapValue ) nodesConfig );
@@ -168,8 +169,6 @@ void projectNextRelationship(
168169 );
169170 targetNodeLabels = labelsConfig ("targetNodeLabels" , (MapValue ) nodesConfig );
170171 }
171-
172- this .configValidator .validateNodesConfig ((MapValue ) nodesConfig );
173172 }
174173
175174 var data = initGraphData (
@@ -309,18 +308,27 @@ private static final class ConfigValidator {
309308 "relationshipType"
310309 );
311310
312- private final AtomicBoolean validateNodes = new AtomicBoolean (true );
313- private final AtomicBoolean validateRelationships = new AtomicBoolean (true );
314-
315- void validateNodesConfig (MapValue nodesConfig ) {
316- if (this .validateNodes .getAndSet (false )) {
317- ConfigKeyValidation .requireOnlyKeysFrom (NODES_CONFIG_KEYS , nodesConfig .keySet ());
318- }
319- }
320311
321- void validateRelationshipsConfig (MapValue relationshipConfig ) {
322- if (this .validateRelationships .getAndSet (false )) {
323- ConfigKeyValidation .requireOnlyKeysFrom (RELATIONSHIPS_CONFIG_KEYS , relationshipConfig .keySet ());
312+ private final AtomicBoolean validate = new AtomicBoolean (true );
313+
314+ void validateConfigs (AnyValue nodesConfig , AnyValue relationshipConfig ) {
315+ if (nodesConfig instanceof MapValue || relationshipConfig instanceof MapValue ) {
316+ if (this .validate .get ()) {
317+ if (this .validate .getAndSet (false )) {
318+ if (nodesConfig instanceof MapValue ) {
319+ ConfigKeyValidation .requireOnlyKeysFrom (
320+ NODES_CONFIG_KEYS ,
321+ ((MapValue ) nodesConfig ).keySet ()
322+ );
323+ }
324+ if (relationshipConfig instanceof MapValue ) {
325+ ConfigKeyValidation .requireOnlyKeysFrom (
326+ NODES_CONFIG_KEYS ,
327+ ((MapValue ) relationshipConfig ).keySet ()
328+ );
329+ }
330+ }
331+ }
324332 }
325333 }
326334 }
@@ -465,8 +473,6 @@ void update(
465473 if (relationshipConfig instanceof MapValue ) {
466474 relationshipProperties = propertiesConfig ("properties" , (MapValue ) relationshipConfig );
467475 relationshipType = typeConfig ("relationshipType" , (MapValue ) relationshipConfig );
468-
469- configValidator .validateRelationshipsConfig ((MapValue ) relationshipConfig );
470476 }
471477
472478 var intermediateSourceId = loadNode (sourceNode , sourceNodeLabels , sourceNodePropertyValues );
@@ -723,6 +729,7 @@ static MapValue propertiesConfig(
723729 @ NotNull MapValue propertiesConfig
724730 ) {
725731 var nodeProperties = propertiesConfig .get (propertyKey );
732+
726733 if (nodeProperties instanceof MapValue ) {
727734 return (MapValue ) nodeProperties ;
728735 }
0 commit comments