forked from airbytehq/airbyte-platform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue 23062 add update api for manifest version (#5231)
Co-authored-by: Joe Reuter <[email protected]>
- Loading branch information
Showing
14 changed files
with
562 additions
and
245 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
...src/main/java/io/airbyte/commons/server/handlers/helpers/ConnectorBuilderSpecAdapter.java
This file was deleted.
Oops, something went wrong.
66 changes: 66 additions & 0 deletions
66
...in/java/io/airbyte/commons/server/handlers/helpers/DeclarativeSourceManifestInjector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2023 Airbyte, Inc., all rights reserved. | ||
*/ | ||
|
||
package io.airbyte.commons.server.handlers.helpers; | ||
|
||
import static io.airbyte.commons.version.AirbyteProtocolVersion.DEFAULT_AIRBYTE_PROTOCOL_VERSION; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import io.airbyte.config.ActorDefinitionConfigInjection; | ||
import io.airbyte.protocol.models.ConnectorSpecification; | ||
import jakarta.inject.Singleton; | ||
import java.net.URI; | ||
import java.util.UUID; | ||
|
||
/** | ||
* Adapter to go from Connector Builder concept to actor definitions. | ||
*/ | ||
@Singleton | ||
public class DeclarativeSourceManifestInjector { | ||
|
||
private static final String INJECTED_DECLARATIVE_MANIFEST = "__injected_declarative_manifest"; | ||
|
||
/** | ||
* Add __injected_declarative_manifest to the spec. | ||
* | ||
* @param spec Connector Builder spec | ||
*/ | ||
public void addInjectedDeclarativeManifest(final JsonNode spec) { | ||
((ObjectNode) spec.path("connectionSpecification").path("properties")) | ||
.putObject(INJECTED_DECLARATIVE_MANIFEST) | ||
.put("type", "object") | ||
.put("additionalProperties", true); | ||
} | ||
|
||
/** | ||
* Create ActorDefinitionConfigInjection with __injected_declarative_manifest. | ||
* | ||
* @param sourceDefinitionId matching the source definition the config needs to be injected | ||
* @param manifest to be injected | ||
*/ | ||
public ActorDefinitionConfigInjection createConfigInjection(final UUID sourceDefinitionId, final JsonNode manifest) { | ||
return new ActorDefinitionConfigInjection() | ||
.withActorDefinitionId(sourceDefinitionId) | ||
.withInjectionPath(INJECTED_DECLARATIVE_MANIFEST) | ||
.withJsonToInject(manifest); | ||
} | ||
|
||
/** | ||
* Adapt the spec to match the actor definition. | ||
* | ||
* @param declarativeManifestSpec to be adapted to a ConnectorSpecification | ||
*/ | ||
public ConnectorSpecification createDeclarativeManifestConnectorSpecification(JsonNode declarativeManifestSpec) { | ||
return new ConnectorSpecification() | ||
.withSupportsDBT(false) | ||
.withSupportsNormalization(false) | ||
// FIXME should be aligned with the airbyte-cdk version but will be addressed as part of | ||
// https://github.com/airbytehq/airbyte/issues/24047 | ||
.withProtocolVersion(DEFAULT_AIRBYTE_PROTOCOL_VERSION.serialize()) | ||
.withDocumentationUrl(URI.create(declarativeManifestSpec.path("documentationUrl").asText(""))) | ||
.withConnectionSpecification(declarativeManifestSpec.get("connectionSpecification")); | ||
} | ||
|
||
} |
Oops, something went wrong.