diff --git a/README.md b/README.md index f3d485c..a227e8a 100644 --- a/README.md +++ b/README.md @@ -36,22 +36,15 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed -from waylay.services.storage.models.tenant_status_report import TenantStatusReport try: - # Status - # calls `GET /storage/v1/status` - api_response = await waylay_client.storage.about.status( - # query parameters: - query = { - 'include_buckets': True - 'include_queues': True - 'include_disk_usage': False - }, + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( ) - print("The response of storage.about.status:\n") + print("The response of storage.about.version:\n") pprint(api_response) except ApiError as e: - print("Exception when calling storage.about.status: %s\n" % e) + print("Exception when calling storage.about.version: %s\n" % e) ``` @@ -63,8 +56,8 @@ All URIs are relative to *https://api.waylay.io* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AboutApi* | [**get**](docs/AboutApi.md#get) | **GET** /storage/v1/ | Version *AboutApi* | [**status**](docs/AboutApi.md#status) | **GET** /storage/v1/status | Status +*AboutApi* | [**version**](docs/AboutApi.md#version) | **GET** /storage/v1/ | Version *BucketApi* | [**get**](docs/BucketApi.md#get) | **GET** /storage/v1/bucket/{bucket_name} | Get Bucket *BucketApi* | [**list**](docs/BucketApi.md#list) | **GET** /storage/v1/bucket | List Buckets *ObjectApi* | [**copy_or_move**](docs/ObjectApi.md#copy_or_move) | **PUT** /storage/v1/bucket/{bucket_name}/{target_path} | Copy Or Move Object diff --git a/docs/AboutApi.md b/docs/AboutApi.md index cff65fb..24d64f2 100644 --- a/docs/AboutApi.md +++ b/docs/AboutApi.md @@ -4,17 +4,18 @@ All URIs are relative to *https://api.waylay.io* Method | HTTP request | Description ------------- | ------------- | ------------- -[**get**](AboutApi.md#get) | **GET** /storage/v1/ | Version [**status**](AboutApi.md#status) | **GET** /storage/v1/status | Status +[**version**](AboutApi.md#version) | **GET** /storage/v1/ | Version -# **get** -> get( +# **status** +> status( +> query: StatusQuery, > headers -> ) -> str +> ) -> TenantStatusReport -Version +Status -Get the application version. +Validate consistency of buckets and notification queues for this tenant. ### Example @@ -29,31 +30,44 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed +from waylay.services.storage.models.tenant_status_report import TenantStatusReport try: - # Version - # calls `GET /storage/v1/` - api_response = await waylay_client.storage.about.get( + # Status + # calls `GET /storage/v1/status` + api_response = await waylay_client.storage.about.status( + # query parameters: + query = { + 'include_buckets': True + 'include_queues': True + 'include_disk_usage': False + }, ) - print("The response of storage.about.get:\n") + print("The response of storage.about.status:\n") pprint(api_response) except ApiError as e: - print("Exception when calling storage.about.get: %s\n" % e) + print("Exception when calling storage.about.status: %s\n" % e) ``` ### Endpoint ``` -GET /storage/v1/ +GET /storage/v1/status ``` ### Parameters -This endpoint does not need any parameter. +Name | Type | API binding | Description | Notes +-------- | ----- | ------------- | ------------- | ------------- +**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | +**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] +**query['include_buckets']** (dict)
**query.include_buckets** (Query) | **bool** | query parameter `"include_buckets"` | | [optional] [default True] +**query['include_queues']** (dict)
**query.include_queues** (Query) | **bool** | query parameter `"include_queues"` | | [optional] [default True] +**query['include_disk_usage']** (dict)
**query.include_disk_usage** (Query) | **bool** | query parameter `"include_disk_usage"` | | [optional] [default False] **headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | ### Return type Selected path param | Raw response param | Return Type | Description | Links ------------------- | ------------------ | ------------ | ----------- | ----- -Literal[""] _(default)_ | False _(default)_ | **`str`** | | +Literal[""] _(default)_ | False _(default)_ | **`TenantStatusReport`** | | [TenantStatusReport](TenantStatusReport.md) str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | / | True | `Response` | The raw http response object. @@ -67,18 +81,18 @@ str | False _(default)_ | **`Any`** | If any other string value for the selected | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful Response | - | +**422** | Validation Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **status** -> status( -> query: StatusQuery, +# **version** +> version( > headers -> ) -> TenantStatusReport +> ) -> str -Status +Version -Validate consistency of buckets and notification queues for this tenant. +Get the application version. ### Example @@ -93,44 +107,31 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed -from waylay.services.storage.models.tenant_status_report import TenantStatusReport try: - # Status - # calls `GET /storage/v1/status` - api_response = await waylay_client.storage.about.status( - # query parameters: - query = { - 'include_buckets': True - 'include_queues': True - 'include_disk_usage': False - }, + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( ) - print("The response of storage.about.status:\n") + print("The response of storage.about.version:\n") pprint(api_response) except ApiError as e: - print("Exception when calling storage.about.status: %s\n" % e) + print("Exception when calling storage.about.version: %s\n" % e) ``` ### Endpoint ``` -GET /storage/v1/status +GET /storage/v1/ ``` ### Parameters -Name | Type | API binding | Description | Notes --------- | ----- | ------------- | ------------- | ------------- -**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | | -**query['store']** (dict)
**query.store** (Query) | **str** | query parameter `"store"` | | [optional] -**query['include_buckets']** (dict)
**query.include_buckets** (Query) | **bool** | query parameter `"include_buckets"` | | [optional] [default True] -**query['include_queues']** (dict)
**query.include_queues** (Query) | **bool** | query parameter `"include_queues"` | | [optional] [default True] -**query['include_disk_usage']** (dict)
**query.include_disk_usage** (Query) | **bool** | query parameter `"include_disk_usage"` | | [optional] [default False] +This endpoint does not need any parameter. **headers** | [HeaderTypes](Operation.md#req_headers) | request headers | | ### Return type Selected path param | Raw response param | Return Type | Description | Links ------------------- | ------------------ | ------------ | ----------- | ----- -Literal[""] _(default)_ | False _(default)_ | **`TenantStatusReport`** | | [TenantStatusReport](TenantStatusReport.md) +Literal[""] _(default)_ | False _(default)_ | **`str`** | | str | False _(default)_ | **`Any`** | If any other string value for the selected path is provided, the exact type of the response will only be known at runtime. | / | True | `Response` | The raw http response object. @@ -144,7 +145,6 @@ str | False _(default)_ | **`Any`** | If any other string value for the selected | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | Successful Response | - | -**422** | Validation Error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/docs/Operation.md b/docs/Operation.md index 1139f3b..a9d5281 100644 --- a/docs/Operation.md +++ b/docs/Operation.md @@ -34,6 +34,8 @@ response = await waylay_client.demo.gadgets.combatulate_trinket( raw_response=False, select_path=None, response_type=None, + # optional flag to disable the validation of the request arguments when using typed requests + validate_request=True, # optional named arguments passed to the http client (named) timeout=10.0, ) diff --git a/openapi/storage.openapi.yaml b/openapi/storage.openapi.yaml index bafb88d..9914d53 100644 --- a/openapi/storage.openapi.yaml +++ b/openapi/storage.openapi.yaml @@ -764,7 +764,7 @@ paths: - About summary: Version description: Get the application version. - operationId: get_about + operationId: version_about responses: '200': description: Successful Response @@ -772,7 +772,7 @@ paths: application/json: schema: type: string - title: Response Get + title: Response Version security: *id001 /storage/v1/status: get: diff --git a/openapi/storage.transformed.openapi.yaml b/openapi/storage.transformed.openapi.yaml index 69f918b..0c2db2b 100644 --- a/openapi/storage.transformed.openapi.yaml +++ b/openapi/storage.transformed.openapi.yaml @@ -920,7 +920,7 @@ paths: - About summary: Version description: Get the application version. - operationId: get_about + operationId: version_about responses: '200': description: Successful Response @@ -928,10 +928,10 @@ paths: application/json: schema: type: string - title: Response Get + title: Response Version security: - waylayApiKeySecret: [] - x-py-method: get + x-py-method: version x-consumes-multipart: false x-consumes-urlencoded: false x-consumes-json: false diff --git a/requirements.txt b/requirements.txt index 5a42ff4..c98d1d4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ pydantic ~= 2.6 typing-extensions ~= 4.9 -waylay-sdk-core ~= 0.2.0 +waylay-sdk-core ~= 0.2.1 diff --git a/test/api/about_api_test.py b/test/api/about_api_test.py index 7276cc9..ad73a8a 100644 --- a/test/api/about_api_test.py +++ b/test/api/about_api_test.py @@ -46,45 +46,6 @@ def test_registered(waylay_client: WaylayClient): assert isinstance(waylay_client.storage.about, AboutApi) -def _get_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): - mock_response = "''" - httpx_mock_kwargs = { - "method": "GET", - "url": re.compile(f"^{gateway_url}/storage/v1/(\\?.*)?"), - "content": json.dumps(mock_response, default=str), - "status_code": 200, - } - httpx_mock.add_response(**httpx_mock_kwargs) - - -@pytest.mark.asyncio -@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") -async def test_get(service: StorageService, gateway_url: str, httpx_mock: HTTPXMock): - """Test case for get - Version - """ - # set path params - kwargs = {} - _get_set_mock_response(httpx_mock, gateway_url) - resp = await service.about.get(**kwargs) - check_type(resp, Union[str,]) - - -@pytest.mark.asyncio -@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") -async def test_get_without_types( - service: StorageService, gateway_url: str, httpx_mock: HTTPXMock -): - """Test case for get with models not installed - Version - """ - # set path params - kwargs = {} - _get_set_mock_response(httpx_mock, gateway_url) - resp = await service.about.get(**kwargs) - check_type(resp, Model) - - def _status_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): mock_response = TenantStatusReportStub.create_json() httpx_mock_kwargs = { @@ -137,3 +98,44 @@ async def test_status_without_types( _status_set_mock_response(httpx_mock, gateway_url) resp = await service.about.status(**kwargs) check_type(resp, Model) + + +def _version_set_mock_response(httpx_mock: HTTPXMock, gateway_url: str): + mock_response = "''" + httpx_mock_kwargs = { + "method": "GET", + "url": re.compile(f"^{gateway_url}/storage/v1/(\\?.*)?"), + "content": json.dumps(mock_response, default=str), + "status_code": 200, + } + httpx_mock.add_response(**httpx_mock_kwargs) + + +@pytest.mark.asyncio +@pytest.mark.skipif(not MODELS_AVAILABLE, reason="Types not installed.") +async def test_version( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for version + Version + """ + # set path params + kwargs = {} + _version_set_mock_response(httpx_mock, gateway_url) + resp = await service.about.version(**kwargs) + check_type(resp, Union[str,]) + + +@pytest.mark.asyncio +@pytest.mark.skipif(MODELS_AVAILABLE, reason="Types installed.") +async def test_version_without_types( + service: StorageService, gateway_url: str, httpx_mock: HTTPXMock +): + """Test case for version with models not installed + Version + """ + # set path params + kwargs = {} + _version_set_mock_response(httpx_mock, gateway_url) + resp = await service.about.version(**kwargs) + check_type(resp, Model) diff --git a/test/conftest.py b/test/conftest.py index 4f5f39a..dd06552 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -1,5 +1,7 @@ """Automatic pytest fixtures.""" +import random + import httpx import pytest import starlette.requests as req @@ -8,6 +10,7 @@ from waylay.sdk.auth import NoCredentials from waylay.services.storage.service import StorageService +random.seed(10) GATEWAY_URL = "http://example.io" diff --git a/test/types/auth_stub.py b/test/types/auth_stub.py index b35f7b6..273637b 100644 --- a/test/types/auth_stub.py +++ b/test/types/auth_stub.py @@ -43,11 +43,16 @@ class AUTHStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return auth_faker.generate() + return auth_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "AUTH": """Create AUTH stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return AUTHAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(AUTHAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return AUTHAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/authentication_config_stub.py b/test/types/authentication_config_stub.py index 088fb9b..9b4c416 100644 --- a/test/types/authentication_config_stub.py +++ b/test/types/authentication_config_stub.py @@ -62,11 +62,22 @@ class AuthenticationConfigStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return authentication_config_faker.generate() + return authentication_config_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "AuthenticationConfig": """Create AuthenticationConfig stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return AuthenticationConfigAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + AuthenticationConfigAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return AuthenticationConfigAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/bucket_configuration_stub.py b/test/types/bucket_configuration_stub.py index ab874af..c608740 100644 --- a/test/types/bucket_configuration_stub.py +++ b/test/types/bucket_configuration_stub.py @@ -92,11 +92,20 @@ class BucketConfigurationStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_configuration_faker.generate() + return bucket_configuration_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "BucketConfiguration": """Create BucketConfiguration stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BucketConfigurationAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + BucketConfigurationAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BucketConfigurationAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/bucket_listing_stub.py b/test/types/bucket_listing_stub.py index d64c35a..ec0c8b3 100644 --- a/test/types/bucket_listing_stub.py +++ b/test/types/bucket_listing_stub.py @@ -59,11 +59,20 @@ class BucketListingStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_listing_faker.generate() + return bucket_listing_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "BucketListing": """Create BucketListing stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BucketListingAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + BucketListingAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BucketListingAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/bucket_object_listing_stub.py b/test/types/bucket_object_listing_stub.py index 3563f3f..d80696f 100644 --- a/test/types/bucket_object_listing_stub.py +++ b/test/types/bucket_object_listing_stub.py @@ -61,11 +61,22 @@ class BucketObjectListingStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_object_listing_faker.generate() + return bucket_object_listing_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "BucketObjectListing": """Create BucketObjectListing stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BucketObjectListingAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + BucketObjectListingAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BucketObjectListingAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/bucket_object_stub.py b/test/types/bucket_object_stub.py index 7f32f01..2443827 100644 --- a/test/types/bucket_object_stub.py +++ b/test/types/bucket_object_stub.py @@ -93,11 +93,20 @@ class BucketObjectStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_object_faker.generate() + return bucket_object_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "BucketObject": """Create BucketObject stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BucketObjectAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + BucketObjectAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BucketObjectAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/bucket_stub.py b/test/types/bucket_stub.py index d284f5a..0271571 100644 --- a/test/types/bucket_stub.py +++ b/test/types/bucket_stub.py @@ -72,11 +72,16 @@ class BucketStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_faker.generate() + return bucket_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "Bucket": """Create Bucket stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BucketAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(BucketAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BucketAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/bucketcreationstatus_stub.py b/test/types/bucketcreationstatus_stub.py index d0e74d2..3083ea7 100644 --- a/test/types/bucketcreationstatus_stub.py +++ b/test/types/bucketcreationstatus_stub.py @@ -45,11 +45,22 @@ class BUCKETCREATIONSTATUSStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_creation_status_faker.generate() + return bucket_creation_status_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "BUCKETCREATIONSTATUS": """Create BUCKETCREATIONSTATUS stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BUCKETCREATIONSTATUSAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + BUCKETCREATIONSTATUSAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BUCKETCREATIONSTATUSAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/bucketpolicystatus_stub.py b/test/types/bucketpolicystatus_stub.py index ddf78d5..cdb82a1 100644 --- a/test/types/bucketpolicystatus_stub.py +++ b/test/types/bucketpolicystatus_stub.py @@ -45,11 +45,20 @@ class BUCKETPOLICYSTATUSStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return bucket_policy_status_faker.generate() + return bucket_policy_status_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "BUCKETPOLICYSTATUS": """Create BUCKETPOLICYSTATUS stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return BUCKETPOLICYSTATUSAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + BUCKETPOLICYSTATUSAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return BUCKETPOLICYSTATUSAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/channel_stub.py b/test/types/channel_stub.py index e832079..4964e2b 100644 --- a/test/types/channel_stub.py +++ b/test/types/channel_stub.py @@ -46,11 +46,16 @@ class ChannelStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return channel_faker.generate() + return channel_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "Channel": """Create Channel stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return ChannelAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(ChannelAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return ChannelAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/channeltype_stub.py b/test/types/channeltype_stub.py index b4a063d..21b70a6 100644 --- a/test/types/channeltype_stub.py +++ b/test/types/channeltype_stub.py @@ -43,11 +43,18 @@ class CHANNELTYPEStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return channel_type_faker.generate() + return channel_type_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "CHANNELTYPE": """Create CHANNELTYPE stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return CHANNELTYPEAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(CHANNELTYPEAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return CHANNELTYPEAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/event_filter_stub.py b/test/types/event_filter_stub.py index 0c65910..0fcd62b 100644 --- a/test/types/event_filter_stub.py +++ b/test/types/event_filter_stub.py @@ -68,11 +68,18 @@ class EventFilterStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return event_filter_faker.generate() + return event_filter_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "EventFilter": """Create EventFilter stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return EventFilterAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(EventFilterAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return EventFilterAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/expiry_stub.py b/test/types/expiry_stub.py index 085b727..790ad0d 100644 --- a/test/types/expiry_stub.py +++ b/test/types/expiry_stub.py @@ -56,11 +56,16 @@ class ExpiryStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return expiry_faker.generate() + return expiry_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "Expiry": """Create Expiry stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return ExpiryAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(ExpiryAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return ExpiryAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/hal_entity_stub.py b/test/types/hal_entity_stub.py index ed0d2a7..3b16bfe 100644 --- a/test/types/hal_entity_stub.py +++ b/test/types/hal_entity_stub.py @@ -51,11 +51,16 @@ class HALEntityStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return hal_entity_faker.generate() + return hal_entity_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "HALEntity": """Create HALEntity stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return HALEntityAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(HALEntityAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return HALEntityAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/hal_link_stub.py b/test/types/hal_link_stub.py index 2e03e7f..f9c5621 100644 --- a/test/types/hal_link_stub.py +++ b/test/types/hal_link_stub.py @@ -57,11 +57,16 @@ class HALLinkStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return hal_link_faker.generate() + return hal_link_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "HALLink": """Create HALLink stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return HALLinkAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(HALLinkAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return HALLinkAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/http_validation_error_stub.py b/test/types/http_validation_error_stub.py index 473a488..175888e 100644 --- a/test/types/http_validation_error_stub.py +++ b/test/types/http_validation_error_stub.py @@ -52,11 +52,22 @@ class HTTPValidationErrorStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return http_validation_error_faker.generate() + return http_validation_error_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "HTTPValidationError": """Create HTTPValidationError stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return HTTPValidationErrorAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + HTTPValidationErrorAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return HTTPValidationErrorAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/httpmethod_stub.py b/test/types/httpmethod_stub.py index b710e35..2e4041d 100644 --- a/test/types/httpmethod_stub.py +++ b/test/types/httpmethod_stub.py @@ -43,11 +43,18 @@ class HTTPMETHODStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return http_method_faker.generate() + return http_method_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "HTTPMETHOD": """Create HTTPMETHOD stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return HTTPMETHODAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(HTTPMETHODAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return HTTPMETHODAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/links_stub.py b/test/types/links_stub.py index 9762dd0..5552aad 100644 --- a/test/types/links_stub.py +++ b/test/types/links_stub.py @@ -49,11 +49,16 @@ class LinksStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return links_faker.generate() + return links_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "Links": """Create Links stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return LinksAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(LinksAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return LinksAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/location_inner_stub.py b/test/types/location_inner_stub.py index c44a418..2f1710d 100644 --- a/test/types/location_inner_stub.py +++ b/test/types/location_inner_stub.py @@ -46,11 +46,20 @@ class LocationInnerStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return location_inner_faker.generate() + return location_inner_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "LocationInner": """Create LocationInner stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return LocationInnerAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + LocationInnerAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return LocationInnerAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/notification_queue_status_report_stub.py b/test/types/notification_queue_status_report_stub.py index c8c8fb6..ea3b15f 100644 --- a/test/types/notification_queue_status_report_stub.py +++ b/test/types/notification_queue_status_report_stub.py @@ -67,11 +67,23 @@ class NotificationQueueStatusReportStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return notification_queue_status_report_faker.generate() + return notification_queue_status_report_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "NotificationQueueStatusReport": """Create NotificationQueueStatusReport stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return NotificationQueueStatusReportAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + NotificationQueueStatusReportAdapter.json_schema(), + allow_none_optionals=1, + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return NotificationQueueStatusReportAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/notification_queue_status_stub.py b/test/types/notification_queue_status_stub.py index 205b64f..276c01c 100644 --- a/test/types/notification_queue_status_stub.py +++ b/test/types/notification_queue_status_stub.py @@ -72,11 +72,22 @@ class NotificationQueueStatusStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return notification_queue_status_faker.generate() + return notification_queue_status_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "NotificationQueueStatus": """Create NotificationQueueStatus stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return NotificationQueueStatusAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + NotificationQueueStatusAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return NotificationQueueStatusAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/payload_config_stub.py b/test/types/payload_config_stub.py index 3f8188d..1ed7201 100644 --- a/test/types/payload_config_stub.py +++ b/test/types/payload_config_stub.py @@ -53,11 +53,20 @@ class PayloadConfigStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return payload_config_faker.generate() + return payload_config_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "PayloadConfig": """Create PayloadConfig stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return PayloadConfigAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + PayloadConfigAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return PayloadConfigAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/queuesetupstatus_stub.py b/test/types/queuesetupstatus_stub.py index e8c58d6..9c4e76d 100644 --- a/test/types/queuesetupstatus_stub.py +++ b/test/types/queuesetupstatus_stub.py @@ -44,11 +44,20 @@ class QUEUESETUPSTATUSStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return queue_setup_status_faker.generate() + return queue_setup_status_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "QUEUESETUPSTATUS": """Create QUEUESETUPSTATUS stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return QUEUESETUPSTATUSAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + QUEUESETUPSTATUSAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return QUEUESETUPSTATUSAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/response_list_stub.py b/test/types/response_list_stub.py index bd4b08a..6a019e0 100644 --- a/test/types/response_list_stub.py +++ b/test/types/response_list_stub.py @@ -48,11 +48,20 @@ class ResponseListStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return response_list_faker.generate() + return response_list_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "ResponseList": """Create ResponseList stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return ResponseListAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + ResponseListAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return ResponseListAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/sign_stub.py b/test/types/sign_stub.py index 8ddb353..a51d145 100644 --- a/test/types/sign_stub.py +++ b/test/types/sign_stub.py @@ -44,11 +44,16 @@ class SIGNStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return sign_faker.generate() + return sign_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "SIGN": """Create SIGN stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return SIGNAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(SIGNAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return SIGNAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/store_stub.py b/test/types/store_stub.py index c8f15c1..ca78968 100644 --- a/test/types/store_stub.py +++ b/test/types/store_stub.py @@ -64,11 +64,16 @@ class StoreStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return store_faker.generate() + return store_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "Store": """Create Store stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return StoreAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(StoreAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return StoreAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/storetype_stub.py b/test/types/storetype_stub.py index 8beb34c..4d21fc2 100644 --- a/test/types/storetype_stub.py +++ b/test/types/storetype_stub.py @@ -44,11 +44,16 @@ class STORETYPEStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return store_type_faker.generate() + return store_type_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "STORETYPE": """Create STORETYPE stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return STORETYPEAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(STORETYPEAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return STORETYPEAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/subscription_config_stub.py b/test/types/subscription_config_stub.py index 62f58a8..271ac13 100644 --- a/test/types/subscription_config_stub.py +++ b/test/types/subscription_config_stub.py @@ -76,11 +76,20 @@ class SubscriptionConfigStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return subscription_config_faker.generate() + return subscription_config_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "SubscriptionConfig": """Create SubscriptionConfig stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return SubscriptionConfigAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + SubscriptionConfigAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return SubscriptionConfigAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/subscriptions_listing_stub.py b/test/types/subscriptions_listing_stub.py index 0dc89bb..9c4eeae 100644 --- a/test/types/subscriptions_listing_stub.py +++ b/test/types/subscriptions_listing_stub.py @@ -63,11 +63,22 @@ class SubscriptionsListingStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return subscriptions_listing_faker.generate() + return subscriptions_listing_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "SubscriptionsListing": """Create SubscriptionsListing stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return SubscriptionsListingAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + SubscriptionsListingAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return SubscriptionsListingAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/subscriptions_stub.py b/test/types/subscriptions_stub.py index 6af15c9..25d5e39 100644 --- a/test/types/subscriptions_stub.py +++ b/test/types/subscriptions_stub.py @@ -69,11 +69,20 @@ class SubscriptionsStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return subscriptions_faker.generate() + return subscriptions_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "Subscriptions": """Create Subscriptions stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return SubscriptionsAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + SubscriptionsAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return SubscriptionsAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/system_channel_config_stub.py b/test/types/system_channel_config_stub.py index 4024ca8..f7abba8 100644 --- a/test/types/system_channel_config_stub.py +++ b/test/types/system_channel_config_stub.py @@ -62,11 +62,22 @@ class SystemChannelConfigStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return system_channel_config_faker.generate() + return system_channel_config_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "SystemChannelConfig": """Create SystemChannelConfig stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return SystemChannelConfigAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + SystemChannelConfigAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return SystemChannelConfigAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/system_channel_config_type_stub.py b/test/types/system_channel_config_type_stub.py index 6daf217..fc33d24 100644 --- a/test/types/system_channel_config_type_stub.py +++ b/test/types/system_channel_config_type_stub.py @@ -48,11 +48,22 @@ class SystemChannelConfigTypeStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return system_channel_config_type_faker.generate() + return system_channel_config_type_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "SystemChannelConfigType": """Create SystemChannelConfigType stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return SystemChannelConfigTypeAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + SystemChannelConfigTypeAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return SystemChannelConfigTypeAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/tenant_status_report_stub.py b/test/types/tenant_status_report_stub.py index 3ebea4a..0a2483a 100644 --- a/test/types/tenant_status_report_stub.py +++ b/test/types/tenant_status_report_stub.py @@ -78,11 +78,20 @@ class TenantStatusReportStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return tenant_status_report_faker.generate() + return tenant_status_report_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "TenantStatusReport": """Create TenantStatusReport stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return TenantStatusReportAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + TenantStatusReportAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return TenantStatusReportAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/validation_error_stub.py b/test/types/validation_error_stub.py index 673a671..a93dc57 100644 --- a/test/types/validation_error_stub.py +++ b/test/types/validation_error_stub.py @@ -60,11 +60,20 @@ class ValidationErrorStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return validation_error_faker.generate() + return validation_error_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "ValidationError": """Create ValidationError stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return ValidationErrorAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + ValidationErrorAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return ValidationErrorAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/venttype_stub.py b/test/types/venttype_stub.py index 2ff36ac..bb62729 100644 --- a/test/types/venttype_stub.py +++ b/test/types/venttype_stub.py @@ -43,11 +43,16 @@ class VENTTYPEStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return vent_type_faker.generate() + return vent_type_faker.generate(use_defaults=True, use_examples=True) @classmethod def create_instance(cls) -> "VENTTYPE": """Create VENTTYPE stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return VENTTYPEAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF(VENTTYPEAdapter.json_schema(), allow_none_optionals=1) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return VENTTYPEAdapter.validate_python(json, context={"skip_validation": True}) diff --git a/test/types/web_script_channel_config_stub.py b/test/types/web_script_channel_config_stub.py index d299368..3fc8c42 100644 --- a/test/types/web_script_channel_config_stub.py +++ b/test/types/web_script_channel_config_stub.py @@ -79,11 +79,22 @@ class WebScriptChannelConfigStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return web_script_channel_config_faker.generate() + return web_script_channel_config_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "WebScriptChannelConfig": """Create WebScriptChannelConfig stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return WebScriptChannelConfigAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + WebScriptChannelConfigAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return WebScriptChannelConfigAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/test/types/web_script_channel_config_type_stub.py b/test/types/web_script_channel_config_type_stub.py index eb7e40e..1974d68 100644 --- a/test/types/web_script_channel_config_type_stub.py +++ b/test/types/web_script_channel_config_type_stub.py @@ -48,11 +48,22 @@ class WebScriptChannelConfigTypeStub: @classmethod def create_json(cls): """Create a dict stub instance.""" - return web_script_channel_config_type_faker.generate() + return web_script_channel_config_type_faker.generate( + use_defaults=True, use_examples=True + ) @classmethod def create_instance(cls) -> "WebScriptChannelConfigType": """Create WebScriptChannelConfigType stub instance.""" if not MODELS_AVAILABLE: raise ImportError("Models must be installed to create class stubs") - return WebScriptChannelConfigTypeAdapter.validate_python(cls.create_json()) + json = cls.create_json() + if not json: + # use backup example based on the pydantic model schema + backup_faker = JSF( + WebScriptChannelConfigTypeAdapter.json_schema(), allow_none_optionals=1 + ) + json = backup_faker.generate(use_defaults=True, use_examples=True) + return WebScriptChannelConfigTypeAdapter.validate_python( + json, context={"skip_validation": True} + ) diff --git a/waylay-sdk-storage-types/README.md b/waylay-sdk-storage-types/README.md index 39c3299..b7df080 100644 --- a/waylay-sdk-storage-types/README.md +++ b/waylay-sdk-storage-types/README.md @@ -34,22 +34,15 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed -from waylay.services.storage.models.tenant_status_report import TenantStatusReport try: - # Status - # calls `GET /storage/v1/status` - api_response = await waylay_client.storage.about.status( - # query parameters: - query = { - 'include_buckets': True - 'include_queues': True - 'include_disk_usage': False - }, + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( ) - print("The response of storage.about.status:\n") + print("The response of storage.about.version:\n") pprint(api_response) except ApiError as e: - print("Exception when calling storage.about.status: %s\n" % e) + print("Exception when calling storage.about.version: %s\n" % e) ``` diff --git a/waylay-sdk-storage-types/pyproject.toml b/waylay-sdk-storage-types/pyproject.toml index 3d6cf2e..8e37004 100644 --- a/waylay-sdk-storage-types/pyproject.toml +++ b/waylay-sdk-storage-types/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "waylay-sdk-storage-types" -version = "0.4.1.20240415" +version = "0.4.1.20240423" description = "Waylay Storage Types " authors = [ { name = "Waylay", email = "info@waylay.io"} @@ -12,8 +12,8 @@ authors = [ keywords = ["Waylay Storage" , "Types"] requires-python = ">= 3.9" dependencies = [ - "waylay-sdk-core ~= 0.2.0", - "waylay-sdk-storage == 0.4.1.20240415", + "waylay-sdk-core ~= 0.2.1", + "waylay-sdk-storage == 0.4.1.20240423", "pydantic ~= 2.6", "typing-extensions ~= 4.10", "eval-type-backport ~= 0.1.3; python_version < '3.10'", diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py index eaf957e..4b04ae0 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/__init__.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -__version__ = "0.4.1.20240415" +__version__ = "0.4.1.20240423" # import models into model package from .auth import AUTH diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py index 52386f0..684374a 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/authentication_config.py @@ -28,8 +28,5 @@ class AuthenticationConfig(WaylayBaseModel): secret: StrictStr | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py index 36a3e9c..ba5975f 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket.py @@ -37,8 +37,5 @@ class Bucket(WaylayBaseModel): size: StrictInt | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py index c246146..8b0e9dd 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_configuration.py @@ -42,8 +42,5 @@ class BucketConfiguration(WaylayBaseModel): error: StrictStr | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py index c10c953..802c531 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_listing.py @@ -30,8 +30,5 @@ class BucketListing(WaylayBaseModel): buckets: List[Bucket] model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py index 3ba277b..b1ea60e 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object.py @@ -43,8 +43,5 @@ class BucketObject(WaylayBaseModel): owner_name: StrictStr | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py index 8347111..e2afb48 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/bucket_object_listing.py @@ -30,8 +30,5 @@ class BucketObjectListing(WaylayBaseModel): objects: List[BucketObject] model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py index e644d7c..7d84e79 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/event_filter.py @@ -32,8 +32,5 @@ class EventFilter(WaylayBaseModel): queue: StrictStr | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py index 2cd0b8f..f5d66d6 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/expiry.py @@ -26,8 +26,5 @@ class Expiry(WaylayBaseModel): days: StrictInt | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py index e6bc22a..bddf455 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_entity.py @@ -28,8 +28,5 @@ class HALEntity(WaylayBaseModel): links: Dict[str, Links] | None = Field(default=None, alias="_links") model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py index 49520e7..58ce182 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/hal_link.py @@ -28,8 +28,5 @@ class HALLink(WaylayBaseModel): form_data: Dict[str, Any] | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py index 626469d..a655c8f 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/http_validation_error.py @@ -27,8 +27,5 @@ class HTTPValidationError(WaylayBaseModel): detail: List[ValidationError] | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py index 41b0568..6a883a5 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status.py @@ -33,8 +33,5 @@ class NotificationQueueStatus(WaylayBaseModel): error: StrictStr | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py index 1e0cc4b..9fb681b 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/notification_queue_status_report.py @@ -30,8 +30,5 @@ class NotificationQueueStatusReport(WaylayBaseModel): messages: List[Dict[str, Any]] | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py index 623650d..5eb3992 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/payload_config.py @@ -28,8 +28,5 @@ class PayloadConfig(WaylayBaseModel): reference: Any | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py index 843d931..fe3bc8c 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/store.py @@ -33,8 +33,5 @@ class Store(WaylayBaseModel): url: StrictStr model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py index 1c7af59..29fdf5d 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscription_config.py @@ -36,8 +36,5 @@ class SubscriptionConfig(WaylayBaseModel): filters: List[EventFilter] model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py index b13312f..2a0eb3c 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions.py @@ -33,8 +33,5 @@ class Subscriptions(WaylayBaseModel): warnings: List[Dict[str, Any]] | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py index 5c4e26e..9321093 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/subscriptions_listing.py @@ -30,8 +30,5 @@ class SubscriptionsListing(WaylayBaseModel): buckets: List[Bucket] model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py index 6356916..b809abd 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/system_channel_config.py @@ -33,8 +33,5 @@ class SystemChannelConfig(WaylayBaseModel): expiry: Expiry | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py index 0740dfb..3b0486b 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/tenant_status_report.py @@ -39,8 +39,5 @@ class TenantStatusReport(WaylayBaseModel): queue_status: QUEUESETUPSTATUS | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py index 1c27c20..60db3f3 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/validation_error.py @@ -30,8 +30,5 @@ class ValidationError(WaylayBaseModel): type: StrictStr model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py b/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py index ff57748..9fb5213 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/models/web_script_channel_config.py @@ -37,8 +37,5 @@ class WebScriptChannelConfig(WaylayBaseModel): method: HTTPMETHOD | None = None model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - extra="ignore", + populate_by_name=True, protected_namespaces=(), extra="ignore" ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py index b9bbf3e..ed08300 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/about_api.py @@ -18,22 +18,6 @@ from waylay.sdk.api._models import BaseModel as WaylayBaseModel -def _get_query_alias_for(field_name: str) -> str: - return field_name - - -class GetQuery(WaylayBaseModel): - """Model for `get` query parameters.""" - - model_config = ConfigDict( - validate_assignment=True, - protected_namespaces=(), - extra="allow", - alias_generator=_get_query_alias_for, - populate_by_name=True, - ) - - def _status_query_alias_for(field_name: str) -> str: if field_name == "store": return "store" @@ -55,9 +39,23 @@ class StatusQuery(WaylayBaseModel): include_disk_usage: StrictBool | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_status_query_alias_for, populate_by_name=True, ) + + +def _version_query_alias_for(field_name: str) -> str: + return field_name + + +class VersionQuery(WaylayBaseModel): + """Model for `version` query parameters.""" + + model_config = ConfigDict( + protected_namespaces=(), + extra="allow", + alias_generator=_version_query_alias_for, + populate_by_name=True, + ) diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py index 7aaee45..1324ca8 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/bucket_api.py @@ -29,7 +29,6 @@ class GetQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_get_query_alias_for, @@ -49,7 +48,6 @@ class ListQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_list_query_alias_for, diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py index de83c42..fa7eb76 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/object_api.py @@ -37,7 +37,6 @@ class CopyOrMoveQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_copy_or_move_query_alias_for, @@ -60,7 +59,6 @@ class CreateFolderQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_create_folder_query_alias_for, @@ -122,7 +120,6 @@ class ListQuery(WaylayBaseModel): content_type: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_list_query_alias_for, @@ -154,7 +151,6 @@ class RemoveQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_remove_query_alias_for, diff --git a/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py b/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py index 51406be..dbba54a 100644 --- a/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py +++ b/waylay-sdk-storage-types/src/waylay/services/storage/queries/subscription_api.py @@ -33,7 +33,6 @@ class CreateQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_create_query_alias_for, @@ -74,7 +73,6 @@ class DeleteByQuery(WaylayBaseModel): max_keys: StrictInt | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_delete_by_query_alias_for, @@ -94,7 +92,6 @@ class GetQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_get_query_alias_for, @@ -132,7 +129,6 @@ class ListQuery(WaylayBaseModel): max_keys: StrictInt | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_list_query_alias_for, @@ -173,7 +169,6 @@ class QueryQuery(WaylayBaseModel): max_keys: StrictInt | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_query_query_alias_for, @@ -193,7 +188,6 @@ class RemoveQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_remove_query_alias_for, @@ -213,7 +207,6 @@ class ReplaceQuery(WaylayBaseModel): store: StrictStr | None = None model_config = ConfigDict( - validate_assignment=True, protected_namespaces=(), extra="allow", alias_generator=_replace_query_alias_for, diff --git a/waylay-sdk-storage/README.md b/waylay-sdk-storage/README.md index 9b1e475..991b956 100644 --- a/waylay-sdk-storage/README.md +++ b/waylay-sdk-storage/README.md @@ -35,22 +35,15 @@ from waylay.sdk.api.api_exceptions import ApiError waylay_client = WaylayClient.from_profile() # Note that the typed model classes for responses/parameters/... are only available when `waylay-sdk-storage-types` is installed -from waylay.services.storage.models.tenant_status_report import TenantStatusReport try: - # Status - # calls `GET /storage/v1/status` - api_response = await waylay_client.storage.about.status( - # query parameters: - query = { - 'include_buckets': True - 'include_queues': True - 'include_disk_usage': False - }, + # Version + # calls `GET /storage/v1/` + api_response = await waylay_client.storage.about.version( ) - print("The response of storage.about.status:\n") + print("The response of storage.about.version:\n") pprint(api_response) except ApiError as e: - print("Exception when calling storage.about.status: %s\n" % e) + print("Exception when calling storage.about.version: %s\n" % e) ``` diff --git a/waylay-sdk-storage/pyproject.toml b/waylay-sdk-storage/pyproject.toml index 7d7fc73..cf12f71 100644 --- a/waylay-sdk-storage/pyproject.toml +++ b/waylay-sdk-storage/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "waylay-sdk-storage" -version = "0.4.1.20240415" +version = "0.4.1.20240423" description = "Waylay Storage" authors = [ { name = "Waylay", email = "info@waylay.io"} @@ -12,7 +12,7 @@ authors = [ keywords = ["Waylay Storage"] requires-python = ">= 3.9" dependencies = [ - "waylay-sdk-core ~= 0.2.0", + "waylay-sdk-core ~= 0.2.1", "pydantic ~= 2.6", "typing-extensions ~= 4.10", "eval-type-backport ~= 0.1.3; python_version < '3.10'", diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py index 981db60..1a8096a 100644 --- a/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py +++ b/waylay-sdk-storage/src/waylay/services/storage/api/about_api.py @@ -33,25 +33,25 @@ if TYPE_CHECKING: from waylay.services.storage.models import HTTPValidationError, TenantStatusReport - from waylay.services.storage.queries.about_api import GetQuery, StatusQuery + from waylay.services.storage.queries.about_api import StatusQuery, VersionQuery try: from waylay.services.storage.models import HTTPValidationError, TenantStatusReport - from waylay.services.storage.queries.about_api import GetQuery, StatusQuery + from waylay.services.storage.queries.about_api import StatusQuery, VersionQuery MODELS_AVAILABLE = True except ImportError: MODELS_AVAILABLE = False if not TYPE_CHECKING: - GetQuery = dict - StatusQuery = dict TenantStatusReport = Model HTTPValidationError = Model + VersionQuery = dict + T = TypeVar("T") @@ -66,84 +66,99 @@ class AboutApi(WithApiClient): """ @overload - async def get( + async def status( self, *, - query: GetQuery | QueryParamTypes | None = None, + query: StatusQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, - ) -> str: ... + ) -> TenantStatusReport: ... @overload - async def get( + async def status( self, *, - query: GetQuery | QueryParamTypes | None = None, + query: StatusQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @overload - async def get( + async def status( self, *, - query: GetQuery | QueryParamTypes | None = None, + query: StatusQuery | QueryParamTypes | None = None, raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @overload - async def get( + async def status( self, *, - query: GetQuery | QueryParamTypes | None = None, + query: StatusQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @overload - async def get( + async def status( self, *, - query: GetQuery | QueryParamTypes | None = None, + query: StatusQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... - async def get( + async def status( self, *, - query: GetQuery | QueryParamTypes | None = None, + query: StatusQuery | QueryParamTypes | None = None, raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, - ) -> str | T | Response | Model: - """Version. + ) -> TenantStatusReport | T | Response | Model: + """Status. - Get the application version. + Validate consistency of buckets and notification queues for this tenant. :param query: URL Query parameters. - :type query: GetQuery | QueryParamTypes, optional + :type query: StatusQuery | QueryParamTypes, optional + :param query['store'] (dict)
query.store (Query) : + :type query['store']: str + :param query['include_buckets'] (dict)
query.include_buckets (Query) : + :type query['include_buckets']: bool + :param query['include_queues'] (dict)
query.include_queues (Query) : + :type query['include_queues']: bool + :param query['include_disk_usage'] (dict)
query.include_disk_usage (Query) : + :type query['include_disk_usage']: bool :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -162,10 +177,6 @@ async def get( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = {} @@ -173,23 +184,25 @@ async def get( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: - query = TypeAdapter(GetQuery).validate_python(query) + if query is not None and MODELS_AVAILABLE and validate_request: + query = TypeAdapter(StatusQuery).validate_python(query) response_types_map: Dict[str, Any] = ( {"2XX": response_type} if response_type is not None else { - "200": str if not select_path else Model, + "200": TenantStatusReport if not select_path else Model, } ) - non_200_response_types_map: Dict[str, Any] = {} + non_200_response_types_map: Dict[str, Any] = { + "422": HTTPValidationError, + } response_types_map.update(non_200_response_types_map) ## peform request return await self.api_client.request( method="GET", - resource_path="/storage/v1/", + resource_path="/storage/v1/status", path_params=path_params, params=query, **body_args, @@ -201,92 +214,91 @@ async def get( ) @overload - async def status( + async def version( self, *, - query: StatusQuery | QueryParamTypes | None = None, + query: VersionQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, - ) -> TenantStatusReport: ... + ) -> str: ... @overload - async def status( + async def version( self, *, - query: StatusQuery | QueryParamTypes | None = None, + query: VersionQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @overload - async def status( + async def version( self, *, - query: StatusQuery | QueryParamTypes | None = None, + query: VersionQuery | QueryParamTypes | None = None, raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @overload - async def status( + async def version( self, *, - query: StatusQuery | QueryParamTypes | None = None, + query: VersionQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @overload - async def status( + async def version( self, *, - query: StatusQuery | QueryParamTypes | None = None, + query: VersionQuery | QueryParamTypes | None = None, raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... - async def status( + async def version( self, *, - query: StatusQuery | QueryParamTypes | None = None, + query: VersionQuery | QueryParamTypes | None = None, raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, - ) -> TenantStatusReport | T | Response | Model: - """Status. + ) -> str | T | Response | Model: + """Version. - Validate consistency of buckets and notification queues for this tenant. + Get the application version. :param query: URL Query parameters. - :type query: StatusQuery | QueryParamTypes, optional - :param query['store'] (dict)
query.store (Query) : - :type query['store']: str - :param query['include_buckets'] (dict)
query.include_buckets (Query) : - :type query['include_buckets']: bool - :param query['include_queues'] (dict)
query.include_queues (Query) : - :type query['include_queues']: bool - :param query['include_disk_usage'] (dict)
query.include_disk_usage (Query) : - :type query['include_disk_usage']: bool + :type query: VersionQuery | QueryParamTypes, optional :param raw_response: If true, return the http Response object instead of returning an api model object, or throwing an ApiError. :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -305,10 +317,6 @@ async def status( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = {} @@ -316,25 +324,23 @@ async def status( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: - query = TypeAdapter(StatusQuery).validate_python(query) + if query is not None and MODELS_AVAILABLE and validate_request: + query = TypeAdapter(VersionQuery).validate_python(query) response_types_map: Dict[str, Any] = ( {"2XX": response_type} if response_type is not None else { - "200": TenantStatusReport if not select_path else Model, + "200": str if not select_path else Model, } ) - non_200_response_types_map: Dict[str, Any] = { - "422": HTTPValidationError, - } + non_200_response_types_map: Dict[str, Any] = {} response_types_map.update(non_200_response_types_map) ## peform request return await self.api_client.request( method="GET", - resource_path="/storage/v1/status", + resource_path="/storage/v1/", path_params=path_params, params=query, **body_args, diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py index 3cbdf5b..8aaf7ce 100644 --- a/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py +++ b/waylay-sdk-storage/src/waylay/services/storage/api/bucket_api.py @@ -86,6 +86,7 @@ async def get( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Bucket: ... @@ -99,6 +100,7 @@ async def get( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -112,6 +114,7 @@ async def get( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -125,6 +128,7 @@ async def get( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -138,6 +142,7 @@ async def get( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -150,6 +155,7 @@ async def get( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Bucket | T | Response | Model: @@ -166,6 +172,7 @@ async def get( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -184,10 +191,6 @@ async def get( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -197,7 +200,7 @@ async def get( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(GetQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -234,6 +237,7 @@ async def list( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> BucketListing: ... @@ -246,6 +250,7 @@ async def list( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -258,6 +263,7 @@ async def list( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -270,6 +276,7 @@ async def list( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -282,6 +289,7 @@ async def list( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -293,6 +301,7 @@ async def list( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> BucketListing | T | Response | Model: @@ -307,6 +316,7 @@ async def list( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -325,10 +335,6 @@ async def list( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = {} @@ -336,7 +342,7 @@ async def list( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(ListQuery).validate_python(query) response_types_map: Dict[str, Any] = ( diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py index 985c527..c797733 100644 --- a/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py +++ b/waylay-sdk-storage/src/waylay/services/storage/api/object_api.py @@ -109,6 +109,7 @@ async def copy_or_move( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity: ... @@ -123,6 +124,7 @@ async def copy_or_move( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -137,6 +139,7 @@ async def copy_or_move( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -151,6 +154,7 @@ async def copy_or_move( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -165,6 +169,7 @@ async def copy_or_move( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -178,6 +183,7 @@ async def copy_or_move( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity | T | Response | Model: @@ -200,6 +206,7 @@ async def copy_or_move( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -218,10 +225,6 @@ async def copy_or_move( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -232,7 +235,7 @@ async def copy_or_move( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(CopyOrMoveQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -271,6 +274,7 @@ async def create_folder( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> BucketObject: ... @@ -285,6 +289,7 @@ async def create_folder( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -299,6 +304,7 @@ async def create_folder( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -313,6 +319,7 @@ async def create_folder( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -327,6 +334,7 @@ async def create_folder( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -340,6 +348,7 @@ async def create_folder( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> BucketObject | T | Response | Model: @@ -360,6 +369,7 @@ async def create_folder( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -378,10 +388,6 @@ async def create_folder( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -392,7 +398,7 @@ async def create_folder( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(CreateFolderQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -431,6 +437,7 @@ async def list( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> ResponseList: ... @@ -445,6 +452,7 @@ async def list( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -459,6 +467,7 @@ async def list( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -473,6 +482,7 @@ async def list( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -487,6 +497,7 @@ async def list( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -500,6 +511,7 @@ async def list( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> ResponseList | T | Response | Model: @@ -546,6 +558,7 @@ async def list( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -564,10 +577,6 @@ async def list( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -578,7 +587,7 @@ async def list( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(ListQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -617,6 +626,7 @@ async def remove( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity: ... @@ -631,6 +641,7 @@ async def remove( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -645,6 +656,7 @@ async def remove( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -659,6 +671,7 @@ async def remove( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -673,6 +686,7 @@ async def remove( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -686,6 +700,7 @@ async def remove( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity | T | Response | Model: @@ -712,6 +727,7 @@ async def remove( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -730,10 +746,6 @@ async def remove( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -744,7 +756,7 @@ async def remove( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(RemoveQuery).validate_python(query) response_types_map: Dict[str, Any] = ( diff --git a/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py b/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py index f35e539..086ad8b 100644 --- a/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py +++ b/waylay-sdk-storage/src/waylay/services/storage/api/subscription_api.py @@ -136,6 +136,7 @@ async def create( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionConfig: ... @@ -150,6 +151,7 @@ async def create( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -164,6 +166,7 @@ async def create( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -178,6 +181,7 @@ async def create( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -192,6 +196,7 @@ async def create( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -205,6 +210,7 @@ async def create( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionConfig | T | Response | Model: @@ -223,6 +229,7 @@ async def create( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -241,10 +248,6 @@ async def create( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -252,13 +255,13 @@ async def create( ## named body parameters body_args: Dict[str, Any] = {} - if json is not None and should_validate: + if json is not None and validate_request: body_adapter = TypeAdapter(SubscriptionConfig) json = body_adapter.validate_python(json) # type: ignore # https://github.com/pydantic/pydantic/discussions/7094 body_args["json"] = json # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(CreateQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -296,6 +299,7 @@ async def delete_by( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity: ... @@ -309,6 +313,7 @@ async def delete_by( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -322,6 +327,7 @@ async def delete_by( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -335,6 +341,7 @@ async def delete_by( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -348,6 +355,7 @@ async def delete_by( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -360,6 +368,7 @@ async def delete_by( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity | T | Response | Model: @@ -390,6 +399,7 @@ async def delete_by( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -408,10 +418,6 @@ async def delete_by( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -421,7 +427,7 @@ async def delete_by( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(DeleteByQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -460,6 +466,7 @@ async def get( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionConfig: ... @@ -474,6 +481,7 @@ async def get( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -488,6 +496,7 @@ async def get( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -502,6 +511,7 @@ async def get( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -516,6 +526,7 @@ async def get( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -529,6 +540,7 @@ async def get( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionConfig | T | Response | Model: @@ -547,6 +559,7 @@ async def get( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -565,10 +578,6 @@ async def get( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -579,7 +588,7 @@ async def get( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(GetQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -616,6 +625,7 @@ async def list( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionsListing: ... @@ -628,6 +638,7 @@ async def list( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -640,6 +651,7 @@ async def list( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -652,6 +664,7 @@ async def list( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -664,6 +677,7 @@ async def list( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -675,6 +689,7 @@ async def list( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionsListing | T | Response | Model: @@ -701,6 +716,7 @@ async def list( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -719,10 +735,6 @@ async def list( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = {} @@ -730,7 +742,7 @@ async def list( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(ListQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -768,6 +780,7 @@ async def query( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Subscriptions: ... @@ -781,6 +794,7 @@ async def query( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -794,6 +808,7 @@ async def query( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -807,6 +822,7 @@ async def query( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -820,6 +836,7 @@ async def query( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -832,6 +849,7 @@ async def query( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Subscriptions | T | Response | Model: @@ -862,6 +880,7 @@ async def query( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -880,10 +899,6 @@ async def query( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -893,7 +908,7 @@ async def query( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(QueryQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -932,6 +947,7 @@ async def remove( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity: ... @@ -946,6 +962,7 @@ async def remove( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -960,6 +977,7 @@ async def remove( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -974,6 +992,7 @@ async def remove( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -988,6 +1007,7 @@ async def remove( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -1001,6 +1021,7 @@ async def remove( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> HALEntity | T | Response | Model: @@ -1019,6 +1040,7 @@ async def remove( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -1037,10 +1059,6 @@ async def remove( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -1051,7 +1069,7 @@ async def remove( body_args: Dict[str, Any] = {} # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(RemoveQuery).validate_python(query) response_types_map: Dict[str, Any] = ( @@ -1091,6 +1109,7 @@ async def replace( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionConfig: ... @@ -1106,6 +1125,7 @@ async def replace( raw_response: Literal[False] = False, select_path: Literal[""] = "", response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -1121,6 +1141,7 @@ async def replace( raw_response: Literal[True], select_path: Literal["_not_used_"] = "_not_used_", response_type: Literal[None] = None, # not used + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Response: ... @@ -1136,6 +1157,7 @@ async def replace( raw_response: Literal[False] = False, select_path: str, response_type: Literal[None] = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> Model: ... @@ -1151,6 +1173,7 @@ async def replace( raw_response: Literal[False] = False, select_path: str, response_type: T, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> T: ... @@ -1165,6 +1188,7 @@ async def replace( raw_response: StrictBool = False, select_path: str = "", response_type: T | None = None, + validate_request: StrictBool = True, headers: HeaderTypes | None = None, **kwargs, ) -> SubscriptionConfig | T | Response | Model: @@ -1185,6 +1209,7 @@ async def replace( :param select_path: Denotes the json path applied to the response object before returning it. Set it to the empty string `""` to receive the full response object. :param response_type: If specified, the response is parsed into an instance of the specified type. + :param validate_request: If set to false, the request body and query parameters are NOT validated against the models in the service types package, even when available. :param headers: Header parameters for this request :type headers: dict, optional :param `**kwargs`: Additional parameters passed on to the http client. @@ -1203,10 +1228,6 @@ async def replace( object wraps both the http Response and any parsed data. """ - should_validate = ( - MODELS_AVAILABLE and self.api_client.config.client_side_validation - ) - # path parameters path_params: Dict[str, str] = { "bucket_name": str(bucket_name), @@ -1215,13 +1236,13 @@ async def replace( ## named body parameters body_args: Dict[str, Any] = {} - if json is not None and should_validate: + if json is not None and validate_request: body_adapter = TypeAdapter(SubscriptionConfig) json = body_adapter.validate_python(json) # type: ignore # https://github.com/pydantic/pydantic/discussions/7094 body_args["json"] = json # query parameters - if query is not None and should_validate: + if query is not None and MODELS_AVAILABLE and validate_request: query = TypeAdapter(ReplaceQuery).validate_python(query) response_types_map: Dict[str, Any] = ( diff --git a/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py b/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py index 6e2f622..572a487 100644 --- a/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py +++ b/waylay-sdk-storage/src/waylay/services/storage/service/__init__.py @@ -12,7 +12,7 @@ Do not edit the class manually. """ -__version__ = "0.4.1.20240415" +__version__ = "0.4.1.20240423" from .service import StorageService