Skip to content

Commit

Permalink
Tweak from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopheDuong committed Mar 18, 2021
1 parent 1ede1ba commit 4b5c22a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
5 changes: 3 additions & 2 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1860,18 +1860,19 @@ components:
description: the mutable part of the stream to configure the destination
type: object
additionalProperties: false
required:
- syncMode
- destinationSyncMode
properties:
syncMode:
$ref: "#/components/schemas/SyncMode"
default: full_refresh
cursorField:
description: Path to the field that will be used to determine if a record is new or modified since the last sync. This field is REQUIRED if `sync_mode` is `incremental`. Otherwise it is ignored.
type: array
items:
type: string
destinationSyncMode:
$ref: "#/components/schemas/DestinationSyncMode"
default: append
primaryKey:
description: Paths to the fields that will be used as primary key. This field is REQUIRED if `destination_sync_mode` is `*_dedup`. Otherwise it is ignored.
type: array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ private JsonNode migrateCatalog(JsonNode catalog) {
}
JsonNode destinationSyncMode = stream.get("destination_sync_mode");
if (destinationSyncMode == null) {
if (syncMode != null && SyncMode.fromValue(syncMode.asText()) == SyncMode.FULL_REFRESH) {
if (SyncMode.fromValue(syncMode.asText()) == SyncMode.FULL_REFRESH) {
destinationSyncMode = Jsons.jsonNode(DestinationSyncMode.OVERWRITE.toString());
LOGGER.debug("Migrating {} to source sync_mode: {} destination_sync_mode: {}", airbyteStream.get("name"), syncMode,
destinationSyncMode);
} else if (syncMode != null && SyncMode.fromValue(syncMode.asText()) == SyncMode.INCREMENTAL) {
} else if (SyncMode.fromValue(syncMode.asText()) == SyncMode.INCREMENTAL) {
destinationSyncMode = Jsons.jsonNode(DestinationSyncMode.APPEND.toString());
LOGGER.debug("Migrating {} to source sync_mode: {} destination_sync_mode: {}", airbyteStream.get("name"), syncMode,
destinationSyncMode);
Expand All @@ -116,10 +116,8 @@ private JsonNode migrateCatalog(JsonNode catalog) {
}
JsonNode primaryKey = stream.get("primary_key");
if (primaryKey == null) {
primaryKey = airbyteStream.get("source_defined_primary_key");
if (primaryKey == null) {
primaryKey = Jsons.jsonNode(Collections.emptyList());
}
JsonNode sourceDefinedPrimaryKey = airbyteStream.get("source_defined_primary_key");
primaryKey = sourceDefinedPrimaryKey != null ? sourceDefinedPrimaryKey : Jsons.jsonNode(Collections.emptyList());
}
// configured catalog fields
return (Map<String, JsonNode>) ImmutableMap.<String, JsonNode>builder()
Expand Down
4 changes: 2 additions & 2 deletions docs/api/generated-api-html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4418,9 +4418,9 @@ <h3><a name="AirbyteStreamAndConfiguration"><code>AirbyteStreamAndConfiguration<
<h3><a name="AirbyteStreamConfiguration"><code>AirbyteStreamConfiguration</code> - </a> <a class="up" href="#__Models">Up</a></h3>
<div class='model-description'>the mutable part of the stream to configure the destination</div>
<div class="field-items">
<div class="param">syncMode (optional)</div><div class="param-desc"><span class="param-type"><a href="#SyncMode">SyncMode</a></span> </div>
<div class="param">syncMode </div><div class="param-desc"><span class="param-type"><a href="#SyncMode">SyncMode</a></span> </div>
<div class="param">cursorField (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">array[String]</a></span> Path to the field that will be used to determine if a record is new or modified since the last sync. This field is REQUIRED if <code>sync_mode</code> is <code>incremental</code>. Otherwise it is ignored. </div>
<div class="param">destinationSyncMode (optional)</div><div class="param-desc"><span class="param-type"><a href="#DestinationSyncMode">DestinationSyncMode</a></span> </div>
<div class="param">destinationSyncMode </div><div class="param-desc"><span class="param-type"><a href="#DestinationSyncMode">DestinationSyncMode</a></span> </div>
<div class="param">primaryKey (optional)</div><div class="param-desc"><span class="param-type"><a href="#array">array[array[String]]</a></span> Paths to the fields that will be used as primary key. This field is REQUIRED if <code>destination_sync_mode</code> is <code>*_dedup</code>. Otherwise it is ignored. </div>
<div class="param">aliasName (optional)</div><div class="param-desc"><span class="param-type"><a href="#string">String</a></span> Alias name to the stream to be used in the destination </div>
<div class="param">selected (optional)</div><div class="param-desc"><span class="param-type"><a href="#boolean">Boolean</a></span> </div>
Expand Down

0 comments on commit 4b5c22a

Please sign in to comment.