From 09f8aaeb0f4044026432380a1739e9641f458730 Mon Sep 17 00:00:00 2001 From: cgardens Date: Tue, 29 Nov 2022 08:19:16 -0800 Subject: [PATCH] fix default protocol version behavior for devs --- .../airbyte/config/persistence/ConfigRepository.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/airbyte-config/config-persistence/src/main/java/io/airbyte/config/persistence/ConfigRepository.java b/airbyte-config/config-persistence/src/main/java/io/airbyte/config/persistence/ConfigRepository.java index 298dcddda9dc..1f72ac9285ca 100644 --- a/airbyte-config/config-persistence/src/main/java/io/airbyte/config/persistence/ConfigRepository.java +++ b/airbyte-config/config-persistence/src/main/java/io/airbyte/config/persistence/ConfigRepository.java @@ -291,10 +291,8 @@ private Stream sourceDefQuery(final Optional sou .and(includeTombstone ? noCondition() : ACTOR_DEFINITION.TOMBSTONE.notEqual(true)) .fetchStream()) .map(DbConverter::buildStandardSourceDefinition) - // todo(cgardens) - the impls for default protocol version were different in list and get, which is - // right? used list. - .map(sourceDef -> sourceDef.withProtocolVersion( - AirbyteProtocolVersion.getWithDefault(sourceDef.getSpec() != null ? sourceDef.getSpec().getProtocolVersion() : null).serialize())); + // Ensure version is set. Needed for connectors not upgraded since we added versioning. + .map(def -> def.withProtocolVersion(AirbyteProtocolVersion.getWithDefault(def.getProtocolVersion()).serialize())); } public Map> getActorDefinitionToProtocolVersionMap() throws IOException { @@ -355,10 +353,8 @@ private Stream destDefQuery(final Optional .and(includeTombstone ? noCondition() : ACTOR_DEFINITION.TOMBSTONE.notEqual(true)) .fetchStream()) .map(DbConverter::buildStandardDestinationDefinition) - // todo(cgardens) - the impls for default protocol version were different in list and get, which is - // right? used list. - .map(destDef -> destDef.withProtocolVersion( - AirbyteProtocolVersion.getWithDefault(destDef.getSpec() != null ? destDef.getSpec().getProtocolVersion() : null).serialize())); + // Ensure version is set. Needed for connectors not upgraded since we added versioning. + .map(def -> def.withProtocolVersion(AirbyteProtocolVersion.getWithDefault(def.getProtocolVersion()).serialize())); } public StandardDestinationDefinition getStandardDestinationDefinition(final UUID destinationDefinitionId)