Skip to content

Commit

Permalink
fix: Use Pydantic model_dump_json method instead of deprecated json
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Dec 28, 2024
1 parent cba9d3e commit a40c8ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions meltano/edk/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ def describe_formatted( # type: ignore[return]
if output_format == DescribeFormat.text:
return pformat(self.describe())
elif output_format == DescribeFormat.json:
return self.describe().json(indent=2)
return self.describe().model_dump_json(indent=2)
elif output_format == DescribeFormat.yaml:
# just calling describe().dict() and dumping that to yaml yields a yaml that
# is subtly different to the json variant in that it you have an additional
# level of nesting.
return yaml.dump(
yaml.safe_load(self.describe().json()), sort_keys=False, indent=2
yaml.safe_load(self.describe().model_dump_json()),
sort_keys=False,
indent=2,
)

def pass_through_invoker(
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ typer = ">=0.6.1,<0.16.0"
target-version = "py38"

[tool.ruff.lint]
ignore = [
"ANN101",
]
select = [
"E",
"F",
Expand All @@ -87,6 +84,9 @@ select = [
"ANN",
"D",
"UP",
"SIM",
"PERF",
"FURB",
]

[tool.ruff.lint.flake8-annotations]
Expand Down

0 comments on commit a40c8ca

Please sign in to comment.