Skip to content

Commit

Permalink
Source Klaviyo: update schema validation in SAT (#6952)
Browse files Browse the repository at this point in the history
* Disable schema validation for configured_catalog

* Upd pydantic-generated schema

* Upd comment

* Bump version, upd changelog
  • Loading branch information
gaart committed Oct 21, 2021
1 parent d5e80d0 commit dfdbda8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
Expand Up @@ -2,6 +2,6 @@
"sourceDefinitionId": "95e8cffd-b8c4-4039-968e-d32fb4a69bde",
"name": "Klaviyo",
"dockerRepository": "airbyte/source-klaviyo",
"dockerImageTag": "0.1.1",
"dockerImageTag": "0.1.2",
"documentationUrl": "https://docs.airbyte.io/integrations/sources/klaviyo"
}
Expand Up @@ -168,7 +168,7 @@
- sourceDefinitionId: 95e8cffd-b8c4-4039-968e-d32fb4a69bde
name: Klaviyo
dockerRepository: airbyte/source-klaviyo
dockerImageTag: 0.1.1
dockerImageTag: 0.1.2
documentationUrl: https://docs.airbyte.io/integrations/sources/klaviyo
sourceType: api
- sourceDefinitionId: 9da77001-af33-4bcd-be46-6252bf9342b9
Expand Down
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-klaviyo/Dockerfile
Expand Up @@ -12,5 +12,5 @@ RUN pip install .
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.1.1
LABEL io.airbyte.version=0.1.2
LABEL io.airbyte.name=airbyte/source-klaviyo
@@ -1,3 +1,4 @@
{
"todo-wrong-field": "this should be an incomplete config file, used in standard tests"
"api_key": "api-key",
"start_date": "2021-01-01T00:00:00Z"
}
Expand Up @@ -15,14 +15,24 @@ class Config:

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

object: str


class PersonList(BaseModel):
class PersonList(BaseSchemaModel):
id: str
name: str
created: datetime
Expand Down
5 changes: 5 additions & 0 deletions docs/integrations/sources/klaviyo.md
Expand Up @@ -46,3 +46,8 @@ The Klaviyo connector should not run into Klaviyo API limitations under normal u

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.

## CHANGELOG

| Version | Date | Pull Request | Subject |
| :------ | :-------- | :----- | :------ |
| `0.1.2` | 2021-10-19 | [6952](https://github.com/airbytehq/airbyte/pull/6952) | Update schema validation in SAT |

0 comments on commit dfdbda8

Please sign in to comment.