Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add schema change attrs to connection create #19771

Merged
merged 4 commits into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3371,6 +3371,8 @@ components:
format: uuid
geography:
$ref: "#/components/schemas/Geography"
nonBreakingChangesPreference:
$ref: "#/components/schemas/NonBreakingChangesPreference"
ConnectionStateCreateOrUpdate:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.airbyte.config.ConfigSchema;
import io.airbyte.config.ConfigWithMetadata;
import io.airbyte.config.StandardSync;
import io.airbyte.config.StandardSync.NonBreakingChangesPreference;
import io.airbyte.config.helpers.ScheduleHelpers;
import io.airbyte.db.Database;
import io.airbyte.db.ExceptionWrappingDatabase;
Expand Down Expand Up @@ -240,6 +241,9 @@ private void writeStandardSync(final StandardSync standardSync, final DSLContext
.set(CONNECTION.GEOGRAPHY, Enums.toEnum(standardSync.getGeography().value(),
io.airbyte.db.instance.configs.jooq.generated.enums.GeographyType.class).orElseThrow())
.set(CONNECTION.BREAKING_CHANGE, standardSync.getBreakingChange())
.set(CONNECTION.NON_BREAKING_CHANGE_PREFERENCE,
standardSync.getNonBreakingChangesPreference() == null ? NonBreakingChangesPreference.IGNORE.value()
: standardSync.getNonBreakingChangesPreference().value())
.set(CONNECTION.CREATED_AT, timestamp)
.set(CONNECTION.UPDATED_AT, timestamp)
.execute();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public ConnectionRead createConnection(final ConnectionCreate connectionCreate)
.withStatus(ApiPojoConverters.toPersistenceStatus(connectionCreate.getStatus()))
.withSourceCatalogId(connectionCreate.getSourceCatalogId())
.withGeography(getGeographyFromConnectionCreateOrWorkspace(connectionCreate))
.withBreakingChange(false);
.withBreakingChange(false)
.withNonBreakingChangesPreference(
ApiPojoConverters.toPersistenceNonBreakingChangesPreference(connectionCreate.getNonBreakingChangesPreference()));
if (connectionCreate.getResourceRequirements() != null) {
standardSync.withResourceRequirements(ApiPojoConverters.resourceRequirementsToInternal(connectionCreate.getResourceRequirements()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ protected static ConnectionCreate toConnectionCreate(final WebBackendConnectionC
connectionCreate.resourceRequirements(webBackendConnectionCreate.getResourceRequirements());
connectionCreate.sourceCatalogId(webBackendConnectionCreate.getSourceCatalogId());
connectionCreate.geography(webBackendConnectionCreate.getGeography());
connectionCreate.nonBreakingChangesPreference(webBackendConnectionCreate.getNonBreakingChangesPreference());

return connectionCreate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@ void testToConnectionCreate() throws IOException {
.schedule(schedule)
.syncCatalog(catalog)
.sourceCatalogId(sourceCatalogId)
.geography(Geography.US);
.geography(Geography.US)
.nonBreakingChangesPreference(NonBreakingChangesPreference.DISABLE);

final List<UUID> operationIds = List.of(newOperationId);

Expand All @@ -512,7 +513,8 @@ void testToConnectionCreate() throws IOException {
.schedule(schedule)
.syncCatalog(catalog)
.sourceCatalogId(sourceCatalogId)
.geography(Geography.US);
.geography(Geography.US)
.nonBreakingChangesPreference(NonBreakingChangesPreference.DISABLE);

final ConnectionCreate actual = WebBackendConnectionsHandler.toConnectionCreate(input, operationIds);

Expand Down
1 change: 1 addition & 0 deletions docs/reference/api/generated-api-html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12037,6 +12037,7 @@ <h3><a name="WebBackendConnectionCreate"><code>WebBackendConnectionCreate</code>
<div class="param">operations (optional)</div><div class="param-desc"><span class="param-type"><a href="#OperationCreate">array[OperationCreate]</a></span> </div>
<div class="param">sourceCatalogId (optional)</div><div class="param-desc"><span class="param-type"><a href="#UUID">UUID</a></span> format: uuid</div>
<div class="param">geography (optional)</div><div class="param-desc"><span class="param-type"><a href="#Geography">Geography</a></span> </div>
<div class="param">nonBreakingChangesPreference (optional)</div><div class="param-desc"><span class="param-type"><a href="#NonBreakingChangesPreference">NonBreakingChangesPreference</a></span> </div>
</div> <!-- field-items -->
</div>
<div class="model">
Expand Down
5 changes: 5 additions & 0 deletions tools/openapi2jsonschema/examples/airbyte.local/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2638,6 +2638,11 @@ components:
$ref: "#/components/schemas/ConnectionStatus"
syncCatalog:
$ref: "#/components/schemas/AirbyteCatalog"
nonBreakingChangesPreference:
enum:
- ignore
- disable
type: string
required:
- connection
- sourceId
Expand Down