Skip to content

Commit

Permalink
fix: Patch schema to allow null cidrs arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Feb 1, 2025
1 parent 8b516d2 commit 45a3ba7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ repos:
- id: trailing-whitespace

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.30.0
rev: 0.31.1
hooks:
- id: check-dependabot
- id: check-github-workflows

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.4
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
Expand Down
33 changes: 29 additions & 4 deletions plugins/loaders/target-csv--meltanolabs.lock
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
"name": "add_record_metadata",
"kind": "boolean",
"label": "Add Record Metadata",
"description": "Add metadata to records."
"description": "Whether to add metadata fields to records."
},
{
"name": "batch_size_rows",
"kind": "integer",
"label": "Batch Size Rows",
"description": "Maximum number of rows in each batch."
},
{
"name": "datestamp_format",
Expand All @@ -44,6 +50,18 @@
"label": "Escape Character",
"description": "The character to use for escaping special characters."
},
{
"name": "faker_config.locale",
"kind": "array",
"label": "Faker Locale",
"description": "One or more LCID locale strings to produce localized output for: https://faker.readthedocs.io/en/master/#localization"
},
{
"name": "faker_config.seed",
"kind": "string",
"label": "Faker Seed",
"description": "Value to seed the Faker generator for deterministic output: https://faker.readthedocs.io/en/master/#seeding-the-generator"
},
{
"name": "file_naming_scheme",
"kind": "string",
Expand All @@ -54,13 +72,13 @@
{
"name": "flattening_enabled",
"kind": "boolean",
"label": "Flattening Enabled",
"label": "Enable Schema Flattening",
"description": "'True' to enable schema flattening and automatically expand nested properties."
},
{
"name": "flattening_max_depth",
"kind": "integer",
"label": "Flattening Max Depth",
"label": "Max Flattening Depth",
"description": "The max depth to flatten schemas."
},
{
Expand Down Expand Up @@ -112,7 +130,7 @@
{
"name": "stream_map_config",
"kind": "object",
"label": "Stream Map Config",
"label": "User Stream Map Configuration",
"description": "User-defined config values to be used within map expressions."
},
{
Expand All @@ -134,6 +152,13 @@
"value": "UTC",
"label": "Timestamp Timezone",
"description": "The timezone code or name to use when generating `{timestamp}` and `{datestamp}`. Defaults to 'UTC'. For a list of possible values, please see: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones"
},
{
"name": "validate_records",
"kind": "boolean",
"value": true,
"label": "Validate Records",
"description": "Whether to validate the schema of the incoming streams."
}
]
}
8 changes: 8 additions & 0 deletions tap_planetscaleapi/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import annotations

import functools
import typing as t

from tap_planetscaleapi.client import PlanetScaleAPIStream
Expand Down Expand Up @@ -260,6 +261,13 @@ class PasswordsStream(PlanetScaleAPIStream):
"items",
)

@functools.cached_property
def schema(self) -> dict[str, t.Any]:
"""Patch the stream schema."""
schema = super().schema
schema["properties"]["cidrs"]["type"] = ["array", "null"]
return schema


class DeployRequestsStream(PlanetScaleAPIStream):
"""Deploy requests."""
Expand Down

0 comments on commit 45a3ba7

Please sign in to comment.