Skip to content

Commit 5cc1353

Browse files
feat: add overlay to remove connector-specific models from generated SDK
Replace SourceConfiguration, DestinationConfiguration, and OAuthCredentialsConfiguration oneOf unions with generic typed objects that require sourceType/destinationType discriminator fields. This removes ~600 individual connector config schemas from generation, shrinking the SDK by ~600 Python model files and ~1,800 doc files (~14MB). Users pass configuration as a plain dict; the API validates server-side. Co-Authored-By: AJ Steers <aj@airbyte.io>
1 parent a1d6b45 commit 5cc1353

2 files changed

Lines changed: 69 additions & 9 deletions

File tree

.speakeasy/workflow.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ sources:
88
airbyte-api:
99
inputs:
1010
- location: https://raw.githubusercontent.com/airbytehq/airbyte-platform/refs/heads/main/airbyte-api/server-api/src/main/openapi/api_sdk.yaml
11-
# Uncomment when the overlay has real actions (empty overlays produce
12-
# an empty document in Speakeasy CLI, which fails linting):
13-
# overlays:
14-
# - location: ./overlays/python_speakeasy.yaml
11+
overlays:
12+
- location: ./overlays/python_speakeasy.yaml
1513
registry:
1614
location: registry.speakeasyapi.dev/airbyte/airbyte-prod/my-source
1715
targets:

overlays/python_speakeasy.yaml

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,75 @@
11
# Speakeasy overlay for Python SDK-specific customizations.
22
# Applied on top of the upstream API spec before code generation.
33
#
4-
# This file is currently a no-op placeholder. Add overlay actions here
5-
# when Python SDK-specific schema tweaks are needed.
6-
#
74
# See: https://www.speakeasy.com/docs/customize-sdks/overlays
85

96
overlay: 1.0.0
107
info:
118
title: Python SDK Overlay
12-
version: 0.0.0
13-
actions: []
9+
version: 0.1.0
10+
actions:
11+
# ---------------------------------------------------------------------------
12+
# Remove individual connector configuration schemas.
13+
#
14+
# The upstream spec defines ~600 source-* and ~90 destination-* schemas that
15+
# enumerate every connector's configuration fields. These schemas are only
16+
# reachable via the SourceConfiguration / DestinationConfiguration oneOf
17+
# unions. Replacing those unions with a generic typed-dict object eliminates
18+
# the need for all the individual connector models and shrinks the generated
19+
# SDK by ~600 Python files and ~1,800 doc files (~14 MB).
20+
#
21+
# Users pass configuration as a plain dict with a required sourceType /
22+
# destinationType discriminator; the API validates the full schema server-side.
23+
# ---------------------------------------------------------------------------
24+
25+
# Replace SourceConfiguration oneOf (555 connector schemas) with generic object
26+
- target: "$.components.schemas.SourceConfiguration"
27+
update:
28+
description: >-
29+
The values required to configure the source.
30+
Must include a `sourceType` string identifying the connector (e.g. 'postgres', 'github').
31+
Additional properties depend on the connector type; the API validates the full schema server-side.
32+
example: { sourceType: "postgres", host: "localhost", port: 5432 }
33+
oneOf: null
34+
type: object
35+
additionalProperties: true
36+
required:
37+
- sourceType
38+
properties:
39+
sourceType:
40+
type: string
41+
description: "The type of source connector."
42+
43+
# Replace DestinationConfiguration oneOf (45 connector schemas) with generic object
44+
- target: "$.components.schemas.DestinationConfiguration"
45+
update:
46+
description: >-
47+
The values required to configure the destination.
48+
Must include a `destinationType` string identifying the connector (e.g. 'postgres', 'bigquery').
49+
Additional properties depend on the connector type; the API validates the full schema server-side.
50+
example: { destinationType: "postgres", host: "localhost", port: 5432 }
51+
oneOf: null
52+
type: object
53+
additionalProperties: true
54+
required:
55+
- destinationType
56+
properties:
57+
destinationType:
58+
type: string
59+
description: "The type of destination connector."
60+
61+
# Replace OAuthCredentialsConfiguration oneOf (~47 OAuth credential schemas) with generic object
62+
- target: "$.components.schemas.OAuthCredentialsConfiguration"
63+
update:
64+
description: "OAuth credentials configuration for the connector."
65+
example: { client_id: "your-client-id", client_secret: "your-client-secret" }
66+
oneOf: null
67+
type: object
68+
additionalProperties: true
69+
70+
# Replace OAuthActorNames enum with a plain string (forward-compatible with new connectors)
71+
- target: "$.components.schemas.OAuthActorNames"
72+
update:
73+
enum: null
74+
type: string
75+
description: "The name of the OAuth-enabled connector (e.g. 'github', 'google-ads')."

0 commit comments

Comments
 (0)