From 1cadcd9418281d551a5285454256c87601826354 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:13:38 +0000 Subject: [PATCH 1/2] fix(pydantic): do not pass `by_alias` unless set --- src/moderation_api/_compat.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/moderation_api/_compat.py b/src/moderation_api/_compat.py index 786ff42..e6690a4 100644 --- a/src/moderation_api/_compat.py +++ b/src/moderation_api/_compat.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self, Literal +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo @@ -131,6 +131,10 @@ def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: return model.model_dump_json(indent=indent) +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool + + def model_dump( model: pydantic.BaseModel, *, @@ -142,6 +146,9 @@ def model_dump( by_alias: bool | None = None, ) -> dict[str, Any]: if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( mode=mode, exclude=exclude, @@ -149,7 +156,7 @@ def model_dump( exclude_defaults=exclude_defaults, # warnings are not supported in Pydantic v1 warnings=True if PYDANTIC_V1 else warnings, - by_alias=by_alias, + **kwargs, ) return cast( "dict[str, Any]", From 007566cca1cb6e4452f816cdb438c0ec64925dd0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 17 Mar 2026 13:14:06 +0000 Subject: [PATCH 2/2] release: 1.12.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/moderation_api/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index de0960a..ffb929a 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.12.0" + ".": "1.12.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 7dd1fa0..0a87bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 1.12.1 (2026-03-17) + +Full Changelog: [v1.12.0...v1.12.1](https://github.com/moderation-api/sdk-python/compare/v1.12.0...v1.12.1) + +### Bug Fixes + +* **pydantic:** do not pass `by_alias` unless set ([1cadcd9](https://github.com/moderation-api/sdk-python/commit/1cadcd9418281d551a5285454256c87601826354)) + ## 1.12.0 (2026-03-16) Full Changelog: [v1.11.0...v1.12.0](https://github.com/moderation-api/sdk-python/compare/v1.11.0...v1.12.0) diff --git a/pyproject.toml b/pyproject.toml index 842bb0d..68fc3ae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "moderation_api" -version = "1.12.0" +version = "1.12.1" description = "The official Python library for the moderation-api API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/moderation_api/_version.py b/src/moderation_api/_version.py index 5eaadd4..0951ac8 100644 --- a/src/moderation_api/_version.py +++ b/src/moderation_api/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "moderation_api" -__version__ = "1.12.0" # x-release-please-version +__version__ = "1.12.1" # x-release-please-version