Skip to content

Commit 131e46e

Browse files
gaartschlattk
authored andcommitted
Source Klaviyo: update schema validation in SAT (airbytehq#6952)
* Disable schema validation for configured_catalog * Upd pydantic-generated schema * Upd comment * Bump version, upd changelog
1 parent de05f20 commit 131e46e

File tree

6 files changed

+23
-7
lines changed

6 files changed

+23
-7
lines changed

airbyte-config/init/src/main/resources/config/STANDARD_SOURCE_DEFINITION/95e8cffd-b8c4-4039-968e-d32fb4a69bde.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
"sourceDefinitionId": "95e8cffd-b8c4-4039-968e-d32fb4a69bde",
33
"name": "Klaviyo",
44
"dockerRepository": "airbyte/source-klaviyo",
5-
"dockerImageTag": "0.1.1",
5+
"dockerImageTag": "0.1.2",
66
"documentationUrl": "https://docs.airbyte.io/integrations/sources/klaviyo"
77
}

airbyte-config/init/src/main/resources/seed/source_definitions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
- sourceDefinitionId: 95e8cffd-b8c4-4039-968e-d32fb4a69bde
169169
name: Klaviyo
170170
dockerRepository: airbyte/source-klaviyo
171-
dockerImageTag: 0.1.1
171+
dockerImageTag: 0.1.2
172172
documentationUrl: https://docs.airbyte.io/integrations/sources/klaviyo
173173
sourceType: api
174174
- sourceDefinitionId: 9da77001-af33-4bcd-be46-6252bf9342b9

airbyte-integrations/connectors/source-klaviyo/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ RUN pip install .
1212
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
1313
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]
1414

15-
LABEL io.airbyte.version=0.1.1
15+
LABEL io.airbyte.version=0.1.2
1616
LABEL io.airbyte.name=airbyte/source-klaviyo
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"todo-wrong-field": "this should be an incomplete config file, used in standard tests"
2+
"api_key": "api-key",
3+
"start_date": "2021-01-01T00:00:00Z"
34
}

airbyte-integrations/connectors/source-klaviyo/source_klaviyo/schemas.py

+13-3
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,24 @@ class Config:
1515

1616
@staticmethod
1717
def schema_extra(schema: MutableMapping[str, Any], model) -> None:
18-
# Pydantic adds title to every attribute, this is too much, so we manually drop them
19-
for prop in schema.get("properties", {}).values():
18+
# Pydantic adds a title to each attribute, that is not needed, so we manually drop them.
19+
# Also pydantic does not add a "null" option to a field marked as optional,
20+
# so we add this functionality manually. Same for "$ref"
21+
schema.pop("title", None)
22+
for name, prop in schema.get("properties", {}).items():
2023
prop.pop("title", None)
24+
allow_none = model.__fields__[name].allow_none
25+
if allow_none:
26+
if "type" in prop:
27+
prop["type"] = ["null", prop["type"]]
28+
elif "$ref" in prop:
29+
ref = prop.pop("$ref")
30+
prop["oneOf"] = [{"type": "null"}, {"$ref": ref}]
2131

2232
object: str
2333

2434

25-
class PersonList(BaseModel):
35+
class PersonList(BaseSchemaModel):
2636
id: str
2737
name: str
2838
created: datetime

docs/integrations/sources/klaviyo.md

+5
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ The Klaviyo connector should not run into Klaviyo API limitations under normal u
4646

4747
Please follow these [steps](https://help.klaviyo.com/hc/en-us/articles/115005062267-How-to-Manage-Your-Account-s-API-Keys#your-private-api-keys3) to obtain Private API Key for your account.
4848

49+
## CHANGELOG
50+
51+
| Version | Date | Pull Request | Subject |
52+
| :------ | :-------- | :----- | :------ |
53+
| `0.1.2` | 2021-10-19 | [6952](https://github.com/airbytehq/airbyte/pull/6952) | Update schema validation in SAT |

0 commit comments

Comments
 (0)