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

Remove source/destination spec IDs and replace with source/destinationIds in the backend #528

Merged
merged 15 commits into from
Oct 9, 2020
Merged
158 changes: 131 additions & 27 deletions airbyte-api/src/main/openapi/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,48 @@ paths:
description: Workspace not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/sources/create:
post:
tags:
- source
summary: Creates a source
operationId: createSource
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SourceCreate"
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/SourceRead"
"422":
$ref: "#/components/responses/InvalidInput"
/v1/sources/update:
post:
tags:
- source
summary: Update a source
operationId: updateSource
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/SourceUpdate"
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/SourceRead"
"404":
description: Source not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/sources/list:
post:
tags:
Expand Down Expand Up @@ -178,7 +220,7 @@ paths:
schema:
$ref: "#/components/schemas/SourceSpecificationRead"
"404":
description: Source Specification not found
description: Source not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/source_implementations/create:
Expand Down Expand Up @@ -337,6 +379,29 @@ paths:
description: Source Implementation not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/destinations/update:
post:
tags:
- destination
summary: Update destination
operationId: updateDestination
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/DestinationUpdate"
required: true
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/DestinationRead"
"404":
description: Destination not found
"422":
$ref: "#/components/responses/InvalidInput"
/v1/destinations/list:
post:
tags:
Expand Down Expand Up @@ -875,16 +940,53 @@ components:
properties:
sourceId:
$ref: "#/components/schemas/SourceId"
SourceCreate:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't that be called SourceDefinitionCreate based on https://airbytehq.slack.com/archives/C019WEENQRM/p1601672342057100

type: object
required:
- name
- dockerRepository
- dockerImageTag
- documentationUrl
properties:
name:
type: string
dockerRepository:
type: string
dockerImageTag:
type: string
documentationUrl:
type: string
format: uri
SourceUpdate:
type: object
description: Update the source. Currently, the only allowed attribute to update is the default docker image version.
required:
- sourceId
- dockerImageTag
properties:
sourceId:
$ref: "#/components/schemas/SourceId"
dockerImageTag:
type: string
SourceRead:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceDefinitionRead

type: object
required:
- sourceId
- name
- dockerRepository
- dockerImageTag
properties:
sourceId:
$ref: "#/components/schemas/SourceId"
name:
type: string
dockerRepository:
type: string
dockerImageTag:
type: string
documentationUrl:
type: string
format: uri
SourceReadList:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceDefinitionList

type: object
required:
Expand All @@ -895,21 +997,15 @@ components:
items:
$ref: "#/components/schemas/SourceRead"
# SOURCE SPECIFICATION
SourceSpecificationId:
type: string
format: uuid
SourceSpecification:
description: The specification for what values are required to configure the source.
example: { user: { type: string } }
SourceSpecificationRead:
type: object
required:
- sourceSpecificationId
- sourceId
- specification
- connectionSpecification
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the naming is confusing here and it introduces a new term connection
what about something like: expectedConfigurations or configurations

