From 5db779213e0c088d2a615dccd43e0f7ca94bea1a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 15:02:47 +0000 Subject: [PATCH 1/7] fix: use correct field name format for multipart file arrays --- src/gcore/_qs.py | 8 ++----- src/gcore/_types.py | 3 +++ src/gcore/_utils/_utils.py | 42 ++++++++++++++++++++++++++++++------- tests/test_extract_files.py | 28 ++++++++++++++++++++----- tests/test_files.py | 2 +- 5 files changed, 63 insertions(+), 20 deletions(-) diff --git a/src/gcore/_qs.py b/src/gcore/_qs.py index de8c99bc..4127c19c 100644 --- a/src/gcore/_qs.py +++ b/src/gcore/_qs.py @@ -2,17 +2,13 @@ from typing import Any, List, Tuple, Union, Mapping, TypeVar from urllib.parse import parse_qs, urlencode -from typing_extensions import Literal, get_args +from typing_extensions import get_args -from ._types import NotGiven, not_given +from ._types import NotGiven, ArrayFormat, NestedFormat, not_given from ._utils import flatten _T = TypeVar("_T") - -ArrayFormat = Literal["comma", "repeat", "indices", "brackets"] -NestedFormat = Literal["dots", "brackets"] - PrimitiveData = Union[str, int, float, bool, None] # this should be Data = Union[PrimitiveData, "List[Data]", "Tuple[Data]", "Mapping[str, Data]"] # https://github.com/microsoft/pyright/issues/3555 diff --git a/src/gcore/_types.py b/src/gcore/_types.py index bbc3b7c8..8a2122e5 100644 --- a/src/gcore/_types.py +++ b/src/gcore/_types.py @@ -47,6 +47,9 @@ ModelT = TypeVar("ModelT", bound=pydantic.BaseModel) _T = TypeVar("_T") +ArrayFormat = Literal["comma", "repeat", "indices", "brackets"] +NestedFormat = Literal["dots", "brackets"] + # Approximates httpx internal ProxiesTypes and RequestFiles types # while adding support for `PathLike` instances diff --git a/src/gcore/_utils/_utils.py b/src/gcore/_utils/_utils.py index 771859f5..199cd231 100644 --- a/src/gcore/_utils/_utils.py +++ b/src/gcore/_utils/_utils.py @@ -17,11 +17,11 @@ ) from pathlib import Path from datetime import date, datetime -from typing_extensions import TypeGuard +from typing_extensions import TypeGuard, get_args import sniffio -from .._types import Omit, NotGiven, FileTypes, HeadersLike +from .._types import Omit, NotGiven, FileTypes, ArrayFormat, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -40,25 +40,45 @@ def extract_files( query: Mapping[str, object], *, paths: Sequence[Sequence[str]], + array_format: ArrayFormat = "brackets", ) -> list[tuple[str, FileTypes]]: """Recursively extract files from the given dictionary based on specified paths. A path may look like this ['foo', 'files', '', 'data']. + ``array_format`` controls how ```` segments contribute to the emitted + field name. Supported values: ``"brackets"`` (``foo[]``), ``"repeat"`` and + ``"comma"`` (``foo``), ``"indices"`` (``foo[0]``, ``foo[1]``). + Note: this mutates the given dictionary. """ files: list[tuple[str, FileTypes]] = [] for path in paths: - files.extend(_extract_items(query, path, index=0, flattened_key=None)) + files.extend(_extract_items(query, path, index=0, flattened_key=None, array_format=array_format)) return files +def _array_suffix(array_format: ArrayFormat, array_index: int) -> str: + if array_format == "brackets": + return "[]" + if array_format == "indices": + return f"[{array_index}]" + if array_format == "repeat" or array_format == "comma": + # Both repeat the bare field name for each file part; there is no + # meaningful way to comma-join binary parts. + return "" + raise NotImplementedError( + f"Unknown array_format value: {array_format}, choose from {', '.join(get_args(ArrayFormat))}" + ) + + def _extract_items( obj: object, path: Sequence[str], *, index: int, flattened_key: str | None, + array_format: ArrayFormat, ) -> list[tuple[str, FileTypes]]: try: key = path[index] @@ -75,9 +95,11 @@ def _extract_items( if is_list(obj): files: list[tuple[str, FileTypes]] = [] - for entry in obj: - assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") - files.append((flattened_key + "[]", cast(FileTypes, entry))) + for array_index, entry in enumerate(obj): + suffix = _array_suffix(array_format, array_index) + emitted_key = (flattened_key + suffix) if flattened_key else suffix + assert_is_file_content(entry, key=emitted_key) + files.append((emitted_key, cast(FileTypes, entry))) return files assert_is_file_content(obj, key=flattened_key) @@ -106,6 +128,7 @@ def _extract_items( path, index=index, flattened_key=flattened_key, + array_format=array_format, ) elif is_list(obj): if key != "": @@ -117,9 +140,12 @@ def _extract_items( item, path, index=index, - flattened_key=flattened_key + "[]" if flattened_key is not None else "[]", + flattened_key=( + (flattened_key if flattened_key is not None else "") + _array_suffix(array_format, array_index) + ), + array_format=array_format, ) - for item in obj + for array_index, item in enumerate(obj) ] ) diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index e05e48bd..771a511a 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -4,7 +4,7 @@ import pytest -from gcore._types import FileTypes +from gcore._types import FileTypes, ArrayFormat from gcore._utils import extract_files @@ -37,10 +37,7 @@ def test_multiple_files() -> None: def test_top_level_file_array() -> None: query = {"files": [b"file one", b"file two"], "title": "hello"} - assert extract_files(query, paths=[["files", ""]]) == [ - ("files[]", b"file one"), - ("files[]", b"file two"), - ] + assert extract_files(query, paths=[["files", ""]]) == [("files[]", b"file one"), ("files[]", b"file two")] assert query == {"title": "hello"} @@ -71,3 +68,24 @@ def test_ignores_incorrect_paths( expected: list[tuple[str, FileTypes]], ) -> None: assert extract_files(query, paths=paths) == expected + + +@pytest.mark.parametrize( + "array_format,expected_top_level,expected_nested", + [ + ("brackets", [("files[]", b"a"), ("files[]", b"b")], [("items[][file]", b"a"), ("items[][file]", b"b")]), + ("repeat", [("files", b"a"), ("files", b"b")], [("items[file]", b"a"), ("items[file]", b"b")]), + ("comma", [("files", b"a"), ("files", b"b")], [("items[file]", b"a"), ("items[file]", b"b")]), + ("indices", [("files[0]", b"a"), ("files[1]", b"b")], [("items[0][file]", b"a"), ("items[1][file]", b"b")]), + ], +) +def test_array_format_controls_file_field_names( + array_format: ArrayFormat, + expected_top_level: list[tuple[str, FileTypes]], + expected_nested: list[tuple[str, FileTypes]], +) -> None: + top_level = {"files": [b"a", b"b"]} + assert extract_files(top_level, paths=[["files", ""]], array_format=array_format) == expected_top_level + + nested = {"items": [{"file": b"a"}, {"file": b"b"}]} + assert extract_files(nested, paths=[["items", "", "file"]], array_format=array_format) == expected_nested diff --git a/tests/test_files.py b/tests/test_files.py index 054b0adf..b044139b 100644 --- a/tests/test_files.py +++ b/tests/test_files.py @@ -131,7 +131,7 @@ def test_extract_files_does_not_mutate_original_nested_array_path(self) -> None: copied = deepcopy_with_paths(original, [["items", "", "file"]]) extracted = extract_files(copied, paths=[["items", "", "file"]]) - assert extracted == [("items[][file]", file1), ("items[][file]", file2)] + assert [entry for _, entry in extracted] == [file1, file2] assert original == { "items": [ {"file": file1, "extra": 1}, From c5bc635407def6e004bdb94a24e9045a1f8cf416 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 17:13:55 +0000 Subject: [PATCH 2/7] fix(cloud)!: correct pg conf validation response model name --- .stats.yml | 2 +- src/gcore/resources/cloud/api.md | 4 ++-- .../databases/postgres/custom_configurations.py | 12 +++++------- .../types/cloud/databases/postgres/__init__.py | 4 +--- ...alidate_response.py => pg_conf_validation.py} | 4 ++-- .../postgres/test_custom_configurations.py | 16 +++++++--------- 6 files changed, 18 insertions(+), 24 deletions(-) rename src/gcore/types/cloud/databases/postgres/{custom_configuration_validate_response.py => pg_conf_validation.py} (70%) diff --git a/.stats.yml b/.stats.yml index a8ec4169..7908113b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 657 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8c3bd3792724737d30da0f0200f0c589f9942ea3a028fcc9bcd56f3490ffc29a.yml openapi_spec_hash: 7b184f4e52554b89cadf11b43f395583 -config_hash: aa5a9dd05b6324fcb454d0694e5901a3 +config_hash: 22eb06625c071a1a8620647d9cc56df3 diff --git a/src/gcore/resources/cloud/api.md b/src/gcore/resources/cloud/api.md index 2f1e734b..4322d017 100644 --- a/src/gcore/resources/cloud/api.md +++ b/src/gcore/resources/cloud/api.md @@ -1190,12 +1190,12 @@ Methods: Types: ```python -from gcore.types.cloud.databases.postgres import CustomConfigurationValidateResponse +from gcore.types.cloud.databases.postgres import PgConfValidation ``` Methods: -- client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> CustomConfigurationValidateResponse +- client.cloud.databases.postgres.custom_configurations.validate(\*, project_id, region_id, \*\*params) -> PgConfValidation ## VolumeSnapshots diff --git a/src/gcore/resources/cloud/databases/postgres/custom_configurations.py b/src/gcore/resources/cloud/databases/postgres/custom_configurations.py index c4701fe8..9e8a3e2b 100644 --- a/src/gcore/resources/cloud/databases/postgres/custom_configurations.py +++ b/src/gcore/resources/cloud/databases/postgres/custom_configurations.py @@ -16,9 +16,7 @@ ) from ....._base_client import make_request_options from .....types.cloud.databases.postgres import custom_configuration_validate_params -from .....types.cloud.databases.postgres.custom_configuration_validate_response import ( - CustomConfigurationValidateResponse, -) +from .....types.cloud.databases.postgres.pg_conf_validation import PgConfValidation __all__ = ["CustomConfigurationsResource", "AsyncCustomConfigurationsResource"] @@ -56,7 +54,7 @@ def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CustomConfigurationValidateResponse: + ) -> PgConfValidation: """ Validate a custom PostgreSQL configuration file. @@ -97,7 +95,7 @@ def validate( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomConfigurationValidateResponse, + cast_to=PgConfValidation, ) @@ -134,7 +132,7 @@ async def validate( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, - ) -> CustomConfigurationValidateResponse: + ) -> PgConfValidation: """ Validate a custom PostgreSQL configuration file. @@ -175,7 +173,7 @@ async def validate( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=CustomConfigurationValidateResponse, + cast_to=PgConfValidation, ) diff --git a/src/gcore/types/cloud/databases/postgres/__init__.py b/src/gcore/types/cloud/databases/postgres/__init__.py index d33446a0..e4449e2b 100644 --- a/src/gcore/types/cloud/databases/postgres/__init__.py +++ b/src/gcore/types/cloud/databases/postgres/__init__.py @@ -3,12 +3,10 @@ from __future__ import annotations from .postgres_cluster import PostgresCluster as PostgresCluster +from .pg_conf_validation import PgConfValidation as PgConfValidation from .cluster_list_params import ClusterListParams as ClusterListParams from .cluster_create_params import ClusterCreateParams as ClusterCreateParams from .cluster_update_params import ClusterUpdateParams as ClusterUpdateParams from .postgres_cluster_short import PostgresClusterShort as PostgresClusterShort from .postgres_configuration import PostgresConfiguration as PostgresConfiguration from .custom_configuration_validate_params import CustomConfigurationValidateParams as CustomConfigurationValidateParams -from .custom_configuration_validate_response import ( - CustomConfigurationValidateResponse as CustomConfigurationValidateResponse, -) diff --git a/src/gcore/types/cloud/databases/postgres/custom_configuration_validate_response.py b/src/gcore/types/cloud/databases/postgres/pg_conf_validation.py similarity index 70% rename from src/gcore/types/cloud/databases/postgres/custom_configuration_validate_response.py rename to src/gcore/types/cloud/databases/postgres/pg_conf_validation.py index 995a4a14..8e4ae232 100644 --- a/src/gcore/types/cloud/databases/postgres/custom_configuration_validate_response.py +++ b/src/gcore/types/cloud/databases/postgres/pg_conf_validation.py @@ -4,10 +4,10 @@ from ....._models import BaseModel -__all__ = ["CustomConfigurationValidateResponse"] +__all__ = ["PgConfValidation"] -class CustomConfigurationValidateResponse(BaseModel): +class PgConfValidation(BaseModel): errors: List[str] """Errors list""" diff --git a/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py b/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py index 129a9781..1f6935d3 100644 --- a/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py +++ b/tests/api_resources/cloud/databases/postgres/test_custom_configurations.py @@ -9,9 +9,7 @@ from gcore import Gcore, AsyncGcore from tests.utils import assert_matches_type -from gcore.types.cloud.databases.postgres import ( - CustomConfigurationValidateResponse, -) +from gcore.types.cloud.databases.postgres import PgConfValidation base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -27,7 +25,7 @@ def test_method_validate(self, client: Gcore) -> None: pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", version="15", ) - assert_matches_type(CustomConfigurationValidateResponse, custom_configuration, path=["response"]) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) @parametrize def test_raw_response_validate(self, client: Gcore) -> None: @@ -41,7 +39,7 @@ def test_raw_response_validate(self, client: Gcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_configuration = response.parse() - assert_matches_type(CustomConfigurationValidateResponse, custom_configuration, path=["response"]) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) @parametrize def test_streaming_response_validate(self, client: Gcore) -> None: @@ -55,7 +53,7 @@ def test_streaming_response_validate(self, client: Gcore) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_configuration = response.parse() - assert_matches_type(CustomConfigurationValidateResponse, custom_configuration, path=["response"]) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) assert cast(Any, response.is_closed) is True @@ -73,7 +71,7 @@ async def test_method_validate(self, async_client: AsyncGcore) -> None: pg_conf="\nlisten_addresses = 'localhost'\nport = 5432\nmax_connections = 100\nshared_buffers = 128MB\nlogging_collector = on", version="15", ) - assert_matches_type(CustomConfigurationValidateResponse, custom_configuration, path=["response"]) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) @parametrize async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: @@ -87,7 +85,7 @@ async def test_raw_response_validate(self, async_client: AsyncGcore) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_configuration = await response.parse() - assert_matches_type(CustomConfigurationValidateResponse, custom_configuration, path=["response"]) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) @parametrize async def test_streaming_response_validate(self, async_client: AsyncGcore) -> None: @@ -101,6 +99,6 @@ async def test_streaming_response_validate(self, async_client: AsyncGcore) -> No assert response.http_request.headers.get("X-Stainless-Lang") == "python" custom_configuration = await response.parse() - assert_matches_type(CustomConfigurationValidateResponse, custom_configuration, path=["response"]) + assert_matches_type(PgConfValidation, custom_configuration, path=["response"]) assert cast(Any, response.is_closed) is True From 342223e952f6557975c3e502a1ef422a3ee30da0 Mon Sep 17 00:00:00 2001 From: Pedro Oliveira <8281907+pedrodeoliveira@users.noreply.github.com> Date: Mon, 27 Apr 2026 18:19:45 +0100 Subject: [PATCH 3/7] test(iam): unskip IMP-1903 tests and refine IMP-1904 skip reason Spec fix for IMP-1903 (PATCH /iam/users/{userId} no longer marks PUT-only fields as required) is now live, so the 6 update-related skips are removed. The IMP-1904 list-test skips are kept, but the reason is updated: the original "missing required fields" issue is fixed, but the tests still fail because PaginatedUsersArray.count is typed as `number` in the spec while SyncOffsetPage.count expects an integer. --- tests/api_resources/iam/test_users.py | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index 64dd08a5..f1367a76 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -22,7 +22,6 @@ class TestUsers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields") @parametrize def test_method_update(self, client: Gcore) -> None: user = client.iam.users.update( @@ -42,7 +41,6 @@ def test_method_update_with_all_params(self, client: Gcore) -> None: ) assert_matches_type(User, user, path=["response"]) - @pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields") @parametrize def test_raw_response_update(self, client: Gcore) -> None: response = client.iam.users.with_raw_response.update( @@ -54,7 +52,6 @@ def test_raw_response_update(self, client: Gcore) -> None: user = response.parse() assert_matches_type(User, user, path=["response"]) - @pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields") @parametrize def test_streaming_response_update(self, client: Gcore) -> None: with client.iam.users.with_streaming_response.update( @@ -68,13 +65,13 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_method_list(self, client: Gcore) -> None: user = client.iam.users.list() assert_matches_type(SyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: user = client.iam.users.list( @@ -83,7 +80,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: ) assert_matches_type(SyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.iam.users.with_raw_response.list() @@ -93,7 +90,7 @@ def test_raw_response_list(self, client: Gcore) -> None: user = response.parse() assert_matches_type(SyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.iam.users.with_streaming_response.list() as response: @@ -227,7 +224,6 @@ class TestAsyncUsers: "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] ) - @pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields") @parametrize async def test_method_update(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.update( @@ -247,7 +243,6 @@ async def test_method_update_with_all_params(self, async_client: AsyncGcore) -> ) assert_matches_type(User, user, path=["response"]) - @pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields") @parametrize async def test_raw_response_update(self, async_client: AsyncGcore) -> None: response = await async_client.iam.users.with_raw_response.update( @@ -259,7 +254,6 @@ async def test_raw_response_update(self, async_client: AsyncGcore) -> None: user = await response.parse() assert_matches_type(User, user, path=["response"]) - @pytest.mark.skip(reason="IMP-1903: OpenAPI spec PATCH requires PUT-only fields") @parametrize async def test_streaming_response_update(self, async_client: AsyncGcore) -> None: async with async_client.iam.users.with_streaming_response.update( @@ -273,13 +267,13 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.list() assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.list( @@ -288,7 +282,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No ) assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.iam.users.with_raw_response.list() @@ -298,7 +292,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: user = await response.parse() assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: OpenAPI spec missing required fields in response schema") + @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.iam.users.with_streaming_response.list() as response: From 48f6c89a1755f00ee53c9764273e937864c59666 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Apr 2026 22:30:50 +0000 Subject: [PATCH 4/7] feat: support setting headers via env --- src/gcore/_client.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/gcore/_client.py b/src/gcore/_client.py index ad06f5f0..de48ead3 100644 --- a/src/gcore/_client.py +++ b/src/gcore/_client.py @@ -19,7 +19,12 @@ RequestOptions, not_given, ) -from ._utils import is_given, get_async_library, maybe_coerce_integer +from ._utils import ( + is_given, + is_mapping_t, + get_async_library, + maybe_coerce_integer, +) from ._compat import cached_property from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream @@ -116,6 +121,15 @@ def __init__( if base_url is None: base_url = f"https://api.gcore.com" + custom_headers_env = os.environ.get("GCORE_CUSTOM_HEADERS") + if custom_headers_env is not None: + parsed: dict[str, str] = {} + for line in custom_headers_env.split("\n"): + colon = line.find(":") + if colon >= 0: + parsed[line[:colon].strip()] = line[colon + 1 :].strip() + default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})} + super().__init__( version=__version__, base_url=base_url, @@ -395,6 +409,15 @@ def __init__( if base_url is None: base_url = f"https://api.gcore.com" + custom_headers_env = os.environ.get("GCORE_CUSTOM_HEADERS") + if custom_headers_env is not None: + parsed: dict[str, str] = {} + for line in custom_headers_env.split("\n"): + colon = line.find(":") + if colon >= 0: + parsed[line[:colon].strip()] = line[colon + 1 :].strip() + default_headers = {**parsed, **(default_headers if is_mapping_t(default_headers) else {})} + super().__init__( version=__version__, base_url=base_url, From ea5b262e82b17da3ec0caa1a4c60939a629c00ab Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 09:01:00 +0000 Subject: [PATCH 5/7] codegen metadata --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index 7908113b..576f3232 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 657 openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gcore%2Fgcore-8c3bd3792724737d30da0f0200f0c589f9942ea3a028fcc9bcd56f3490ffc29a.yml -openapi_spec_hash: 7b184f4e52554b89cadf11b43f395583 +openapi_spec_hash: 426e01a73386f9de9841899806ddb3e3 config_hash: 22eb06625c071a1a8620647d9cc56df3 From 8dcda979017897baf9e14aaa32d659b4d6c4c760 Mon Sep 17 00:00:00 2001 From: Pedro Oliveira <8281907+pedrodeoliveira@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:06:43 +0100 Subject: [PATCH 6/7] test(iam): update the skip reason on the IAM user-list tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The skip reason on the user-list tests still pointed at IMP-1904, whose original "missing required fields" issue is resolved. The remaining blocker — PaginatedUsersArray.count being typed as `number` instead of `integer` — is now tracked in IMP-2027. --- tests/api_resources/iam/test_users.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/api_resources/iam/test_users.py b/tests/api_resources/iam/test_users.py index f1367a76..9e63f4b5 100644 --- a/tests/api_resources/iam/test_users.py +++ b/tests/api_resources/iam/test_users.py @@ -65,13 +65,13 @@ def test_streaming_response_update(self, client: Gcore) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_method_list(self, client: Gcore) -> None: user = client.iam.users.list() assert_matches_type(SyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_method_list_with_all_params(self, client: Gcore) -> None: user = client.iam.users.list( @@ -80,7 +80,7 @@ def test_method_list_with_all_params(self, client: Gcore) -> None: ) assert_matches_type(SyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_raw_response_list(self, client: Gcore) -> None: response = client.iam.users.with_raw_response.list() @@ -90,7 +90,7 @@ def test_raw_response_list(self, client: Gcore) -> None: user = response.parse() assert_matches_type(SyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize def test_streaming_response_list(self, client: Gcore) -> None: with client.iam.users.with_streaming_response.list() as response: @@ -267,13 +267,13 @@ async def test_streaming_response_update(self, async_client: AsyncGcore) -> None assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_method_list(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.list() assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> None: user = await async_client.iam.users.list( @@ -282,7 +282,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncGcore) -> No ) assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_raw_response_list(self, async_client: AsyncGcore) -> None: response = await async_client.iam.users.with_raw_response.list() @@ -292,7 +292,7 @@ async def test_raw_response_list(self, async_client: AsyncGcore) -> None: user = await response.parse() assert_matches_type(AsyncOffsetPage[User], user, path=["response"]) - @pytest.mark.skip(reason="IMP-1904: PaginatedUsersArray.count is type: number in spec, should be integer") + @pytest.mark.skip(reason="IMP-2027: PaginatedUsersArray.count is type: number in spec, should be integer") @parametrize async def test_streaming_response_list(self, async_client: AsyncGcore) -> None: async with async_client.iam.users.with_streaming_response.list() as response: From c71b65437bbe6f17332dbc725226f2f725513256 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 09:07:18 +0000 Subject: [PATCH 7/7] release: 0.45.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 18 ++++++++++++++++++ pyproject.toml | 2 +- src/gcore/_version.py | 2 +- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index cc51f6f8..fc0d7ff8 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.44.0" + ".": "0.45.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c917e1b..69e3868d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## 0.45.0 (2026-04-28) + +Full Changelog: [v0.44.0...v0.45.0](https://github.com/G-Core/gcore-python/compare/v0.44.0...v0.45.0) + +### ⚠ BREAKING CHANGES + +* **cloud:** correct pg conf validation response model name + +### Features + +* support setting headers via env ([48f6c89](https://github.com/G-Core/gcore-python/commit/48f6c89a1755f00ee53c9764273e937864c59666)) + + +### Bug Fixes + +* **cloud:** correct pg conf validation response model name ([c5bc635](https://github.com/G-Core/gcore-python/commit/c5bc635407def6e004bdb94a24e9045a1f8cf416)) +* use correct field name format for multipart file arrays ([5db7792](https://github.com/G-Core/gcore-python/commit/5db779213e0c088d2a615dccd43e0f7ca94bea1a)) + ## 0.44.0 (2026-04-27) Full Changelog: [v0.43.0...v0.44.0](https://github.com/G-Core/gcore-python/compare/v0.43.0...v0.44.0) diff --git a/pyproject.toml b/pyproject.toml index 92c24b56..9b2fe11c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gcore" -version = "0.44.0" +version = "0.45.0" description = "The official Python library for the gcore API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/gcore/_version.py b/src/gcore/_version.py index 43e6ba1d..a2c340f2 100644 --- a/src/gcore/_version.py +++ b/src/gcore/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gcore" -__version__ = "0.44.0" # x-release-please-version +__version__ = "0.45.0" # x-release-please-version