Skip to content

Commit aace7ae

Browse files
author
Joe Reuter
authored
🪟🔧 Connector builder: Do not rely on local cdk anymore (#22391)
* do not rely on local cdk anymore * cache versioned schemas * fix used version * review comments
1 parent 13aac77 commit aace7ae

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

airbyte-webapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"stylelint": "stylelint 'src/**/*.{css,scss}'",
2626
"stylelint-check": "stylelint-config-prettier-scss-check",
2727
"license-check": "node ./scripts/license-check.js",
28-
"generate-client": "orval",
28+
"generate-client": "./scripts/load-declarative-schema.sh && orval",
2929
"validate-links": "ts-node --skip-project ./scripts/validate-links.ts"
3030
},
3131
"dependencies": {
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This script makes sure the json schema for the low code connector manifest is provided for orval to build the Typescript types
2+
# used by the connector builder UI. It either downloads a released version from PyPI or copies it over from a specified file path.
3+
4+
set -e
5+
mkdir -p build
6+
7+
# Make sure this is aligned with the CDK version of the connector builder server
8+
DEFAULT_CDK_VERSION="0.25.0"
9+
10+
if [ -z "$CDK_VERSION" ]
11+
then
12+
CDK_VERSION=$DEFAULT_CDK_VERSION
13+
fi
14+
15+
16+
if [ -z "$CDK_MANIFEST_PATH" ]
17+
then
18+
TARGET_FILE="build/declarative_component_schema-${CDK_VERSION}.yaml"
19+
if [ ! -f "$TARGET_FILE" ]; then
20+
echo "Downloading CDK manifest schema $CDK_VERSION from pypi"
21+
curl -L https://pypi.python.org/packages/source/a/airbyte-cdk/airbyte-cdk-${CDK_VERSION}.tar.gz | tar -xzO airbyte-cdk-${CDK_VERSION}/airbyte_cdk/sources/declarative/declarative_component_schema.yaml > ${TARGET_FILE}
22+
else
23+
echo "Found cached CDK manifest schema $CDK_VERSION"
24+
fi
25+
cp ${TARGET_FILE} build/declarative_component_schema.yaml
26+
else
27+
echo "Copying local CDK manifest version from $CDK_MANIFEST_PATH"
28+
cp ${CDK_MANIFEST_PATH} build/declarative_component_schema.yaml
29+
fi

airbyte-webapp/src/services/connectorBuilder/connector_manifest_openapi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ paths: {}
66
components:
77
schemas:
88
ConnectorManifest:
9-
$ref: "../../../../airbyte-cdk/python/airbyte_cdk/sources/declarative/declarative_component_schema.yaml"
9+
$ref: "../../../build/declarative_component_schema.yaml"

docs/contributing-to-airbyte/developing-locally.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ pnpm start
198198

199199
- Happy Hacking!
200200

201+
#### Using a custom version of the CDK declarative manifest schema for the connector builder UI
202+
203+
When working on the connector builder UI and doing changes to the CDK and the webapp at the same time, you can start the dev server with `CDK_MANIFEST_PATH` or `CDK_VERSION` environment variables set to have the correct Typescript types built. If `CDK_VERSION` is set, it's loading the specified version of the CDK from pypi instead of the default one, if `CDK_MANIFEST_PATH` is set, it's copying the schema file locally.
204+
205+
For example:
206+
```
207+
CDK_MANIFEST_PATH=../../airbyte/airbyte-cdk/python/airbyte_cdk/sources/declarative/declarative_component_schema.yaml pnpm start
208+
```
209+
201210
### Connector Specification Caching
202211

203212
The Configuration API caches connector specifications. This is done to avoid needing to run Docker everytime one is needed in the UI. Without this caching, the UI crawls. If you update the specification of a connector and need to clear this cache so the API / UI picks up the change, you have two options:

0 commit comments

Comments
 (0)