properties:
sourceSpecificationId:
$ref: "#/components/schemas/SourceSpecificationId"
sourceId:
$ref: "#/components/schemas/SourceId"
documentationUrl:
Expand All @@ -934,14 +1030,14 @@ components:
type: object
required:
- workspaceId
- sourceSpecificationId
- sourceId
- connectionConfiguration
- name
properties:
workspaceId:
$ref: "#/components/schemas/WorkspaceId"
sourceSpecificationId:
$ref: "#/components/schemas/SourceSpecificationId"
sourceId:
$ref: "#/components/schemas/SourceId"
connectionConfiguration:
$ref: "#/components/schemas/SourceConfiguration"
name:
Expand All @@ -965,7 +1061,6 @@ components:
- sourceId
- sourceImplementationId
- workspaceId
- sourceSpecificationId
- connectionConfiguration
- name
- sourceName
Expand All @@ -976,8 +1071,6 @@ components:
$ref: "#/components/schemas/SourceImplementationId"
workspaceId:
$ref: "#/components/schemas/WorkspaceId"
sourceSpecificationId:
$ref: "#/components/schemas/SourceSpecificationId"
connectionConfiguration:
$ref: "#/components/schemas/SourceConfiguration"
name:
Expand Down Expand Up @@ -1011,16 +1104,36 @@ components:
properties:
destinationId:
$ref: "#/components/schemas/DestinationId"
DestinationUpdate:
type: object
required:
- destinationId
- destinationImageVersion
properties:
destinationId:
$ref: "#/components/schemas/DestinationId"
dockerImageTag:
type: string
DestinationRead:
type: object
required:
- destinationId
- name
- dockerRepository
- dockerImageTag
- documentationUrl
properties:
destinationId:
$ref: "#/components/schemas/DestinationId"
name:
type: string
dockerRepository:
type: string
dockerImageTag:
type: string
documentationUrl:
type: string
format: uri
DestinationReadList:
type: object
required:
Expand All @@ -1031,21 +1144,15 @@ components:
items:
$ref: "#/components/schemas/DestinationRead"
# DESTINATION SPECIFICATION
DestinationSpecificationId:
type: string
format: uuid
DestinationSpecification:
description: The specification for what values are required to configure the destination.
example: { user: { type: string } }
DestinationSpecificationRead:
type: object
required:
- destinationSpecificationId
- destinationId
- specification
- connectionSpecification
properties:
destinationSpecificationId:
$ref: "#/components/schemas/DestinationSpecificationId"
destinationId:
$ref: "#/components/schemas/DestinationId"
documentationUrl:
Expand All @@ -1070,13 +1177,13 @@ components:
type: object
required:
- workspaceId
- destinationSpecificationId
- destinationId
- connectionConfiguration
properties:
workspaceId:
$ref: "#/components/schemas/WorkspaceId"
destinationSpecificationId:
$ref: "#/components/schemas/DestinationSpecificationId"
destinationId:
$ref: "#/components/schemas/DestinationId"
connectionConfiguration:
$ref: "#/components/schemas/DestinationConfiguration"
name:
Expand All @@ -1100,7 +1207,6 @@ components:
- destinationId
- destinationImplementationId
- workspaceId
- destinationSpecificationId
- connectionConfiguration
- name
- destinationName
Expand All @@ -1111,8 +1217,6 @@ components:
$ref: "#/components/schemas/DestinationImplementationId"
workspaceId:
$ref: "#/components/schemas/WorkspaceId"
destinationSpecificationId:
$ref: "#/components/schemas/DestinationSpecificationId"
connectionConfiguration:
$ref: "#/components/schemas/DestinationConfiguration"
name:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* MIT License
*
* Copyright (c) 2020 Airbyte
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/

package io.airbyte.commons.docker;

public class DockerUtils {

public static String getTaggedImageName(String dockerRepository, String tag) {
return String.join(":", dockerRepository, tag);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,19 @@
* SOFTWARE.
*/

package io.airbyte.server.helpers;
package io.airbyte.commons.docker;

import io.airbyte.commons.json.Jsons;
import io.airbyte.config.DestinationConnectionSpecification;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.UUID;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class DestinationSpecificationHelpers {
import org.junit.jupiter.api.Test;

public static DestinationConnectionSpecification generateDestinationSpecification() throws IOException {
return generateDestinationSpecification(UUID.randomUUID());
}

public static DestinationConnectionSpecification generateDestinationSpecification(UUID destinationId)
throws IOException {
final UUID destinationSpecificationId = UUID.randomUUID();

final Path path =
Paths.get("../airbyte-server/src/test/resources/json/TestSpecification.json");
class DockerUtilsTest {

return new DestinationConnectionSpecification()
.withDestinationId(destinationId)
.withDestinationSpecificationId(destinationSpecificationId)
.withDocumentationUrl("https://airbyte.io")
.withSpecification(Jsons.deserialize(Files.readString(path)));
@Test
void testGetTaggedImageName() {
String repository = "airbyte/repo";
String tag = "12.3";
assertEquals("airbyte/repo:12.3", DockerUtils.getTaggedImageName(repository, tag));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ public enum ConfigSchema {

// source
STANDARD_SOURCE("StandardSource.yaml"),
SOURCE_CONNECTION_SPECIFICATION("SourceConnectionSpecification.yaml"),
SOURCE_CONNECTION_IMPLEMENTATION("SourceConnectionImplementation.yaml"),

// destination
STANDARD_DESTINATION("StandardDestination.yaml"),
DESTINATION_CONNECTION_SPECIFICATION("DestinationConnectionSpecification.yaml"),
DESTINATION_CONNECTION_IMPLEMENTATION("DestinationConnectionImplementation.yaml"),

// specs
CONNECTOR_SPECIFICATION("ConnectorSpecification.yaml"),

// sync
STANDARD_SYNC("StandardSync.yaml"),
STANDARD_SYNC_SUMMARY("StandardSyncSummary.yaml"),
Expand Down
Loading