diff --git a/Makefile b/Makefile
index 4c800576..23a1ac89 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ TEST_FOLDER=test
TEST_RUN_FOLDER=${TEST_FOLDER}/_run
CMD_FORMAT=ruff format
-CMD_FIX=ruff check --fix
+CMD_FIX=ruff check --fix --unsafe-fixes
CMD_CHECK=ruff check
# disables test QA unless set to empty string
diff --git a/docs/DefaultApi.md b/docs/DefaultApi.md
index 36ba57ad..5046a2f5 100644
--- a/docs/DefaultApi.md
+++ b/docs/DefaultApi.md
@@ -9,7 +9,7 @@ Method | HTTP request | Description
# **get**
> get(
> headers
-> ) -> RootPageResponse
+> ) -> RootPageResponse
Version
@@ -50,8 +50,11 @@ This endpoint does not need any parameter.
### Return type
-
-[**RootPageResponse**](RootPageResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RootPageResponse`** | | [RootPageResponse](RootPageResponse.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.
### HTTP request headers
diff --git a/docs/JobsApi.md b/docs/JobsApi.md
index 4a7829a7..da3c0917 100644
--- a/docs/JobsApi.md
+++ b/docs/JobsApi.md
@@ -12,7 +12,7 @@ Method | HTTP request | Description
> events(
> query: EventsQuery,
> headers
-> ) -> EventWithCloseSSE
+> ) -> EventWithCloseSSE
Stream Events
@@ -58,15 +58,18 @@ GET /registry/v2/jobs/events
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['type']** | [**JobType**](.md) | query parameter `"type"` | The type of the job. | [optional]
-**query['id']** | **str** | query parameter `"id"` | The id of the job. | [optional]
-**query['children']** | **bool** | query parameter `"children"` | If set to <code>true</code>, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to <code>false</code>. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**JobType**](.md) | query parameter `"type"` | The type of the job. | [optional]
+**query['id']** (dict)
**query.id** (Query) | **str** | query parameter `"id"` | The id of the job. | [optional]
+**query['children']** (dict)
**query.children** (Query) | **bool** | query parameter `"children"` | If set to <code>true</code>, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to <code>false</code>. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**EventWithCloseSSE**](EventWithCloseSSE.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`EventWithCloseSSE`** | | [EventWithCloseSSE](EventWithCloseSSE.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.
### HTTP request headers
@@ -86,7 +89,7 @@ Name | Type | API binding | Description | Notes
> type: JobType,
> id: str,
> headers
-> ) -> JobResponse
+> ) -> JobResponse
Get Job
@@ -133,8 +136,11 @@ Name | Type | API binding | Description | Notes
### Return type
-
-[**JobResponse**](JobResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`JobResponse`** | | [JobResponse](JobResponse.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.
### HTTP request headers
@@ -153,7 +159,7 @@ Name | Type | API binding | Description | Notes
> list(
> query: ListQuery,
> headers
-> ) -> JobsResponse
+> ) -> JobsResponse
List Jobs
@@ -204,18 +210,21 @@ GET /registry/v2/jobs/
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['type']** | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
-**query['state']** | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
+**query['state']** (dict)
**query.state** (Query) | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**JobsResponse**](JobsResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`JobsResponse`** | | [JobsResponse](JobsResponse.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.
### HTTP request headers
diff --git a/docs/ModelFunctionsApi.md b/docs/ModelFunctionsApi.md
index 26612377..de477acf 100644
--- a/docs/ModelFunctionsApi.md
+++ b/docs/ModelFunctionsApi.md
@@ -27,7 +27,7 @@ Method | HTTP request | Description
> query: CreateQuery,
> files,
> headers
-> ) -> PostModelJobSyncResponseV2
+> ) -> PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2
Create Model
@@ -67,7 +67,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives: 'application/tar+gzip', 'application/x-gzip', 'application/x-tar', 'application/gzip', 'multipart/form-data',
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.model_functions.create:\n")
@@ -87,20 +87,23 @@ Name | Type | API binding | Description | Notes
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | The assets for a <em>model</em> function can be provided as either <ul> <li>a single <em>tar</em> archive (optionally compressed), with one of the content types <code>application/octet-stream</code>, <code>application/tar+gzip</code>, <code>application/x-gzip</code>, <code>application/x-tar</code>, <code>application/gzip</code></li> <li>separate files in a <code>multipart/form-data</code> request</li> </ul> The required <code>model.json</code> json file contains the function metadata, and must have a <code>runtime</code> attribute that is one of the supported <em>runtime</em>s (see <code>GET /registry/v2/runtimes?functionType=kfserving</code>). For each <em>runtime</em> other files will be required or supported. | [optional]
**files** | **[FileTypes](Operation.md#req_arg_files)** | request body files | |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['deprecatePrevious']** | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
-**query['dryRun']** | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, validates the deployment conditions, but does not change anything. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | If set to <code>true</code>, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately. | [optional] [default False]
-**query['version']** | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest. | [optional]
-**query['name']** | **str** | query parameter `"name"` | If set, the value will be used as the function name instead of the one specified in the manifest. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid. | [optional] [default False]
+**query['deprecatePrevious']** (dict)
**query.deprecate_previous** (Query) | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
+**query['dryRun']** (dict)
**query.dry_run** (Query) | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, validates the deployment conditions, but does not change anything. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | If set to <code>true</code>, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately. | [optional] [default False]
+**query['version']** (dict)
**query.version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest. | [optional]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | If set, the value will be used as the function name instead of the one specified in the manifest. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`, `application/tar+gzip`, `application/x-gzip`, `application/x-tar`, `application/gzip`, `multipart/form-data`
### Return type
-
-[**PostModelJobSyncResponseV2**](PostModelJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2`** | | [PostModelJobSyncResponseV2](PostModelJobSyncResponseV2.md)
[PostModelJobAsyncResponseV2](PostModelJobAsyncResponseV2.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.
### HTTP request headers
@@ -123,7 +126,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: DeleteAssetQuery,
> headers
-> ) -> PostModelJobSyncResponseV2
+> ) -> PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2
Delete Model Asset
@@ -174,15 +177,18 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PostModelJobSyncResponseV2**](PostModelJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2`** | | [PostModelJobSyncResponseV2](PostModelJobSyncResponseV2.md)
[PostModelJobAsyncResponseV2](PostModelJobAsyncResponseV2.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.
### HTTP request headers
@@ -204,7 +210,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: GetArchiveQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get Model Archive
@@ -250,13 +256,16 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -278,7 +287,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: GetAssetQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get File From Model Archive
@@ -326,13 +335,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -352,7 +364,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: GetLatestQuery,
> headers
-> ) -> GetModelResponseV2
+> ) -> GetModelResponseV2
Get Latest Model Version
@@ -398,14 +410,17 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['includeDraft']** | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
+**query['includeDraft']** (dict)
**query.include_draft** (Query) | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetModelResponseV2**](GetModelResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetModelResponseV2`** | | [GetModelResponseV2](GetModelResponseV2.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.
### HTTP request headers
@@ -425,7 +440,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> version: str,
> headers
-> ) -> GetModelResponseV2
+> ) -> GetModelResponseV2
Get Model Version
@@ -471,8 +486,11 @@ Name | Type | API binding | Description | Notes
### Return type
-
-[**GetModelResponseV2**](GetModelResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetModelResponseV2`** | | [GetModelResponseV2](GetModelResponseV2.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.
### HTTP request headers
@@ -493,7 +511,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: JobsQuery,
> headers
-> ) -> JobsForModelResponseV2
+> ) -> JobsForModelResponseV2
List Model Jobs
@@ -548,18 +566,21 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['type']** | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
-**query['state']** | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
+**query['state']** (dict)
**query.state** (Query) | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**JobsForModelResponseV2**](JobsForModelResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`JobsForModelResponseV2`** | | [JobsForModelResponseV2](JobsForModelResponseV2.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.
### HTTP request headers
@@ -578,7 +599,7 @@ Name | Type | API binding | Description | Notes
> list(
> query: ListQuery,
> headers
-> ) -> LatestModelsResponseV2
+> ) -> LatestModelsResponseV2
List Models
@@ -642,32 +663,35 @@ GET /registry/v2/models/
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['page']** | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
-**query['includeDraft']** | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
-**query['deprecated']** | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
-**query['nameVersion']** | [**List[str]**](str.md) | query parameter `"nameVersion"` | Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered. | [optional]
-**query['version']** | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
-**query['status']** | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
-**query['runtimeVersion']** | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
-**query['createdBy']** | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['updatedBy']** | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
-**query['updatedBefore']** | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
-**query['updatedAfter']** | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
-**query['name']** | **str** | query parameter `"name"` | Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters). | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
-**query['runtime']** | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
-**query['latest']** | **bool** | query parameter `"latest"` | When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter. | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['page']** (dict)
**query.page** (Query) | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
+**query['includeDraft']** (dict)
**query.include_draft** (Query) | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
+**query['deprecated']** (dict)
**query.deprecated** (Query) | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
+**query['nameVersion']** (dict)
**query.name_version** (Query) | [**List[str]**](str.md) | query parameter `"nameVersion"` | Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered. | [optional]
+**query['version']** (dict)
**query.version** (Query) | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
+**query['status']** (dict)
**query.status** (Query) | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
+**query['runtimeVersion']** (dict)
**query.runtime_version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
+**query['createdBy']** (dict)
**query.created_by** (Query) | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['updatedBy']** (dict)
**query.updated_by** (Query) | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
+**query['updatedBefore']** (dict)
**query.updated_before** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
+**query['updatedAfter']** (dict)
**query.updated_after** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters). | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
+**query['runtime']** (dict)
**query.runtime** (Query) | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
+**query['latest']** (dict)
**query.latest** (Query) | **bool** | query parameter `"latest"` | When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**LatestModelsResponseV2**](LatestModelsResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`LatestModelsResponseV2`** | | [LatestModelsResponseV2](LatestModelsResponseV2.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.
### HTTP request headers
@@ -687,7 +711,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: ListVersionsQuery,
> headers
-> ) -> ModelVersionsResponseV2
+> ) -> ModelVersionsResponseV2
List Model Versions
@@ -748,27 +772,30 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['page']** | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
-**query['deprecated']** | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
-**query['version']** | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
-**query['status']** | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
-**query['runtimeVersion']** | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
-**query['createdBy']** | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['updatedBy']** | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
-**query['updatedBefore']** | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
-**query['updatedAfter']** | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
-**query['runtime']** | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['page']** (dict)
**query.page** (Query) | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
+**query['deprecated']** (dict)
**query.deprecated** (Query) | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
+**query['version']** (dict)
**query.version** (Query) | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
+**query['status']** (dict)
**query.status** (Query) | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
+**query['runtimeVersion']** (dict)
**query.runtime_version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
+**query['createdBy']** (dict)
**query.created_by** (Query) | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['updatedBy']** (dict)
**query.updated_by** (Query) | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
+**query['updatedBefore']** (dict)
**query.updated_before** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
+**query['updatedAfter']** (dict)
**query.updated_after** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
+**query['runtime']** (dict)
**query.runtime** (Query) | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**ModelVersionsResponseV2**](ModelVersionsResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`ModelVersionsResponseV2`** | | [ModelVersionsResponseV2](ModelVersionsResponseV2.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.
### HTTP request headers
@@ -789,7 +816,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PatchMetadataQuery,
> headers
-> ) -> GetModelResponseV2
+> ) -> GetModelResponseV2
Patch Model Metadata
@@ -840,13 +867,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**json** | [**FunctionMeta**](FunctionMeta.md) | json request body | | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetModelResponseV2**](GetModelResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetModelResponseV2`** | | [GetModelResponseV2](GetModelResponseV2.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.
### HTTP request headers
@@ -867,7 +897,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PublishQuery,
> headers
-> ) -> PostModelJobSyncResponseV2
+> ) -> PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2
Publish Draft Model
@@ -917,15 +947,18 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['deprecatePrevious']** | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['deprecatePrevious']** (dict)
**query.deprecate_previous** (Query) | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PostModelJobSyncResponseV2**](PostModelJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2`** | | [PostModelJobSyncResponseV2](PostModelJobSyncResponseV2.md)
[PostModelJobAsyncResponseV2](PostModelJobAsyncResponseV2.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.
### HTTP request headers
@@ -947,7 +980,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: RebuildQuery,
> headers
-> ) -> RebuildModelSyncResponseV2
+> ) -> RebuildModelSyncResponseV2 \| RebuildModelAsyncResponseV2
Rebuild Model
@@ -1002,20 +1035,23 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['dryRun']** | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, checks whether rebuild jobs are needed, but do not start any jobs. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['upgrade']** | [**RebuildPolicy**](.md) | query parameter `"upgrade"` | If set, force a rebuild with the given <em>runtime</em> version selection policy. <ul> <li><code>same</code> <b>patch</b> version. This should only include backward compatible upgrades. </li> <li><code>minor</code> <b>major</b> version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .</li> </ul> | [optional]
-**query['forceVersion']** | **str** | query parameter `"forceVersion"` | If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter. | [optional]
-**query['ignoreChecks']** | **bool** | query parameter `"ignoreChecks"` | If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option | [optional]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
-**query['skipRebuild']** | **bool** | query parameter `"skipRebuild"` | If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['dryRun']** (dict)
**query.dry_run** (Query) | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, checks whether rebuild jobs are needed, but do not start any jobs. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['upgrade']** (dict)
**query.upgrade** (Query) | [**RebuildPolicy**](.md) | query parameter `"upgrade"` | If set, force a rebuild with the given <em>runtime</em> version selection policy. <ul> <li><code>same</code> <b>patch</b> version. This should only include backward compatible upgrades. </li> <li><code>minor</code> <b>major</b> version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .</li> </ul> | [optional]
+**query['forceVersion']** (dict)
**query.force_version** (Query) | **str** | query parameter `"forceVersion"` | If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter. | [optional]
+**query['ignoreChecks']** (dict)
**query.ignore_checks** (Query) | **bool** | query parameter `"ignoreChecks"` | If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option | [optional]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
+**query['skipRebuild']** (dict)
**query.skip_rebuild** (Query) | **bool** | query parameter `"skipRebuild"` | If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RebuildModelSyncResponseV2**](RebuildModelSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RebuildModelSyncResponseV2 \| RebuildModelAsyncResponseV2`** | | [RebuildModelSyncResponseV2](RebuildModelSyncResponseV2.md)
[RebuildModelAsyncResponseV2](RebuildModelAsyncResponseV2.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.
### HTTP request headers
@@ -1037,7 +1073,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: RemoveVersionQuery,
> headers
-> ) -> UndeployedResponseV2
+> ) -> UndeployedResponseV2 \| UndeploySubmittedResponseV2
Remove Model Version
@@ -1087,16 +1123,19 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['force']** | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
-**query['undeploy']** | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['force']** (dict)
**query.force** (Query) | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
+**query['undeploy']** (dict)
**query.undeploy** (Query) | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**UndeployedResponseV2**](UndeployedResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`UndeployedResponseV2 \| UndeploySubmittedResponseV2`** | | [UndeployedResponseV2](UndeployedResponseV2.md)
[UndeploySubmittedResponseV2](UndeploySubmittedResponseV2.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.
### HTTP request headers
@@ -1117,7 +1156,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: RemoveVersionsQuery,
> headers
-> ) -> UndeployedResponseV2
+> ) -> UndeployedResponseV2 \| UndeploySubmittedResponseV2
Remove Model
@@ -1165,16 +1204,19 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['force']** | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
-**query['undeploy']** | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['force']** (dict)
**query.force** (Query) | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
+**query['undeploy']** (dict)
**query.undeploy** (Query) | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**UndeployedResponseV2**](UndeployedResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`UndeployedResponseV2 \| UndeploySubmittedResponseV2`** | | [UndeployedResponseV2](UndeployedResponseV2.md)
[UndeploySubmittedResponseV2](UndeploySubmittedResponseV2.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.
### HTTP request headers
@@ -1197,7 +1239,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: UpdateAssetQuery,
> headers
-> ) -> PostModelJobSyncResponseV2
+> ) -> PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2
Update Model Asset
@@ -1235,7 +1277,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives:
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.model_functions.update_asset:\n")
@@ -1257,16 +1299,19 @@ Name | Type | API binding | Description | Notes
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | A single asset file. | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`
### Return type
-
-[**PostModelJobSyncResponseV2**](PostModelJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2`** | | [PostModelJobSyncResponseV2](PostModelJobSyncResponseV2.md)
[PostModelJobAsyncResponseV2](PostModelJobAsyncResponseV2.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.
### HTTP request headers
@@ -1289,7 +1334,7 @@ Name | Type | API binding | Description | Notes
> query: UpdateAssetsQuery,
> files,
> headers
-> ) -> PostModelJobSyncResponseV2
+> ) -> PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2
Update Model Assets
@@ -1326,7 +1371,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives: 'application/tar+gzip', 'application/x-gzip', 'application/x-tar', 'application/gzip', 'multipart/form-data',
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.model_functions.update_assets:\n")
@@ -1348,16 +1393,19 @@ Name | Type | API binding | Description | Notes
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | The assets for a <em>model</em> function can be provided as either <ul> <li>a single <em>tar</em> archive (optionally compressed), with one of the content types <code>application/octet-stream</code>, <code>application/tar+gzip</code>, <code>application/x-gzip</code>, <code>application/x-tar</code>, <code>application/gzip</code></li> <li>separate files in a <code>multipart/form-data</code> request</li> </ul> The provided assets will be added to the <em>model</em> function's collection of existing assets, replacing any existing assets with the same name. Please note that it is not allowed to update the model.json</code> json file with a changed value for any of the <code>name</code>, <code>version</code> and/or <code>runtime</code> attributes. For each <em>runtime</em> other files are supported. | [optional]
**files** | **[FileTypes](Operation.md#req_arg_files)** | request body files | |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`, `application/tar+gzip`, `application/x-gzip`, `application/x-tar`, `application/gzip`, `multipart/form-data`
### Return type
-
-[**PostModelJobSyncResponseV2**](PostModelJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostModelJobSyncResponseV2 \| PostModelJobAsyncResponseV2`** | | [PostModelJobSyncResponseV2](PostModelJobSyncResponseV2.md)
[PostModelJobAsyncResponseV2](PostModelJobAsyncResponseV2.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.
### HTTP request headers
@@ -1379,7 +1427,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: VerifyQuery,
> headers
-> ) -> VerifyModelSyncResponseV2
+> ) -> VerifyModelSyncResponseV2 \| PostModelJobAsyncResponseV2
Verify Health Of Model
@@ -1428,15 +1476,18 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**VerifyModelSyncResponseV2**](VerifyModelSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`VerifyModelSyncResponseV2 \| PostModelJobAsyncResponseV2`** | | [VerifyModelSyncResponseV2](VerifyModelSyncResponseV2.md)
[PostModelJobAsyncResponseV2](PostModelJobAsyncResponseV2.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.
### HTTP request headers
diff --git a/docs/PlugFunctionsApi.md b/docs/PlugFunctionsApi.md
index 0627e15c..b6559c1e 100644
--- a/docs/PlugFunctionsApi.md
+++ b/docs/PlugFunctionsApi.md
@@ -28,7 +28,7 @@ Method | HTTP request | Description
> query: CreateQuery,
> files,
> headers
-> ) -> PostPlugJobSyncResponseV2
+> ) -> PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2
Create Plug
@@ -68,7 +68,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives: 'application/tar+gzip', 'application/x-gzip', 'application/x-tar', 'application/gzip', 'multipart/form-data',
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.plug_functions.create:\n")
@@ -88,20 +88,23 @@ Name | Type | API binding | Description | Notes
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | The assets for a <em>plug</em> function can be provided as either <ul> <li>a single <em>tar</em> archive (optionally compressed), with one of the content types <code>application/octet-stream</code>, <code>application/tar+gzip</code>, <code>application/x-gzip</code>, <code>application/x-tar</code>, <code>application/gzip</code></li> <li>separate files in a <code>multipart/form-data</code> request</li> </ul> The required <code>plug.json</code> json file contains the function metadata, and must have a <code>runtime</code> attribute that is one of the supported <em>runtime</em>s (see <code>GET /registry/v2/runtimes?functionType=plugs</code>). For each <em>runtime</em> other files will be required or supported. | [optional]
**files** | **[FileTypes](Operation.md#req_arg_files)** | request body files | |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['deprecatePrevious']** | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
-**query['dryRun']** | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, validates the deployment conditions, but does not change anything. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | If set to <code>true</code>, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately. | [optional] [default False]
-**query['version']** | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest. | [optional]
-**query['name']** | **str** | query parameter `"name"` | If set, the value will be used as the function name instead of the one specified in the manifest. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid. | [optional] [default False]
+**query['deprecatePrevious']** (dict)
**query.deprecate_previous** (Query) | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
+**query['dryRun']** (dict)
**query.dry_run** (Query) | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, validates the deployment conditions, but does not change anything. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | If set to <code>true</code>, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately. | [optional] [default False]
+**query['version']** (dict)
**query.version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest. | [optional]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | If set, the value will be used as the function name instead of the one specified in the manifest. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`, `application/tar+gzip`, `application/x-gzip`, `application/x-tar`, `application/gzip`, `multipart/form-data`
### Return type
-
-[**PostPlugJobSyncResponseV2**](PostPlugJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2`** | | [PostPlugJobSyncResponseV2](PostPlugJobSyncResponseV2.md)
[PostPlugJobAsyncResponseV2](PostPlugJobAsyncResponseV2.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.
### HTTP request headers
@@ -124,7 +127,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: DeleteAssetQuery,
> headers
-> ) -> PostPlugJobSyncResponseV2
+> ) -> PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2
Delete Plug Asset
@@ -175,15 +178,18 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PostPlugJobSyncResponseV2**](PostPlugJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2`** | | [PostPlugJobSyncResponseV2](PostPlugJobSyncResponseV2.md)
[PostPlugJobAsyncResponseV2](PostPlugJobAsyncResponseV2.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.
### HTTP request headers
@@ -205,7 +211,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: GetArchiveQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get Plug Archive
@@ -251,13 +257,16 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -279,7 +288,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: GetAssetQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get File From Plug Archive
@@ -327,13 +336,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -353,7 +365,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: GetLatestQuery,
> headers
-> ) -> GetPlugResponseV2
+> ) -> GetPlugResponseV2
Get Latest Plug Version
@@ -401,15 +413,18 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['type']** | [**PlugType**](.md) | query parameter `"type"` | If set, filters on the type of plug. | [optional]
-**query['includeDraft']** | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**PlugType**](.md) | query parameter `"type"` | If set, filters on the type of plug. | [optional]
+**query['includeDraft']** (dict)
**query.include_draft** (Query) | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetPlugResponseV2**](GetPlugResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetPlugResponseV2`** | | [GetPlugResponseV2](GetPlugResponseV2.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.
### HTTP request headers
@@ -429,7 +444,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> version: str,
> headers
-> ) -> GetPlugResponseV2
+> ) -> GetPlugResponseV2
Get Plug Version
@@ -475,8 +490,11 @@ Name | Type | API binding | Description | Notes
### Return type
-
-[**GetPlugResponseV2**](GetPlugResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetPlugResponseV2`** | | [GetPlugResponseV2](GetPlugResponseV2.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.
### HTTP request headers
@@ -497,7 +515,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: JobsQuery,
> headers
-> ) -> JobsForPlugResponseV2
+> ) -> JobsForPlugResponseV2
List Plug Jobs
@@ -552,18 +570,21 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['type']** | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
-**query['state']** | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
+**query['state']** (dict)
**query.state** (Query) | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**JobsForPlugResponseV2**](JobsForPlugResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`JobsForPlugResponseV2`** | | [JobsForPlugResponseV2](JobsForPlugResponseV2.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.
### HTTP request headers
@@ -582,7 +603,7 @@ Name | Type | API binding | Description | Notes
> list(
> query: ListQuery,
> headers
-> ) -> LatestPlugsResponseV2
+> ) -> LatestPlugsResponseV2
List Plugs
@@ -649,34 +670,37 @@ GET /registry/v2/plugs/
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['tags']** | [**TagsFilter**](.md) | query parameter `"tags"` | Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected. | [optional]
-**query['type']** | [**PlugType**](.md) | query parameter `"type"` | If set, filters on the type of plug. | [optional]
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['page']** | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
-**query['includeDraft']** | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
-**query['deprecated']** | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
-**query['nameVersion']** | [**List[str]**](str.md) | query parameter `"nameVersion"` | Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered. | [optional]
-**query['version']** | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
-**query['status']** | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
-**query['runtimeVersion']** | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
-**query['createdBy']** | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['updatedBy']** | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
-**query['updatedBefore']** | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
-**query['updatedAfter']** | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
-**query['name']** | **str** | query parameter `"name"` | Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters). | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
-**query['runtime']** | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
-**query['latest']** | **bool** | query parameter `"latest"` | When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter. | [optional]
+**query['tags']** (dict)
**query.tags** (Query) | [**TagsFilter**](.md) | query parameter `"tags"` | Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**PlugType**](.md) | query parameter `"type"` | If set, filters on the type of plug. | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['page']** (dict)
**query.page** (Query) | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
+**query['includeDraft']** (dict)
**query.include_draft** (Query) | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
+**query['deprecated']** (dict)
**query.deprecated** (Query) | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
+**query['nameVersion']** (dict)
**query.name_version** (Query) | [**List[str]**](str.md) | query parameter `"nameVersion"` | Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered. | [optional]
+**query['version']** (dict)
**query.version** (Query) | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
+**query['status']** (dict)
**query.status** (Query) | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
+**query['runtimeVersion']** (dict)
**query.runtime_version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
+**query['createdBy']** (dict)
**query.created_by** (Query) | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['updatedBy']** (dict)
**query.updated_by** (Query) | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
+**query['updatedBefore']** (dict)
**query.updated_before** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
+**query['updatedAfter']** (dict)
**query.updated_after** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters). | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
+**query['runtime']** (dict)
**query.runtime** (Query) | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
+**query['latest']** (dict)
**query.latest** (Query) | **bool** | query parameter `"latest"` | When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**LatestPlugsResponseV2**](LatestPlugsResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`LatestPlugsResponseV2`** | | [LatestPlugsResponseV2](LatestPlugsResponseV2.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.
### HTTP request headers
@@ -696,7 +720,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: ListVersionsQuery,
> headers
-> ) -> PlugVersionsResponseV2
+> ) -> PlugVersionsResponseV2
List Plug Versions
@@ -758,28 +782,31 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['tags']** | [**TagsFilter**](.md) | query parameter `"tags"` | Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected. | [optional]
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['page']** | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
-**query['deprecated']** | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
-**query['version']** | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
-**query['status']** | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
-**query['runtimeVersion']** | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
-**query['createdBy']** | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['updatedBy']** | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
-**query['updatedBefore']** | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
-**query['updatedAfter']** | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
-**query['runtime']** | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
+**query['tags']** (dict)
**query.tags** (Query) | [**TagsFilter**](.md) | query parameter `"tags"` | Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected. | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['page']** (dict)
**query.page** (Query) | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
+**query['deprecated']** (dict)
**query.deprecated** (Query) | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
+**query['version']** (dict)
**query.version** (Query) | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
+**query['status']** (dict)
**query.status** (Query) | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
+**query['runtimeVersion']** (dict)
**query.runtime_version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
+**query['createdBy']** (dict)
**query.created_by** (Query) | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['updatedBy']** (dict)
**query.updated_by** (Query) | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
+**query['updatedBefore']** (dict)
**query.updated_before** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
+**query['updatedAfter']** (dict)
**query.updated_after** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
+**query['runtime']** (dict)
**query.runtime** (Query) | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PlugVersionsResponseV2**](PlugVersionsResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PlugVersionsResponseV2`** | | [PlugVersionsResponseV2](PlugVersionsResponseV2.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.
### HTTP request headers
@@ -800,7 +827,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PatchInterfaceQuery,
> headers
-> ) -> GetPlugResponseV2
+> ) -> GetPlugResponseV2
Patch Plug Interface
@@ -851,13 +878,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**json** | [**Documentation**](Documentation.md) | json request body | | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetPlugResponseV2**](GetPlugResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetPlugResponseV2`** | | [GetPlugResponseV2](GetPlugResponseV2.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.
### HTTP request headers
@@ -878,7 +908,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PatchMetadataQuery,
> headers
-> ) -> GetPlugResponseV2
+> ) -> GetPlugResponseV2
Patch Plug Metadata
@@ -929,13 +959,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**json** | [**UpdateMetadataRequestV2**](UpdateMetadataRequestV2.md) | json request body | | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetPlugResponseV2**](GetPlugResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetPlugResponseV2`** | | [GetPlugResponseV2](GetPlugResponseV2.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.
### HTTP request headers
@@ -956,7 +989,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PublishQuery,
> headers
-> ) -> PostPlugJobSyncResponseV2
+> ) -> PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2
Publish Draft Plug
@@ -1006,15 +1039,18 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['deprecatePrevious']** | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['deprecatePrevious']** (dict)
**query.deprecate_previous** (Query) | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PostPlugJobSyncResponseV2**](PostPlugJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2`** | | [PostPlugJobSyncResponseV2](PostPlugJobSyncResponseV2.md)
[PostPlugJobAsyncResponseV2](PostPlugJobAsyncResponseV2.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.
### HTTP request headers
@@ -1036,7 +1072,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: RebuildQuery,
> headers
-> ) -> RebuildPlugSyncResponseV2
+> ) -> RebuildPlugSyncResponseV2 \| RebuildPlugAsyncResponseV2
Rebuild Plug
@@ -1091,20 +1127,23 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['dryRun']** | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, checks whether rebuild jobs are needed, but do not start any jobs. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['upgrade']** | [**RebuildPolicy**](.md) | query parameter `"upgrade"` | If set, force a rebuild with the given <em>runtime</em> version selection policy. <ul> <li><code>same</code> <b>patch</b> version. This should only include backward compatible upgrades. </li> <li><code>minor</code> <b>major</b> version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .</li> </ul> | [optional]
-**query['forceVersion']** | **str** | query parameter `"forceVersion"` | If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter. | [optional]
-**query['ignoreChecks']** | **bool** | query parameter `"ignoreChecks"` | If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option | [optional]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
-**query['skipRebuild']** | **bool** | query parameter `"skipRebuild"` | If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['dryRun']** (dict)
**query.dry_run** (Query) | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, checks whether rebuild jobs are needed, but do not start any jobs. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['upgrade']** (dict)
**query.upgrade** (Query) | [**RebuildPolicy**](.md) | query parameter `"upgrade"` | If set, force a rebuild with the given <em>runtime</em> version selection policy. <ul> <li><code>same</code> <b>patch</b> version. This should only include backward compatible upgrades. </li> <li><code>minor</code> <b>major</b> version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .</li> </ul> | [optional]
+**query['forceVersion']** (dict)
**query.force_version** (Query) | **str** | query parameter `"forceVersion"` | If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter. | [optional]
+**query['ignoreChecks']** (dict)
**query.ignore_checks** (Query) | **bool** | query parameter `"ignoreChecks"` | If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option | [optional]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
+**query['skipRebuild']** (dict)
**query.skip_rebuild** (Query) | **bool** | query parameter `"skipRebuild"` | If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RebuildPlugSyncResponseV2**](RebuildPlugSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RebuildPlugSyncResponseV2 \| RebuildPlugAsyncResponseV2`** | | [RebuildPlugSyncResponseV2](RebuildPlugSyncResponseV2.md)
[RebuildPlugAsyncResponseV2](RebuildPlugAsyncResponseV2.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.
### HTTP request headers
@@ -1126,7 +1165,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: RemoveVersionQuery,
> headers
-> ) -> UndeployedResponseV2
+> ) -> UndeployedResponseV2 \| UndeploySubmittedResponseV2
Remove Plug Version
@@ -1176,16 +1215,19 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['force']** | **bool** | query parameter `"force"` | If <code>true</code>, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be <code>deprecated</code>, i.e removed from regular listings. | [optional]
-**query['undeploy']** | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['force']** (dict)
**query.force** (Query) | **bool** | query parameter `"force"` | If <code>true</code>, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be <code>deprecated</code>, i.e removed from regular listings. | [optional]
+**query['undeploy']** (dict)
**query.undeploy** (Query) | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**UndeployedResponseV2**](UndeployedResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`UndeployedResponseV2 \| UndeploySubmittedResponseV2`** | | [UndeployedResponseV2](UndeployedResponseV2.md)
[UndeploySubmittedResponseV2](UndeploySubmittedResponseV2.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.
### HTTP request headers
@@ -1206,7 +1248,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: RemoveVersionsQuery,
> headers
-> ) -> UndeployedResponseV2
+> ) -> UndeployedResponseV2 \| UndeploySubmittedResponseV2
Remove Plug
@@ -1254,16 +1296,19 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['force']** | **bool** | query parameter `"force"` | If <code>true</code>, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be <code>deprecated</code>, i.e removed from regular listings. | [optional]
-**query['undeploy']** | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['force']** (dict)
**query.force** (Query) | **bool** | query parameter `"force"` | If <code>true</code>, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be <code>deprecated</code>, i.e removed from regular listings. | [optional]
+**query['undeploy']** (dict)
**query.undeploy** (Query) | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**UndeployedResponseV2**](UndeployedResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`UndeployedResponseV2 \| UndeploySubmittedResponseV2`** | | [UndeployedResponseV2](UndeployedResponseV2.md)
[UndeploySubmittedResponseV2](UndeploySubmittedResponseV2.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.
### HTTP request headers
@@ -1286,7 +1331,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: UpdateAssetQuery,
> headers
-> ) -> PostPlugJobSyncResponseV2
+> ) -> PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2
Update Plug Asset
@@ -1324,7 +1369,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives:
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.plug_functions.update_asset:\n")
@@ -1346,16 +1391,19 @@ Name | Type | API binding | Description | Notes
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | A single asset file. | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`
### Return type
-
-[**PostPlugJobSyncResponseV2**](PostPlugJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2`** | | [PostPlugJobSyncResponseV2](PostPlugJobSyncResponseV2.md)
[PostPlugJobAsyncResponseV2](PostPlugJobAsyncResponseV2.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.
### HTTP request headers
@@ -1378,7 +1426,7 @@ Name | Type | API binding | Description | Notes
> query: UpdateAssetsQuery,
> files,
> headers
-> ) -> PostPlugJobSyncResponseV2
+> ) -> PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2
Update Plug Assets
@@ -1415,7 +1463,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives: 'application/tar+gzip', 'application/x-gzip', 'application/x-tar', 'application/gzip', 'multipart/form-data',
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.plug_functions.update_assets:\n")
@@ -1437,16 +1485,19 @@ Name | Type | API binding | Description | Notes
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | The assets for a <em>plug</em> function can be provided as either <ul> <li>a single <em>tar</em> archive (optionally compressed), with one of the content types <code>application/octet-stream</code>, <code>application/tar+gzip</code>, <code>application/x-gzip</code>, <code>application/x-tar</code>, <code>application/gzip</code></li> <li>separate files in a <code>multipart/form-data</code> request</li> </ul> The provided assets will be added to the <em>plug</em> function's collection of existing assets, replacing any existing assets with the same name. Please note that it is not allowed to update the plug.json</code> json file with a changed value for any of the <code>name</code>, <code>version</code> and/or <code>runtime</code> attributes. For each <em>runtime</em> other files are supported. | [optional]
**files** | **[FileTypes](Operation.md#req_arg_files)** | request body files | |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`, `application/tar+gzip`, `application/x-gzip`, `application/x-tar`, `application/gzip`, `multipart/form-data`
### Return type
-
-[**PostPlugJobSyncResponseV2**](PostPlugJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostPlugJobSyncResponseV2 \| PostPlugJobAsyncResponseV2`** | | [PostPlugJobSyncResponseV2](PostPlugJobSyncResponseV2.md)
[PostPlugJobAsyncResponseV2](PostPlugJobAsyncResponseV2.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.
### HTTP request headers
@@ -1468,7 +1519,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: VerifyQuery,
> headers
-> ) -> VerifyPlugSyncResponseV2
+> ) -> VerifyPlugSyncResponseV2 \| PostPlugJobAsyncResponseV2
Verify Health Of Plug
@@ -1517,15 +1568,18 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**VerifyPlugSyncResponseV2**](VerifyPlugSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`VerifyPlugSyncResponseV2 \| PostPlugJobAsyncResponseV2`** | | [VerifyPlugSyncResponseV2](VerifyPlugSyncResponseV2.md)
[PostPlugJobAsyncResponseV2](PostPlugJobAsyncResponseV2.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.
### HTTP request headers
diff --git a/docs/RuntimesApi.md b/docs/RuntimesApi.md
index 5e3293cb..74c4c498 100644
--- a/docs/RuntimesApi.md
+++ b/docs/RuntimesApi.md
@@ -17,7 +17,7 @@ Method | HTTP request | Description
> version: SemanticVersionRange,
> query: ExampleArchiveQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get Runtime Example Archive
@@ -64,14 +64,17 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of a <em>runtime</em> |
**version** | [**SemanticVersionRange**](.md) | path parameter `"version"` | A version range for a <em>runtime</em> |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default True]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -93,7 +96,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: GetExampleAssetQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get File From Runtime Example Archive
@@ -142,14 +145,17 @@ Name | Type | API binding | Description | Notes
**version** | [**SemanticVersionRange**](.md) | path parameter `"version"` | A version range for a <em>runtime</em> |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default True]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -169,7 +175,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: GetLatestQuery,
> headers
-> ) -> RuntimeVersionResponse
+> ) -> RuntimeVersionResponse
Get Latest Runtime Version
@@ -219,16 +225,19 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of a <em>runtime</em> |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['version']** | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, filters on the <code>version</code> of a runtime. Supports [version ranges](https://devhints.io/semver). | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default False]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | If set, filters on the <code>functionType</code> of a runtime. Uses an exact match. | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | If set, filters on the <code>archiveFormat</code> of a runtime. Uses an exact match. | [optional]
+**query['version']** (dict)
**query.version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, filters on the <code>version</code> of a runtime. Supports [version ranges](https://devhints.io/semver). | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default False]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | If set, filters on the <code>functionType</code> of a runtime. Uses an exact match. | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | If set, filters on the <code>archiveFormat</code> of a runtime. Uses an exact match. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RuntimeVersionResponse**](RuntimeVersionResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RuntimeVersionResponse`** | | [RuntimeVersionResponse](RuntimeVersionResponse.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.
### HTTP request headers
@@ -249,7 +258,7 @@ Name | Type | API binding | Description | Notes
> version: SemanticVersionRange,
> query: GetQuery,
> headers
-> ) -> RuntimeVersionResponse
+> ) -> RuntimeVersionResponse
Get Runtime Version
@@ -296,13 +305,16 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of a <em>runtime</em> |
**version** | [**SemanticVersionRange**](.md) | path parameter `"version"` | A version range for a <em>runtime</em> |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default True]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RuntimeVersionResponse**](RuntimeVersionResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RuntimeVersionResponse`** | | [RuntimeVersionResponse](RuntimeVersionResponse.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.
### HTTP request headers
@@ -321,7 +333,7 @@ Name | Type | API binding | Description | Notes
> list(
> query: ListQuery,
> headers
-> ) -> RuntimeSummaryResponse
+> ) -> RuntimeSummaryResponse
List Runtimes
@@ -372,18 +384,21 @@ GET /registry/v2/runtimes/
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['version']** | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, filters on the <code>version</code> of a runtime. Supports [version ranges](https://devhints.io/semver). | [optional]
-**query['latest']** | [**LatestVersionLevel**](.md) | query parameter `"latest"` | If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default False]
-**query['name']** | **str** | query parameter `"name"` | If set, filters on the <code>name</code> of a runtime. Supports <code>*</code> and <code>?</code> wildcards and is case-insensitive. | [optional]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | If set, filters on the <code>functionType</code> of a runtime. Uses an exact match. | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | If set, filters on the <code>archiveFormat</code> of a runtime. Uses an exact match. | [optional]
+**query['version']** (dict)
**query.version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, filters on the <code>version</code> of a runtime. Supports [version ranges](https://devhints.io/semver). | [optional]
+**query['latest']** (dict)
**query.latest** (Query) | [**LatestVersionLevel**](.md) | query parameter `"latest"` | If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default False]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | If set, filters on the <code>name</code> of a runtime. Supports <code>*</code> and <code>?</code> wildcards and is case-insensitive. | [optional]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | If set, filters on the <code>functionType</code> of a runtime. Uses an exact match. | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | If set, filters on the <code>archiveFormat</code> of a runtime. Uses an exact match. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RuntimeSummaryResponse**](RuntimeSummaryResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RuntimeSummaryResponse`** | | [RuntimeSummaryResponse](RuntimeSummaryResponse.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.
### HTTP request headers
@@ -403,7 +418,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: ListVersionsQuery,
> headers
-> ) -> RuntimeSummaryResponse
+> ) -> RuntimeSummaryResponse
List Runtime Versions
@@ -455,17 +470,20 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of a <em>runtime</em> |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['version']** | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, filters on the <code>version</code> of a runtime. Supports [version ranges](https://devhints.io/semver). | [optional]
-**query['latest']** | [**LatestVersionLevel**](.md) | query parameter `"latest"` | If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default False]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | If set, filters on the <code>functionType</code> of a runtime. Uses an exact match. | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | If set, filters on the <code>archiveFormat</code> of a runtime. Uses an exact match. | [optional]
+**query['version']** (dict)
**query.version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, filters on the <code>version</code> of a runtime. Supports [version ranges](https://devhints.io/semver). | [optional]
+**query['latest']** (dict)
**query.latest** (Query) | [**LatestVersionLevel**](.md) | query parameter `"latest"` | If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | If set to `true`, deprecated runtimes will be included in the query. | [optional] [default False]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | If set, filters on the <code>functionType</code> of a runtime. Uses an exact match. | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | If set, filters on the <code>archiveFormat</code> of a runtime. Uses an exact match. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RuntimeSummaryResponse**](RuntimeSummaryResponse.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RuntimeSummaryResponse`** | | [RuntimeSummaryResponse](RuntimeSummaryResponse.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.
### HTTP request headers
diff --git a/docs/SchemasApi.md b/docs/SchemasApi.md
index 6c1ae772..6b08f8f5 100644
--- a/docs/SchemasApi.md
+++ b/docs/SchemasApi.md
@@ -12,7 +12,7 @@ Method | HTTP request | Description
> function_type: FunctionType,
> role: AssetRole,
> headers
-> ) -> Dict[str, object]
+> ) -> Dict[str, object]
Get Asset Schema
@@ -59,8 +59,11 @@ Name | Type | API binding | Description | Notes
### Return type
-
-**Dict[str, object]**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`Dict[str, object]`** | |
+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.
### HTTP request headers
@@ -79,7 +82,7 @@ Name | Type | API binding | Description | Notes
> get(
> schema_id: str,
> headers
-> ) -> Dict[str, object]
+> ) -> Dict[str, object]
Get Asset Schema
@@ -122,8 +125,11 @@ Name | Type | API binding | Description | Notes
### Return type
-
-**Dict[str, object]**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`Dict[str, object]`** | |
+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.
### HTTP request headers
diff --git a/docs/WebscriptFunctionsApi.md b/docs/WebscriptFunctionsApi.md
index 4c2b4cfe..ec9afa80 100644
--- a/docs/WebscriptFunctionsApi.md
+++ b/docs/WebscriptFunctionsApi.md
@@ -27,7 +27,7 @@ Method | HTTP request | Description
> query: CreateQuery,
> files,
> headers
-> ) -> PostWebscriptJobSyncResponseV2
+> ) -> PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2
Create Webscript Version
@@ -67,7 +67,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives: 'application/tar+gzip', 'application/x-gzip', 'application/x-tar', 'application/gzip', 'multipart/form-data',
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.webscript_functions.create:\n")
@@ -87,20 +87,23 @@ Name | Type | API binding | Description | Notes
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | The assets for a <em>webscript</em> function can be provided as either <ul> <li>a single <em>tar</em> archive (optionally compressed), with one of the content types <code>application/octet-stream</code>, <code>application/tar+gzip</code>, <code>application/x-gzip</code>, <code>application/x-tar</code>, <code>application/gzip</code></li> <li>separate files in a <code>multipart/form-data</code> request</li> </ul> The required <code>webscript.json</code> json file contains the function metadata, and must have a <code>runtime</code> attribute that is one of the supported <em>runtime</em>s (see <code>GET /registry/v2/runtimes?functionType=webscripts</code>). For each <em>runtime</em> other files will be required or supported. | [optional]
**files** | **[FileTypes](Operation.md#req_arg_files)** | request body files | |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['deprecatePrevious']** | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
-**query['dryRun']** | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, validates the deployment conditions, but does not change anything. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | If set to <code>true</code>, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately. | [optional] [default False]
-**query['version']** | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest. | [optional]
-**query['name']** | **str** | query parameter `"name"` | If set, the value will be used as the function name instead of the one specified in the manifest. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid. | [optional] [default False]
+**query['deprecatePrevious']** (dict)
**query.deprecate_previous** (Query) | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
+**query['dryRun']** (dict)
**query.dry_run** (Query) | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, validates the deployment conditions, but does not change anything. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | If set to <code>true</code>, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately. | [optional] [default False]
+**query['version']** (dict)
**query.version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"version"` | If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest. | [optional]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | If set, the value will be used as the function name instead of the one specified in the manifest. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`, `application/tar+gzip`, `application/x-gzip`, `application/x-tar`, `application/gzip`, `multipart/form-data`
### Return type
-
-[**PostWebscriptJobSyncResponseV2**](PostWebscriptJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2`** | | [PostWebscriptJobSyncResponseV2](PostWebscriptJobSyncResponseV2.md)
[PostWebscriptJobAsyncResponseV2](PostWebscriptJobAsyncResponseV2.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.
### HTTP request headers
@@ -123,7 +126,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: DeleteAssetQuery,
> headers
-> ) -> PostWebscriptJobSyncResponseV2
+> ) -> PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2
Delete Webscript Asset
@@ -174,15 +177,18 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PostWebscriptJobSyncResponseV2**](PostWebscriptJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2`** | | [PostWebscriptJobSyncResponseV2](PostWebscriptJobSyncResponseV2.md)
[PostWebscriptJobAsyncResponseV2](PostWebscriptJobAsyncResponseV2.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.
### HTTP request headers
@@ -204,7 +210,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: GetArchiveQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get Webscript Archive
@@ -250,13 +256,16 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -278,7 +287,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: GetAssetQuery,
> headers
-> ) -> bytearray
+> ) -> bytearray
Get File From Webscript Archive
@@ -326,13 +335,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['ls']** | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
+**query['ls']** (dict)
**query.ls** (Query) | **bool** | query parameter `"ls"` | If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime. | [optional] [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-**bytearray**
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`bytearray`** | |
+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.
### HTTP request headers
@@ -352,7 +364,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: GetLatestQuery,
> headers
-> ) -> GetWebscriptResponseV2
+> ) -> GetWebscriptResponseV2
Get Latest Webscript Version
@@ -398,14 +410,17 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['includeDraft']** | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
+**query['includeDraft']** (dict)
**query.include_draft** (Query) | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetWebscriptResponseV2**](GetWebscriptResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetWebscriptResponseV2`** | | [GetWebscriptResponseV2](GetWebscriptResponseV2.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.
### HTTP request headers
@@ -425,7 +440,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> version: str,
> headers
-> ) -> GetWebscriptResponseV2
+> ) -> GetWebscriptResponseV2
Get Webscript Version
@@ -471,8 +486,11 @@ Name | Type | API binding | Description | Notes
### Return type
-
-[**GetWebscriptResponseV2**](GetWebscriptResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetWebscriptResponseV2`** | | [GetWebscriptResponseV2](GetWebscriptResponseV2.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.
### HTTP request headers
@@ -493,7 +511,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: JobsQuery,
> headers
-> ) -> JobsForWebscriptResponseV2
+> ) -> JobsForWebscriptResponseV2
List Webscript Jobs
@@ -548,18 +566,21 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['type']** | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
-**query['state']** | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
-**query['functionType']** | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['type']** (dict)
**query.type** (Query) | [**List[JobTypeSchema]**](JobTypeSchema.md) | query parameter `"type"` | Filter on job type | [optional]
+**query['state']** (dict)
**query.state** (Query) | [**List[JobStateResult]**](JobStateResult.md) | query parameter `"state"` | Filter on job state | [optional]
+**query['functionType']** (dict)
**query.function_type** (Query) | [**List[FunctionType]**](FunctionType.md) | query parameter `"functionType"` | Filter on function type | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on jobs that created before the given timestamp or age | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on jobs that created after the given timestamp or age | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**JobsForWebscriptResponseV2**](JobsForWebscriptResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`JobsForWebscriptResponseV2`** | | [JobsForWebscriptResponseV2](JobsForWebscriptResponseV2.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.
### HTTP request headers
@@ -579,7 +600,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: ListVersionsQuery,
> headers
-> ) -> WebscriptVersionsResponseV2
+> ) -> WebscriptVersionsResponseV2
List Webscript Versions
@@ -640,27 +661,30 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['page']** | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
-**query['deprecated']** | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
-**query['version']** | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
-**query['status']** | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
-**query['runtimeVersion']** | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
-**query['createdBy']** | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['updatedBy']** | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
-**query['updatedBefore']** | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
-**query['updatedAfter']** | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
-**query['runtime']** | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['page']** (dict)
**query.page** (Query) | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
+**query['deprecated']** (dict)
**query.deprecated** (Query) | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
+**query['version']** (dict)
**query.version** (Query) | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
+**query['status']** (dict)
**query.status** (Query) | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
+**query['runtimeVersion']** (dict)
**query.runtime_version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
+**query['createdBy']** (dict)
**query.created_by** (Query) | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['updatedBy']** (dict)
**query.updated_by** (Query) | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
+**query['updatedBefore']** (dict)
**query.updated_before** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
+**query['updatedAfter']** (dict)
**query.updated_after** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
+**query['runtime']** (dict)
**query.runtime** (Query) | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**WebscriptVersionsResponseV2**](WebscriptVersionsResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`WebscriptVersionsResponseV2`** | | [WebscriptVersionsResponseV2](WebscriptVersionsResponseV2.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.
### HTTP request headers
@@ -679,7 +703,7 @@ Name | Type | API binding | Description | Notes
> list(
> query: ListQuery,
> headers
-> ) -> LatestWebscriptsResponseV2
+> ) -> LatestWebscriptsResponseV2
List Webscripts
@@ -743,32 +767,35 @@ GET /registry/v2/webscripts/
Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['limit']** | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
-**query['page']** | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
-**query['includeDraft']** | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
-**query['includeDeprecated']** | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
-**query['deprecated']** | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
-**query['draft']** | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
-**query['nameVersion']** | [**List[str]**](str.md) | query parameter `"nameVersion"` | Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered. | [optional]
-**query['version']** | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
-**query['status']** | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
-**query['runtimeVersion']** | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
-**query['createdBy']** | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['updatedBy']** | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
-**query['createdBefore']** | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
-**query['createdAfter']** | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
-**query['updatedBefore']** | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
-**query['updatedAfter']** | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
-**query['name']** | **str** | query parameter `"name"` | Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters). | [optional]
-**query['archiveFormat']** | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
-**query['runtime']** | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
-**query['latest']** | **bool** | query parameter `"latest"` | When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter. | [optional]
+**query['limit']** (dict)
**query.limit** (Query) | **float** | query parameter `"limit"` | The maximum number of items to be return from this query. Has a deployment-defined default and maximum value. | [optional]
+**query['page']** (dict)
**query.page** (Query) | **float** | query parameter `"page"` | The number of pages to skip when returning result to this query. | [optional]
+**query['includeDraft']** (dict)
**query.include_draft** (Query) | **bool** | query parameter `"includeDraft"` | Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**. | [optional]
+**query['includeDeprecated']** (dict)
**query.include_deprecated** (Query) | **bool** | query parameter `"includeDeprecated"` | Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**. | [optional]
+**query['deprecated']** (dict)
**query.deprecated** (Query) | **bool** | query parameter `"deprecated"` | Filter on the deprecation status of the function. | [optional]
+**query['draft']** (dict)
**query.draft** (Query) | **bool** | query parameter `"draft"` | Filter on the draft status of the function. | [optional]
+**query['nameVersion']** (dict)
**query.name_version** (Query) | [**List[str]**](str.md) | query parameter `"nameVersion"` | Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered. | [optional]
+**query['version']** (dict)
**query.version** (Query) | **str** | query parameter `"version"` | Filter on the version of the function (case-sensitive, supports wildcards). | [optional]
+**query['status']** (dict)
**query.status** (Query) | [**List[StatusFilter]**](StatusFilter.md) | query parameter `"status"` | Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions. | [optional]
+**query['runtimeVersion']** (dict)
**query.runtime_version** (Query) | [**SemanticVersionRange**](.md) | query parameter `"runtimeVersion"` | Filter on the runtime version. | [optional]
+**query['createdBy']** (dict)
**query.created_by** (Query) | **str** | query parameter `"createdBy"` | Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['updatedBy']** (dict)
**query.updated_by** (Query) | **str** | query parameter `"updatedBy"` | Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs. | [optional]
+**query['createdBefore']** (dict)
**query.created_before** (Query) | [**TimestampSpec**](.md) | query parameter `"createdBefore"` | Filter on funtions that were created before the given timestamp or age. | [optional]
+**query['createdAfter']** (dict)
**query.created_after** (Query) | [**TimestampSpec**](.md) | query parameter `"createdAfter"` | Filter on funtions that were created after the given timestamp or age. | [optional]
+**query['updatedBefore']** (dict)
**query.updated_before** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedBefore"` | Filter on funtions that were updated before the given timestamp or age. | [optional]
+**query['updatedAfter']** (dict)
**query.updated_after** (Query) | [**TimestampSpec**](.md) | query parameter `"updatedAfter"` | Filter on funtions that were updated after the given timestamp or age. | [optional]
+**query['name']** (dict)
**query.name** (Query) | **str** | query parameter `"name"` | Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters). | [optional]
+**query['archiveFormat']** (dict)
**query.archive_format** (Query) | [**List[ArchiveFormat]**](ArchiveFormat.md) | query parameter `"archiveFormat"` | Filter on the archive format of the function. | [optional]
+**query['runtime']** (dict)
**query.runtime** (Query) | [**List[str]**](str.md) | query parameter `"runtime"` | Filter on the runtime of the function. | [optional]
+**query['latest']** (dict)
**query.latest** (Query) | **bool** | query parameter `"latest"` | When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**LatestWebscriptsResponseV2**](LatestWebscriptsResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`LatestWebscriptsResponseV2`** | | [LatestWebscriptsResponseV2](LatestWebscriptsResponseV2.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.
### HTTP request headers
@@ -789,7 +816,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PatchMetadataQuery,
> headers
-> ) -> GetWebscriptResponseV2
+> ) -> GetWebscriptResponseV2
Patch Webscript Metadata
@@ -840,13 +867,16 @@ Name | Type | API binding | Description | Notes
**version** | **str** | path parameter `"version"` | The version of the function. |
**json** | [**FunctionMeta**](FunctionMeta.md) | json request body | | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**GetWebscriptResponseV2**](GetWebscriptResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`GetWebscriptResponseV2`** | | [GetWebscriptResponseV2](GetWebscriptResponseV2.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.
### HTTP request headers
@@ -867,7 +897,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: PublishQuery,
> headers
-> ) -> PostWebscriptJobSyncResponseV2
+> ) -> PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2
Publish Draft Webscript
@@ -917,15 +947,18 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['deprecatePrevious']** | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['deprecatePrevious']** (dict)
**query.deprecate_previous** (Query) | [**DeprecatePreviousPolicy**](.md) | query parameter `"deprecatePrevious"` | Set the cleanup policy used to automatically deprecate/delete previous versions. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**PostWebscriptJobSyncResponseV2**](PostWebscriptJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2`** | | [PostWebscriptJobSyncResponseV2](PostWebscriptJobSyncResponseV2.md)
[PostWebscriptJobAsyncResponseV2](PostWebscriptJobAsyncResponseV2.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.
### HTTP request headers
@@ -947,7 +980,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: RebuildQuery,
> headers
-> ) -> RebuildWebscriptSyncResponseV2
+> ) -> RebuildWebscriptSyncResponseV2 \| RebuildWebscriptAsyncResponseV2
Rebuild Webscript
@@ -1002,20 +1035,23 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['dryRun']** | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, checks whether rebuild jobs are needed, but do not start any jobs. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['upgrade']** | [**RebuildPolicy**](.md) | query parameter `"upgrade"` | If set, force a rebuild with the given <em>runtime</em> version selection policy. <ul> <li><code>same</code> <b>patch</b> version. This should only include backward compatible upgrades. </li> <li><code>minor</code> <b>major</b> version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .</li> </ul> | [optional]
-**query['forceVersion']** | **str** | query parameter `"forceVersion"` | If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter. | [optional]
-**query['ignoreChecks']** | **bool** | query parameter `"ignoreChecks"` | If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option | [optional]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
-**query['skipRebuild']** | **bool** | query parameter `"skipRebuild"` | If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['dryRun']** (dict)
**query.dry_run** (Query) | **bool** | query parameter `"dryRun"` | If set to <code>true</code>, checks whether rebuild jobs are needed, but do not start any jobs. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['upgrade']** (dict)
**query.upgrade** (Query) | [**RebuildPolicy**](.md) | query parameter `"upgrade"` | If set, force a rebuild with the given <em>runtime</em> version selection policy. <ul> <li><code>same</code> <b>patch</b> version. This should only include backward compatible upgrades. </li> <li><code>minor</code> <b>major</b> version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .</li> </ul> | [optional]
+**query['forceVersion']** (dict)
**query.force_version** (Query) | **str** | query parameter `"forceVersion"` | If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter. | [optional]
+**query['ignoreChecks']** (dict)
**query.ignore_checks** (Query) | **bool** | query parameter `"ignoreChecks"` | If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option | [optional]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
+**query['skipRebuild']** (dict)
**query.skip_rebuild** (Query) | **bool** | query parameter `"skipRebuild"` | If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**RebuildWebscriptSyncResponseV2**](RebuildWebscriptSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`RebuildWebscriptSyncResponseV2 \| RebuildWebscriptAsyncResponseV2`** | | [RebuildWebscriptSyncResponseV2](RebuildWebscriptSyncResponseV2.md)
[RebuildWebscriptAsyncResponseV2](RebuildWebscriptAsyncResponseV2.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.
### HTTP request headers
@@ -1037,7 +1073,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: RemoveVersionQuery,
> headers
-> ) -> UndeployedResponseV2
+> ) -> UndeployedResponseV2 \| UndeploySubmittedResponseV2
Remove Webscript Version
@@ -1087,16 +1123,19 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['force']** | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
-**query['undeploy']** | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['force']** (dict)
**query.force** (Query) | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
+**query['undeploy']** (dict)
**query.undeploy** (Query) | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**UndeployedResponseV2**](UndeployedResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`UndeployedResponseV2 \| UndeploySubmittedResponseV2`** | | [UndeployedResponseV2](UndeployedResponseV2.md)
[UndeploySubmittedResponseV2](UndeploySubmittedResponseV2.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.
### HTTP request headers
@@ -1117,7 +1156,7 @@ Name | Type | API binding | Description | Notes
> name: str,
> query: RemoveVersionsQuery,
> headers
-> ) -> UndeployedResponseV2
+> ) -> UndeployedResponseV2 \| UndeploySubmittedResponseV2
Remove Webscript
@@ -1165,16 +1204,19 @@ Name | Type | API binding | Description | Notes
-------- | ----- | ------------- | ------------- | -------------
**name** | **str** | path parameter `"name"` | The name of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['force']** | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
-**query['undeploy']** | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['force']** (dict)
**query.force** (Query) | **bool** | query parameter `"force"` | If <code>true</code>, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_. | [optional]
+**query['undeploy']** (dict)
**query.undeploy** (Query) | **bool** | query parameter `"undeploy"` | If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**UndeployedResponseV2**](UndeployedResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`UndeployedResponseV2 \| UndeploySubmittedResponseV2`** | | [UndeployedResponseV2](UndeployedResponseV2.md)
[UndeploySubmittedResponseV2](UndeploySubmittedResponseV2.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.
### HTTP request headers
@@ -1197,7 +1239,7 @@ Name | Type | API binding | Description | Notes
> wildcard: str,
> query: UpdateAssetQuery,
> headers
-> ) -> PostWebscriptJobSyncResponseV2
+> ) -> PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2
Update Webscript Asset
@@ -1235,7 +1277,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives:
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.webscript_functions.update_asset:\n")
@@ -1257,16 +1299,19 @@ Name | Type | API binding | Description | Notes
**wildcard** | **str** | path parameter `"wildcard"` | Full path or path prefix of the asset within the archive |
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | A single asset file. | [optional]
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`
### Return type
-
-[**PostWebscriptJobSyncResponseV2**](PostWebscriptJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2`** | | [PostWebscriptJobSyncResponseV2](PostWebscriptJobSyncResponseV2.md)
[PostWebscriptJobAsyncResponseV2](PostWebscriptJobAsyncResponseV2.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.
### HTTP request headers
@@ -1289,7 +1334,7 @@ Name | Type | API binding | Description | Notes
> query: UpdateAssetsQuery,
> files,
> headers
-> ) -> PostWebscriptJobSyncResponseV2
+> ) -> PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2
Update Webscript Assets
@@ -1326,7 +1371,7 @@ try:
# this operation supports multiple request content types: use `headers` to specify the one used
# alternatives: 'application/tar+gzip', 'application/x-gzip', 'application/x-tar', 'application/gzip', 'multipart/form-data',
headers = {
- 'content-type': 'application/octet-stream',
+ 'content-type': 'application/octet-stream'
},
)
print("The response of registry.webscript_functions.update_assets:\n")
@@ -1348,16 +1393,19 @@ Name | Type | API binding | Description | Notes
**content** | **[ContentRequest](Operation.md#req_arg_content)** | binary request body | The assets for a <em>webscript</em> function can be provided as either <ul> <li>a single <em>tar</em> archive (optionally compressed), with one of the content types <code>application/octet-stream</code>, <code>application/tar+gzip</code>, <code>application/x-gzip</code>, <code>application/x-tar</code>, <code>application/gzip</code></li> <li>separate files in a <code>multipart/form-data</code> request</li> </ul> The provided assets will be added to the <em>webscript</em> function's collection of existing assets, replacing any existing assets with the same name. Please note that it is not allowed to update the webscript.json</code> json file with a changed value for any of the <code>name</code>, <code>version</code> and/or <code>runtime</code> attributes. For each <em>runtime</em> other files are supported. | [optional]
**files** | **[FileTypes](Operation.md#req_arg_files)** | request body files | |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['chown']** | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['chown']** (dict)
**query.chown** (Query) | **bool** | query parameter `"chown"` | If set, ownership of the draft function is transferred to the current user. | [default False]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
**headers['content-type']** | **str** | content type | request header `"content-type"` | should match mediaType `application/octet-stream`, `application/tar+gzip`, `application/x-gzip`, `application/x-tar`, `application/gzip`, `multipart/form-data`
### Return type
-
-[**PostWebscriptJobSyncResponseV2**](PostWebscriptJobSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`PostWebscriptJobSyncResponseV2 \| PostWebscriptJobAsyncResponseV2`** | | [PostWebscriptJobSyncResponseV2](PostWebscriptJobSyncResponseV2.md)
[PostWebscriptJobAsyncResponseV2](PostWebscriptJobAsyncResponseV2.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.
### HTTP request headers
@@ -1379,7 +1427,7 @@ Name | Type | API binding | Description | Notes
> version: str,
> query: VerifyQuery,
> headers
-> ) -> VerifyWebscriptSyncResponseV2
+> ) -> VerifyWebscriptSyncResponseV2 \| PostWebscriptJobAsyncResponseV2
Verify Health Of Webscript
@@ -1428,15 +1476,18 @@ Name | Type | API binding | Description | Notes
**name** | **str** | path parameter `"name"` | The name of the function. |
**version** | **str** | path parameter `"version"` | The version of the function. |
**query** | [QueryParamTypes](Operation.md#req_arg_query) \| **None** | URL query parameter | |
-**query['comment']** | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
-**query['async']** | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
-**query['scaleToZero']** | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
+**query['comment']** (dict)
**query.comment** (Query) | **str** | query parameter `"comment"` | An optional user-specified comment corresponding to the operation. | [optional]
+**query['async']** (dict)
**query.var_async** (Query) | **bool** | query parameter `"async"` | Unless this is set to <code>false</code>, the server will start the required job actions asynchronously and return a <code>202</code> <em>Accepted</em> response. If <code>false</code> the request will block until the job actions are completed, or a timeout occurs. | [optional] [default True]
+**query['scaleToZero']** (dict)
**query.scale_to_zero** (Query) | **bool** | query parameter `"scaleToZero"` | Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command. | [optional]
**headers** | [HeaderTypes](Operation.md#req_headers) | request headers | |
### Return type
-
-[**VerifyWebscriptSyncResponseV2**](VerifyWebscriptSyncResponseV2.md)
+Selected path param | Raw response param | Return Type | Description | Links
+------------------- | ------------------ | ------------ | ----------- | -----
+Literal[""] _(default)_ | False _(default)_ | **`VerifyWebscriptSyncResponseV2 \| PostWebscriptJobAsyncResponseV2`** | | [VerifyWebscriptSyncResponseV2](VerifyWebscriptSyncResponseV2.md)
[PostWebscriptJobAsyncResponseV2](PostWebscriptJobAsyncResponseV2.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.
### HTTP request headers
diff --git a/pyproject.toml b/pyproject.toml
index c31b9ed0..807ed056 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -57,6 +57,8 @@ include = ["pyproject.toml", "test/**/*.py"]
ignore-init-module-imports = true
# allow duplicate imports
ignore=["F811"]
+# https://docs.astral.sh/ruff/rules
+select=["UP007"] # convert Union to | (pep-604)
[tool.ruff.lint.per-file-ignores]
# do not touch imports here
diff --git a/requirements.txt b/requirements.txt
index 1bcee16b..a1410d48 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
pydantic ~= 2.6
typing-extensions ~= 4.9
-waylay-sdk@git+https://github.com/waylayio/waylay-py-core@40c7f6af0c20697d38fa66acc549177514691ebe
+waylay-sdk@git+https://github.com/waylayio/waylay-py-core@cbd7a7a7126c4f9f217238445855cf4ec251ea23
diff --git a/test/api/default_api_test.py b/test/api/default_api_test.py
index 97250c63..f3af9f5e 100644
--- a/test/api/default_api_test.py
+++ b/test/api/default_api_test.py
@@ -9,11 +9,16 @@
"""
import pytest
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
+from urllib.parse import quote
from waylay.sdk import ApiClient, WaylayClient
from waylay.sdk.api._models import Model
@@ -66,7 +71,7 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
kwargs = {}
_get_set_mock_response(httpx_mock, gateway_url)
resp = await service.default.get(**kwargs)
- check_type(resp, RootPageResponse)
+ check_type(resp, Union[RootPageResponse,])
@pytest.mark.asyncio
diff --git a/test/api/jobs_api_test.py b/test/api/jobs_api_test.py
index d6789574..3b3cca96 100644
--- a/test/api/jobs_api_test.py
+++ b/test/api/jobs_api_test.py
@@ -9,10 +9,14 @@
"""
import pytest
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
from urllib.parse import quote
@@ -21,12 +25,22 @@
from waylay.services.registry.api import JobsApi
from waylay.services.registry.service import RegistryService
+from ..types.job_type_stub import JobTypeStub
from ..types.event_with_close_sse_stub import EventWithCloseSSEStub
+from ..types.job_type_stub import JobTypeStub
from ..types.job_response_stub import JobResponseStub
+from ..types.job_type_schema_stub import JobTypeSchemaStub
+
+
+from ..types.job_state_result_stub import JobStateResultStub
+
+
+from ..types.function_type_stub import FunctionTypeStub
+
from ..types.timestamp_spec_stub import TimestampSpecStub
@@ -36,8 +50,12 @@
try:
+ from waylay.services.registry.queries.jobs_api import EventsQuery
from waylay.services.registry.models import EventWithCloseSSE
+
from waylay.services.registry.models import JobResponse
+
+ from waylay.services.registry.queries.jobs_api import ListQuery
from waylay.services.registry.models import JobsResponse
MODELS_AVAILABLE = find_spec("waylay.services.registry.models") is not None
@@ -80,15 +98,16 @@ async def test_events(
"""
# set path params
kwargs = {
- "query": {
- "type": "build",
- "id": "id_example",
- "children": True,
- },
+ # optionally use EventsQuery to validate and reuse parameters
+ "query": EventsQuery(
+ type="build",
+ id="id_example",
+ children=True,
+ ),
}
_events_set_mock_response(httpx_mock, gateway_url)
resp = await service.jobs.events(**kwargs)
- check_type(resp, EventWithCloseSSE)
+ check_type(resp, Union[EventWithCloseSSE,])
@pytest.mark.asyncio
@@ -137,7 +156,7 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
kwargs = {}
_get_set_mock_response(httpx_mock, gateway_url, quote(str(type)), quote(str(id)))
resp = await service.jobs.get(type, id, **kwargs)
- check_type(resp, JobResponse)
+ check_type(resp, Union[JobResponse,])
@pytest.mark.asyncio
@@ -178,18 +197,19 @@ async def test_list(service: RegistryService, gateway_url: str, httpx_mock: HTTP
"""
# set path params
kwargs = {
- "query": {
- "limit": 3.4,
- "type": [],
- "state": [],
- "functionType": [],
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- },
+ # optionally use ListQuery to validate and reuse parameters
+ "query": ListQuery(
+ limit=3.4,
+ type=[],
+ state=[],
+ function_type=[],
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ ),
}
_list_set_mock_response(httpx_mock, gateway_url)
resp = await service.jobs.list(**kwargs)
- check_type(resp, JobsResponse)
+ check_type(resp, Union[JobsResponse,])
@pytest.mark.asyncio
diff --git a/test/api/model_functions_api_test.py b/test/api/model_functions_api_test.py
index 2155a14f..66484f8c 100644
--- a/test/api/model_functions_api_test.py
+++ b/test/api/model_functions_api_test.py
@@ -9,10 +9,14 @@
"""
import pytest
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
from urllib.parse import quote
@@ -21,19 +25,37 @@
from waylay.services.registry.api import ModelFunctionsApi
from waylay.services.registry.service import RegistryService
+from ..types.deprecate_previous_policy_stub import DeprecatePreviousPolicyStub
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
+from ..types.multipart_file_upload_stub import MultipartFileUploadStub
from ..types.post_model_job_sync_response_v2_stub import PostModelJobSyncResponseV2Stub
+from ..types.post_model_job_async_response_v2_stub import (
+ PostModelJobAsyncResponseV2Stub,
+)
+
from ..types.post_model_job_sync_response_v2_stub import PostModelJobSyncResponseV2Stub
+from ..types.post_model_job_async_response_v2_stub import (
+ PostModelJobAsyncResponseV2Stub,
+)
+
from ..types.get_model_response_v2_stub import GetModelResponseV2Stub
from ..types.get_model_response_v2_stub import GetModelResponseV2Stub
+from ..types.job_type_schema_stub import JobTypeSchemaStub
+
+
+from ..types.job_state_result_stub import JobStateResultStub
+
+
+from ..types.function_type_stub import FunctionTypeStub
+
from ..types.timestamp_spec_stub import TimestampSpecStub
@@ -42,6 +64,9 @@
from ..types.jobs_for_model_response_v2_stub import JobsForModelResponseV2Stub
+from ..types.status_filter_stub import StatusFilterStub
+
+
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
from ..types.timestamp_spec_stub import TimestampSpecStub
@@ -52,9 +77,13 @@
from ..types.timestamp_spec_stub import TimestampSpecStub
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.latest_models_response_v2_stub import LatestModelsResponseV2Stub
+from ..types.status_filter_stub import StatusFilterStub
+
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
@@ -66,6 +95,8 @@
from ..types.timestamp_spec_stub import TimestampSpecStub
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.model_versions_response_v2_stub import ModelVersionsResponseV2Stub
@@ -73,43 +104,118 @@
from ..types.get_model_response_v2_stub import GetModelResponseV2Stub
+from ..types.deprecate_previous_policy_stub import DeprecatePreviousPolicyStub
from ..types.post_model_job_sync_response_v2_stub import PostModelJobSyncResponseV2Stub
+from ..types.post_model_job_async_response_v2_stub import (
+ PostModelJobAsyncResponseV2Stub,
+)
+
+from ..types.rebuild_policy_stub import RebuildPolicyStub
from ..types.rebuild_model_sync_response_v2_stub import RebuildModelSyncResponseV2Stub
+from ..types.rebuild_model_async_response_v2_stub import RebuildModelAsyncResponseV2Stub
+
from ..types.undeployed_response_v2_stub import UndeployedResponseV2Stub
+from ..types.undeploy_submitted_response_v2_stub import UndeploySubmittedResponseV2Stub
+
from ..types.undeployed_response_v2_stub import UndeployedResponseV2Stub
+from ..types.undeploy_submitted_response_v2_stub import UndeploySubmittedResponseV2Stub
+
+from ..types.file_upload_stub import FileUploadStub
from ..types.post_model_job_sync_response_v2_stub import PostModelJobSyncResponseV2Stub
+from ..types.post_model_job_async_response_v2_stub import (
+ PostModelJobAsyncResponseV2Stub,
+)
+
+from ..types.multipart_file_upload_stub import MultipartFileUploadStub
from ..types.post_model_job_sync_response_v2_stub import PostModelJobSyncResponseV2Stub
+from ..types.post_model_job_async_response_v2_stub import (
+ PostModelJobAsyncResponseV2Stub,
+)
+
from ..types.verify_model_sync_response_v2_stub import VerifyModelSyncResponseV2Stub
+from ..types.post_model_job_async_response_v2_stub import (
+ PostModelJobAsyncResponseV2Stub,
+)
+
try:
+ from waylay.services.registry.queries.model_functions_api import CreateQuery
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
+ from waylay.services.registry.models import PostModelJobAsyncResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import DeleteAssetQuery
from waylay.services.registry.models import PostModelJobSyncResponseV2
+ from waylay.services.registry.models import PostModelJobAsyncResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import GetArchiveQuery
+
+ from waylay.services.registry.queries.model_functions_api import GetAssetQuery
+
+ from waylay.services.registry.queries.model_functions_api import GetLatestQuery
from waylay.services.registry.models import GetModelResponseV2
+
from waylay.services.registry.models import GetModelResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import JobsQuery
from waylay.services.registry.models import JobsForModelResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import ListQuery
from waylay.services.registry.models import LatestModelsResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import ListVersionsQuery
from waylay.services.registry.models import ModelVersionsResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import PatchMetadataQuery
from waylay.services.registry.models import GetModelResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import PublishQuery
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
+ from waylay.services.registry.models import PostModelJobAsyncResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import RebuildQuery
from waylay.services.registry.models import RebuildModelSyncResponseV2
+
+ from waylay.services.registry.models import RebuildModelAsyncResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import RemoveVersionQuery
from waylay.services.registry.models import UndeployedResponseV2
+
+ from waylay.services.registry.models import UndeploySubmittedResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import RemoveVersionsQuery
from waylay.services.registry.models import UndeployedResponseV2
+
+ from waylay.services.registry.models import UndeploySubmittedResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import UpdateAssetQuery
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
+ from waylay.services.registry.models import PostModelJobAsyncResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import UpdateAssetsQuery
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
+ from waylay.services.registry.models import PostModelJobAsyncResponseV2
+
+ from waylay.services.registry.queries.model_functions_api import VerifyQuery
from waylay.services.registry.models import VerifyModelSyncResponseV2
+ from waylay.services.registry.models import PostModelJobAsyncResponseV2
+
MODELS_AVAILABLE = find_spec("waylay.services.registry.models") is not None
except ImportError:
MODELS_AVAILABLE = False
@@ -150,15 +256,16 @@ async def test_create(
"""
# set path params
kwargs = {
- "query": {
- "deprecatePrevious": "none",
- "dryRun": True,
- "async": True,
- "scaleToZero": False,
- "version": SemanticVersionRangeStub.create_json(),
- "name": "name_example",
- "draft": False,
- },
+ # optionally use CreateQuery to validate and reuse parameters
+ "query": CreateQuery(
+ deprecate_previous="none",
+ dry_run=True,
+ var_async=True,
+ scale_to_zero=False,
+ version=SemanticVersionRangeStub.create_json(),
+ name="name_example",
+ draft=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
"files": {
@@ -168,7 +275,13 @@ async def test_create(
}
_create_set_mock_response(httpx_mock, gateway_url)
resp = await service.model_functions.create(**kwargs)
- check_type(resp, PostModelJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostModelJobSyncResponseV2,
+ PostModelJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -233,11 +346,12 @@ async def test_delete_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use DeleteAssetQuery to validate and reuse parameters
+ "query": DeleteAssetQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
}
_delete_asset_set_mock_response(
httpx_mock,
@@ -247,7 +361,13 @@ async def test_delete_asset(
quote(str(wildcard)),
)
resp = await service.model_functions.delete_asset(name, version, wildcard, **kwargs)
- check_type(resp, PostModelJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostModelJobSyncResponseV2,
+ PostModelJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -312,9 +432,10 @@ async def test_get_archive(
version = "version_example"
kwargs = {
- "query": {
- "ls": False,
- },
+ # optionally use GetArchiveQuery to validate and reuse parameters
+ "query": GetArchiveQuery(
+ ls=False,
+ ),
}
_get_archive_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
@@ -379,9 +500,10 @@ async def test_get_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "ls": False,
- },
+ # optionally use GetAssetQuery to validate and reuse parameters
+ "query": GetAssetQuery(
+ ls=False,
+ ),
}
_get_asset_set_mock_response(
httpx_mock,
@@ -448,14 +570,15 @@ async def test_get_latest(
name = "name_example"
kwargs = {
- "query": {
- "includeDraft": True,
- "includeDeprecated": True,
- },
+ # optionally use GetLatestQuery to validate and reuse parameters
+ "query": GetLatestQuery(
+ include_draft=True,
+ include_deprecated=True,
+ ),
}
_get_latest_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.model_functions.get_latest(name, **kwargs)
- check_type(resp, GetModelResponseV2)
+ check_type(resp, Union[GetModelResponseV2,])
@pytest.mark.asyncio
@@ -511,7 +634,7 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.get(name, version, **kwargs)
- check_type(resp, GetModelResponseV2)
+ check_type(resp, Union[GetModelResponseV2,])
@pytest.mark.asyncio
@@ -562,20 +685,21 @@ async def test_jobs(service: RegistryService, gateway_url: str, httpx_mock: HTTP
version = "version_example"
kwargs = {
- "query": {
- "limit": 3.4,
- "type": [],
- "state": [],
- "functionType": [],
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- },
+ # optionally use JobsQuery to validate and reuse parameters
+ "query": JobsQuery(
+ limit=3.4,
+ type=[],
+ state=[],
+ function_type=[],
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ ),
}
_jobs_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.jobs(name, version, **kwargs)
- check_type(resp, JobsForModelResponseV2)
+ check_type(resp, Union[JobsForModelResponseV2,])
@pytest.mark.asyncio
@@ -627,32 +751,33 @@ async def test_list(service: RegistryService, gateway_url: str, httpx_mock: HTTP
"""
# set path params
kwargs = {
- "query": {
- "limit": 3.4,
- "page": 3.4,
- "includeDraft": True,
- "includeDeprecated": True,
- "deprecated": True,
- "draft": True,
- "nameVersion": [],
- "version": "version_example",
- "status": [],
- "runtimeVersion": SemanticVersionRangeStub.create_json(),
- "createdBy": "@me",
- "updatedBy": "@me",
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- "updatedBefore": TimestampSpecStub.create_json(),
- "updatedAfter": TimestampSpecStub.create_json(),
- "name": "name_example",
- "archiveFormat": [],
- "runtime": [],
- "latest": True,
- },
+ # optionally use ListQuery to validate and reuse parameters
+ "query": ListQuery(
+ limit=3.4,
+ page=3.4,
+ include_draft=True,
+ include_deprecated=True,
+ deprecated=True,
+ draft=True,
+ name_version=[],
+ version="version_example",
+ status=[],
+ runtime_version=SemanticVersionRangeStub.create_json(),
+ created_by="@me",
+ updated_by="@me",
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ updated_before=TimestampSpecStub.create_json(),
+ updated_after=TimestampSpecStub.create_json(),
+ name="name_example",
+ archive_format=[],
+ runtime=[],
+ latest=True,
+ ),
}
_list_set_mock_response(httpx_mock, gateway_url)
resp = await service.model_functions.list(**kwargs)
- check_type(resp, LatestModelsResponseV2)
+ check_type(resp, Union[LatestModelsResponseV2,])
@pytest.mark.asyncio
@@ -718,27 +843,28 @@ async def test_list_versions(
name = "name_example"
kwargs = {
- "query": {
- "limit": 3.4,
- "page": 3.4,
- "deprecated": True,
- "draft": True,
- "version": "version_example",
- "status": [],
- "runtimeVersion": SemanticVersionRangeStub.create_json(),
- "createdBy": "@me",
- "updatedBy": "@me",
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- "updatedBefore": TimestampSpecStub.create_json(),
- "updatedAfter": TimestampSpecStub.create_json(),
- "archiveFormat": [],
- "runtime": [],
- },
+ # optionally use ListVersionsQuery to validate and reuse parameters
+ "query": ListVersionsQuery(
+ limit=3.4,
+ page=3.4,
+ deprecated=True,
+ draft=True,
+ version="version_example",
+ status=[],
+ runtime_version=SemanticVersionRangeStub.create_json(),
+ created_by="@me",
+ updated_by="@me",
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ updated_before=TimestampSpecStub.create_json(),
+ updated_after=TimestampSpecStub.create_json(),
+ archive_format=[],
+ runtime=[],
+ ),
}
_list_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.model_functions.list_versions(name, **kwargs)
- check_type(resp, ModelVersionsResponseV2)
+ check_type(resp, Union[ModelVersionsResponseV2,])
@pytest.mark.asyncio
@@ -805,16 +931,17 @@ async def test_patch_metadata(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- },
+ # optionally use PatchMetadataQuery to validate and reuse parameters
+ "query": PatchMetadataQuery(
+ comment="comment_example",
+ ),
"json": FunctionMetaStub.create_instance(),
}
_patch_metadata_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.patch_metadata(name, version, **kwargs)
- check_type(resp, GetModelResponseV2)
+ check_type(resp, Union[GetModelResponseV2,])
@pytest.mark.asyncio
@@ -872,17 +999,24 @@ async def test_publish(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "deprecatePrevious": "none",
- "async": True,
- },
+ # optionally use PublishQuery to validate and reuse parameters
+ "query": PublishQuery(
+ comment="comment_example",
+ deprecate_previous="none",
+ var_async=True,
+ ),
}
_publish_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.publish(name, version, **kwargs)
- check_type(resp, PostModelJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostModelJobSyncResponseV2,
+ PostModelJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -941,22 +1075,29 @@ async def test_rebuild(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "dryRun": True,
- "async": True,
- "upgrade": "patch",
- "forceVersion": "force_version_example",
- "ignoreChecks": True,
- "scaleToZero": True,
- "skipRebuild": True,
- },
+ # optionally use RebuildQuery to validate and reuse parameters
+ "query": RebuildQuery(
+ comment="comment_example",
+ dry_run=True,
+ var_async=True,
+ upgrade="patch",
+ force_version="force_version_example",
+ ignore_checks=True,
+ scale_to_zero=True,
+ skip_rebuild=True,
+ ),
}
_rebuild_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.rebuild(name, version, **kwargs)
- check_type(resp, RebuildModelSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ RebuildModelSyncResponseV2,
+ RebuildModelAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1020,18 +1161,25 @@ async def test_remove_version(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "force": True,
- "undeploy": True,
- },
+ # optionally use RemoveVersionQuery to validate and reuse parameters
+ "query": RemoveVersionQuery(
+ comment="comment_example",
+ var_async=True,
+ force=True,
+ undeploy=True,
+ ),
}
_remove_version_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.remove_version(name, version, **kwargs)
- check_type(resp, UndeployedResponseV2)
+ check_type(
+ resp,
+ Union[
+ UndeployedResponseV2,
+ UndeploySubmittedResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1087,16 +1235,23 @@ async def test_remove_versions(
name = "name_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "force": True,
- "undeploy": True,
- "async": True,
- },
+ # optionally use RemoveVersionsQuery to validate and reuse parameters
+ "query": RemoveVersionsQuery(
+ comment="comment_example",
+ force=True,
+ undeploy=True,
+ var_async=True,
+ ),
}
_remove_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.model_functions.remove_versions(name, **kwargs)
- check_type(resp, UndeployedResponseV2)
+ check_type(
+ resp,
+ Union[
+ UndeployedResponseV2,
+ UndeploySubmittedResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1154,11 +1309,12 @@ async def test_update_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use UpdateAssetQuery to validate and reuse parameters
+ "query": UpdateAssetQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
}
@@ -1170,7 +1326,13 @@ async def test_update_asset(
quote(str(wildcard)),
)
resp = await service.model_functions.update_asset(name, version, wildcard, **kwargs)
- check_type(resp, PostModelJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostModelJobSyncResponseV2,
+ PostModelJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1237,11 +1399,12 @@ async def test_update_assets(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use UpdateAssetsQuery to validate and reuse parameters
+ "query": UpdateAssetsQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
"files": {
@@ -1253,7 +1416,13 @@ async def test_update_assets(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.update_assets(name, version, **kwargs)
- check_type(resp, PostModelJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostModelJobSyncResponseV2,
+ PostModelJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1318,17 +1487,24 @@ async def test_verify(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "scaleToZero": True,
- },
+ # optionally use VerifyQuery to validate and reuse parameters
+ "query": VerifyQuery(
+ comment="comment_example",
+ var_async=True,
+ scale_to_zero=True,
+ ),
}
_verify_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.model_functions.verify(name, version, **kwargs)
- check_type(resp, VerifyModelSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ VerifyModelSyncResponseV2,
+ PostModelJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
diff --git a/test/api/plug_functions_api_test.py b/test/api/plug_functions_api_test.py
index 62c68475..33f11410 100644
--- a/test/api/plug_functions_api_test.py
+++ b/test/api/plug_functions_api_test.py
@@ -9,10 +9,14 @@
"""
import pytest
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
from urllib.parse import quote
@@ -21,19 +25,35 @@
from waylay.services.registry.api import PlugFunctionsApi
from waylay.services.registry.service import RegistryService
+from ..types.deprecate_previous_policy_stub import DeprecatePreviousPolicyStub
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
+from ..types.multipart_file_upload_stub import MultipartFileUploadStub
from ..types.post_plug_job_sync_response_v2_stub import PostPlugJobSyncResponseV2Stub
+from ..types.post_plug_job_async_response_v2_stub import PostPlugJobAsyncResponseV2Stub
+
from ..types.post_plug_job_sync_response_v2_stub import PostPlugJobSyncResponseV2Stub
+from ..types.post_plug_job_async_response_v2_stub import PostPlugJobAsyncResponseV2Stub
+
+
+from ..types.plug_type_stub import PlugTypeStub
from ..types.get_plug_response_v2_stub import GetPlugResponseV2Stub
from ..types.get_plug_response_v2_stub import GetPlugResponseV2Stub
+from ..types.job_type_schema_stub import JobTypeSchemaStub
+
+
+from ..types.job_state_result_stub import JobStateResultStub
+
+
+from ..types.function_type_stub import FunctionTypeStub
+
from ..types.timestamp_spec_stub import TimestampSpecStub
@@ -43,6 +63,11 @@
from ..types.tags_filter_stub import TagsFilterStub
+from ..types.plug_type_stub import PlugTypeStub
+
+
+from ..types.status_filter_stub import StatusFilterStub
+
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
@@ -54,11 +79,15 @@
from ..types.timestamp_spec_stub import TimestampSpecStub
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.latest_plugs_response_v2_stub import LatestPlugsResponseV2Stub
from ..types.tags_filter_stub import TagsFilterStub
+from ..types.status_filter_stub import StatusFilterStub
+
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
@@ -70,6 +99,8 @@
from ..types.timestamp_spec_stub import TimestampSpecStub
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.plug_versions_response_v2_stub import PlugVersionsResponseV2Stub
@@ -81,44 +112,113 @@
from ..types.get_plug_response_v2_stub import GetPlugResponseV2Stub
+from ..types.deprecate_previous_policy_stub import DeprecatePreviousPolicyStub
from ..types.post_plug_job_sync_response_v2_stub import PostPlugJobSyncResponseV2Stub
+from ..types.post_plug_job_async_response_v2_stub import PostPlugJobAsyncResponseV2Stub
+
+from ..types.rebuild_policy_stub import RebuildPolicyStub
from ..types.rebuild_plug_sync_response_v2_stub import RebuildPlugSyncResponseV2Stub
+from ..types.rebuild_plug_async_response_v2_stub import RebuildPlugAsyncResponseV2Stub
+
from ..types.undeployed_response_v2_stub import UndeployedResponseV2Stub
+from ..types.undeploy_submitted_response_v2_stub import UndeploySubmittedResponseV2Stub
+
from ..types.undeployed_response_v2_stub import UndeployedResponseV2Stub
+from ..types.undeploy_submitted_response_v2_stub import UndeploySubmittedResponseV2Stub
+
+from ..types.file_upload_stub import FileUploadStub
from ..types.post_plug_job_sync_response_v2_stub import PostPlugJobSyncResponseV2Stub
+from ..types.post_plug_job_async_response_v2_stub import PostPlugJobAsyncResponseV2Stub
+
+from ..types.multipart_file_upload_stub import MultipartFileUploadStub
from ..types.post_plug_job_sync_response_v2_stub import PostPlugJobSyncResponseV2Stub
+from ..types.post_plug_job_async_response_v2_stub import PostPlugJobAsyncResponseV2Stub
+
from ..types.verify_plug_sync_response_v2_stub import VerifyPlugSyncResponseV2Stub
+from ..types.post_plug_job_async_response_v2_stub import PostPlugJobAsyncResponseV2Stub
+
try:
+ from waylay.services.registry.queries.plug_functions_api import CreateQuery
from waylay.services.registry.models import PostPlugJobSyncResponseV2
+
+ from waylay.services.registry.models import PostPlugJobAsyncResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import DeleteAssetQuery
from waylay.services.registry.models import PostPlugJobSyncResponseV2
+ from waylay.services.registry.models import PostPlugJobAsyncResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import GetArchiveQuery
+
+ from waylay.services.registry.queries.plug_functions_api import GetAssetQuery
+
+ from waylay.services.registry.queries.plug_functions_api import GetLatestQuery
from waylay.services.registry.models import GetPlugResponseV2
+
from waylay.services.registry.models import GetPlugResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import JobsQuery
from waylay.services.registry.models import JobsForPlugResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import ListQuery
from waylay.services.registry.models import LatestPlugsResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import ListVersionsQuery
from waylay.services.registry.models import PlugVersionsResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import PatchInterfaceQuery
from waylay.services.registry.models import GetPlugResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import PatchMetadataQuery
from waylay.services.registry.models import GetPlugResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import PublishQuery
from waylay.services.registry.models import PostPlugJobSyncResponseV2
+
+ from waylay.services.registry.models import PostPlugJobAsyncResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import RebuildQuery
from waylay.services.registry.models import RebuildPlugSyncResponseV2
+
+ from waylay.services.registry.models import RebuildPlugAsyncResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import RemoveVersionQuery
from waylay.services.registry.models import UndeployedResponseV2
+
+ from waylay.services.registry.models import UndeploySubmittedResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import RemoveVersionsQuery
from waylay.services.registry.models import UndeployedResponseV2
+
+ from waylay.services.registry.models import UndeploySubmittedResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import UpdateAssetQuery
from waylay.services.registry.models import PostPlugJobSyncResponseV2
+
+ from waylay.services.registry.models import PostPlugJobAsyncResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import UpdateAssetsQuery
from waylay.services.registry.models import PostPlugJobSyncResponseV2
+
+ from waylay.services.registry.models import PostPlugJobAsyncResponseV2
+
+ from waylay.services.registry.queries.plug_functions_api import VerifyQuery
from waylay.services.registry.models import VerifyPlugSyncResponseV2
+ from waylay.services.registry.models import PostPlugJobAsyncResponseV2
+
MODELS_AVAILABLE = find_spec("waylay.services.registry.models") is not None
except ImportError:
MODELS_AVAILABLE = False
@@ -159,15 +259,16 @@ async def test_create(
"""
# set path params
kwargs = {
- "query": {
- "deprecatePrevious": "none",
- "dryRun": True,
- "async": True,
- "scaleToZero": False,
- "version": SemanticVersionRangeStub.create_json(),
- "name": "name_example",
- "draft": False,
- },
+ # optionally use CreateQuery to validate and reuse parameters
+ "query": CreateQuery(
+ deprecate_previous="none",
+ dry_run=True,
+ var_async=True,
+ scale_to_zero=False,
+ version=SemanticVersionRangeStub.create_json(),
+ name="name_example",
+ draft=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
"files": {
@@ -177,7 +278,13 @@ async def test_create(
}
_create_set_mock_response(httpx_mock, gateway_url)
resp = await service.plug_functions.create(**kwargs)
- check_type(resp, PostPlugJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostPlugJobSyncResponseV2,
+ PostPlugJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -242,11 +349,12 @@ async def test_delete_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use DeleteAssetQuery to validate and reuse parameters
+ "query": DeleteAssetQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
}
_delete_asset_set_mock_response(
httpx_mock,
@@ -256,7 +364,13 @@ async def test_delete_asset(
quote(str(wildcard)),
)
resp = await service.plug_functions.delete_asset(name, version, wildcard, **kwargs)
- check_type(resp, PostPlugJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostPlugJobSyncResponseV2,
+ PostPlugJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -321,9 +435,10 @@ async def test_get_archive(
version = "version_example"
kwargs = {
- "query": {
- "ls": False,
- },
+ # optionally use GetArchiveQuery to validate and reuse parameters
+ "query": GetArchiveQuery(
+ ls=False,
+ ),
}
_get_archive_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
@@ -388,9 +503,10 @@ async def test_get_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "ls": False,
- },
+ # optionally use GetAssetQuery to validate and reuse parameters
+ "query": GetAssetQuery(
+ ls=False,
+ ),
}
_get_asset_set_mock_response(
httpx_mock,
@@ -457,15 +573,16 @@ async def test_get_latest(
name = "name_example"
kwargs = {
- "query": {
- "type": "sensor",
- "includeDraft": True,
- "includeDeprecated": True,
- },
+ # optionally use GetLatestQuery to validate and reuse parameters
+ "query": GetLatestQuery(
+ type="sensor",
+ include_draft=True,
+ include_deprecated=True,
+ ),
}
_get_latest_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.plug_functions.get_latest(name, **kwargs)
- check_type(resp, GetPlugResponseV2)
+ check_type(resp, Union[GetPlugResponseV2,])
@pytest.mark.asyncio
@@ -522,7 +639,7 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.get(name, version, **kwargs)
- check_type(resp, GetPlugResponseV2)
+ check_type(resp, Union[GetPlugResponseV2,])
@pytest.mark.asyncio
@@ -573,20 +690,21 @@ async def test_jobs(service: RegistryService, gateway_url: str, httpx_mock: HTTP
version = "version_example"
kwargs = {
- "query": {
- "limit": 3.4,
- "type": [],
- "state": [],
- "functionType": [],
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- },
+ # optionally use JobsQuery to validate and reuse parameters
+ "query": JobsQuery(
+ limit=3.4,
+ type=[],
+ state=[],
+ function_type=[],
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ ),
}
_jobs_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.jobs(name, version, **kwargs)
- check_type(resp, JobsForPlugResponseV2)
+ check_type(resp, Union[JobsForPlugResponseV2,])
@pytest.mark.asyncio
@@ -638,34 +756,35 @@ async def test_list(service: RegistryService, gateway_url: str, httpx_mock: HTTP
"""
# set path params
kwargs = {
- "query": {
- "tags": TagsFilterStub.create_json(),
- "type": "sensor",
- "limit": 3.4,
- "page": 3.4,
- "includeDraft": True,
- "includeDeprecated": True,
- "deprecated": True,
- "draft": True,
- "nameVersion": [],
- "version": "version_example",
- "status": [],
- "runtimeVersion": SemanticVersionRangeStub.create_json(),
- "createdBy": "@me",
- "updatedBy": "@me",
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- "updatedBefore": TimestampSpecStub.create_json(),
- "updatedAfter": TimestampSpecStub.create_json(),
- "name": "name_example",
- "archiveFormat": [],
- "runtime": [],
- "latest": True,
- },
+ # optionally use ListQuery to validate and reuse parameters
+ "query": ListQuery(
+ tags=TagsFilterStub.create_json(),
+ type="sensor",
+ limit=3.4,
+ page=3.4,
+ include_draft=True,
+ include_deprecated=True,
+ deprecated=True,
+ draft=True,
+ name_version=[],
+ version="version_example",
+ status=[],
+ runtime_version=SemanticVersionRangeStub.create_json(),
+ created_by="@me",
+ updated_by="@me",
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ updated_before=TimestampSpecStub.create_json(),
+ updated_after=TimestampSpecStub.create_json(),
+ name="name_example",
+ archive_format=[],
+ runtime=[],
+ latest=True,
+ ),
}
_list_set_mock_response(httpx_mock, gateway_url)
resp = await service.plug_functions.list(**kwargs)
- check_type(resp, LatestPlugsResponseV2)
+ check_type(resp, Union[LatestPlugsResponseV2,])
@pytest.mark.asyncio
@@ -733,28 +852,29 @@ async def test_list_versions(
name = "name_example"
kwargs = {
- "query": {
- "tags": TagsFilterStub.create_json(),
- "limit": 3.4,
- "page": 3.4,
- "deprecated": True,
- "draft": True,
- "version": "version_example",
- "status": [],
- "runtimeVersion": SemanticVersionRangeStub.create_json(),
- "createdBy": "@me",
- "updatedBy": "@me",
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- "updatedBefore": TimestampSpecStub.create_json(),
- "updatedAfter": TimestampSpecStub.create_json(),
- "archiveFormat": [],
- "runtime": [],
- },
+ # optionally use ListVersionsQuery to validate and reuse parameters
+ "query": ListVersionsQuery(
+ tags=TagsFilterStub.create_json(),
+ limit=3.4,
+ page=3.4,
+ deprecated=True,
+ draft=True,
+ version="version_example",
+ status=[],
+ runtime_version=SemanticVersionRangeStub.create_json(),
+ created_by="@me",
+ updated_by="@me",
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ updated_before=TimestampSpecStub.create_json(),
+ updated_after=TimestampSpecStub.create_json(),
+ archive_format=[],
+ runtime=[],
+ ),
}
_list_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.plug_functions.list_versions(name, **kwargs)
- check_type(resp, PlugVersionsResponseV2)
+ check_type(resp, Union[PlugVersionsResponseV2,])
@pytest.mark.asyncio
@@ -822,16 +942,17 @@ async def test_patch_interface(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- },
+ # optionally use PatchInterfaceQuery to validate and reuse parameters
+ "query": PatchInterfaceQuery(
+ comment="comment_example",
+ ),
"json": DocumentationStub.create_instance(),
}
_patch_interface_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.patch_interface(name, version, **kwargs)
- check_type(resp, GetPlugResponseV2)
+ check_type(resp, Union[GetPlugResponseV2,])
@pytest.mark.asyncio
@@ -889,16 +1010,17 @@ async def test_patch_metadata(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- },
+ # optionally use PatchMetadataQuery to validate and reuse parameters
+ "query": PatchMetadataQuery(
+ comment="comment_example",
+ ),
"json": UpdateMetadataRequestV2Stub.create_instance(),
}
_patch_metadata_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.patch_metadata(name, version, **kwargs)
- check_type(resp, GetPlugResponseV2)
+ check_type(resp, Union[GetPlugResponseV2,])
@pytest.mark.asyncio
@@ -956,17 +1078,24 @@ async def test_publish(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "deprecatePrevious": "none",
- "async": True,
- },
+ # optionally use PublishQuery to validate and reuse parameters
+ "query": PublishQuery(
+ comment="comment_example",
+ deprecate_previous="none",
+ var_async=True,
+ ),
}
_publish_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.publish(name, version, **kwargs)
- check_type(resp, PostPlugJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostPlugJobSyncResponseV2,
+ PostPlugJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1025,22 +1154,29 @@ async def test_rebuild(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "dryRun": True,
- "async": True,
- "upgrade": "patch",
- "forceVersion": "force_version_example",
- "ignoreChecks": True,
- "scaleToZero": True,
- "skipRebuild": True,
- },
+ # optionally use RebuildQuery to validate and reuse parameters
+ "query": RebuildQuery(
+ comment="comment_example",
+ dry_run=True,
+ var_async=True,
+ upgrade="patch",
+ force_version="force_version_example",
+ ignore_checks=True,
+ scale_to_zero=True,
+ skip_rebuild=True,
+ ),
}
_rebuild_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.rebuild(name, version, **kwargs)
- check_type(resp, RebuildPlugSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ RebuildPlugSyncResponseV2,
+ RebuildPlugAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1104,18 +1240,25 @@ async def test_remove_version(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "force": True,
- "undeploy": True,
- },
+ # optionally use RemoveVersionQuery to validate and reuse parameters
+ "query": RemoveVersionQuery(
+ comment="comment_example",
+ var_async=True,
+ force=True,
+ undeploy=True,
+ ),
}
_remove_version_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.remove_version(name, version, **kwargs)
- check_type(resp, UndeployedResponseV2)
+ check_type(
+ resp,
+ Union[
+ UndeployedResponseV2,
+ UndeploySubmittedResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1171,16 +1314,23 @@ async def test_remove_versions(
name = "name_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "force": True,
- "undeploy": True,
- },
+ # optionally use RemoveVersionsQuery to validate and reuse parameters
+ "query": RemoveVersionsQuery(
+ comment="comment_example",
+ var_async=True,
+ force=True,
+ undeploy=True,
+ ),
}
_remove_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.plug_functions.remove_versions(name, **kwargs)
- check_type(resp, UndeployedResponseV2)
+ check_type(
+ resp,
+ Union[
+ UndeployedResponseV2,
+ UndeploySubmittedResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1238,11 +1388,12 @@ async def test_update_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use UpdateAssetQuery to validate and reuse parameters
+ "query": UpdateAssetQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
}
@@ -1254,7 +1405,13 @@ async def test_update_asset(
quote(str(wildcard)),
)
resp = await service.plug_functions.update_asset(name, version, wildcard, **kwargs)
- check_type(resp, PostPlugJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostPlugJobSyncResponseV2,
+ PostPlugJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1321,11 +1478,12 @@ async def test_update_assets(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use UpdateAssetsQuery to validate and reuse parameters
+ "query": UpdateAssetsQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
"files": {
@@ -1337,7 +1495,13 @@ async def test_update_assets(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.update_assets(name, version, **kwargs)
- check_type(resp, PostPlugJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostPlugJobSyncResponseV2,
+ PostPlugJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1402,17 +1566,24 @@ async def test_verify(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "scaleToZero": True,
- },
+ # optionally use VerifyQuery to validate and reuse parameters
+ "query": VerifyQuery(
+ comment="comment_example",
+ var_async=True,
+ scale_to_zero=True,
+ ),
}
_verify_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.plug_functions.verify(name, version, **kwargs)
- check_type(resp, VerifyPlugSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ VerifyPlugSyncResponseV2,
+ PostPlugJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
diff --git a/test/api/runtimes_api_test.py b/test/api/runtimes_api_test.py
index 100312cd..fafd3c3b 100644
--- a/test/api/runtimes_api_test.py
+++ b/test/api/runtimes_api_test.py
@@ -9,10 +9,14 @@
"""
import pytest
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
from urllib.parse import quote
@@ -29,6 +33,11 @@
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
+from ..types.function_type_stub import FunctionTypeStub
+
+
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.runtime_version_response_stub import RuntimeVersionResponseStub
@@ -38,19 +47,44 @@
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
+from ..types.latest_version_level_stub import LatestVersionLevelStub
+
+from ..types.function_type_stub import FunctionTypeStub
+
+
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.runtime_summary_response_stub import RuntimeSummaryResponseStub
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
+from ..types.latest_version_level_stub import LatestVersionLevelStub
+
+from ..types.function_type_stub import FunctionTypeStub
+
+
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.runtime_summary_response_stub import RuntimeSummaryResponseStub
try:
+ from waylay.services.registry.queries.runtimes_api import ExampleArchiveQuery
+
+ from waylay.services.registry.queries.runtimes_api import GetExampleAssetQuery
+
+ from waylay.services.registry.queries.runtimes_api import GetLatestQuery
from waylay.services.registry.models import RuntimeVersionResponse
+
+ from waylay.services.registry.queries.runtimes_api import GetQuery
from waylay.services.registry.models import RuntimeVersionResponse
+
+ from waylay.services.registry.queries.runtimes_api import ListQuery
from waylay.services.registry.models import RuntimeSummaryResponse
+
+ from waylay.services.registry.queries.runtimes_api import ListVersionsQuery
from waylay.services.registry.models import RuntimeSummaryResponse
MODELS_AVAILABLE = find_spec("waylay.services.registry.models") is not None
@@ -101,10 +135,11 @@ async def test_example_archive(
version = SemanticVersionRangeStub.create_json()
kwargs = {
- "query": {
- "ls": False,
- "includeDeprecated": True,
- },
+ # optionally use ExampleArchiveQuery to validate and reuse parameters
+ "query": ExampleArchiveQuery(
+ ls=False,
+ include_deprecated=True,
+ ),
}
_example_archive_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
@@ -170,10 +205,11 @@ async def test_get_example_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "ls": False,
- "includeDeprecated": True,
- },
+ # optionally use GetExampleAssetQuery to validate and reuse parameters
+ "query": GetExampleAssetQuery(
+ ls=False,
+ include_deprecated=True,
+ ),
}
_get_example_asset_set_mock_response(
httpx_mock,
@@ -241,16 +277,17 @@ async def test_get_latest(
name = "name_example"
kwargs = {
- "query": {
- "version": SemanticVersionRangeStub.create_json(),
- "includeDeprecated": False,
- "functionType": [],
- "archiveFormat": [],
- },
+ # optionally use GetLatestQuery to validate and reuse parameters
+ "query": GetLatestQuery(
+ version=SemanticVersionRangeStub.create_json(),
+ include_deprecated=False,
+ function_type=[],
+ archive_format=[],
+ ),
}
_get_latest_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.runtimes.get_latest(name, **kwargs)
- check_type(resp, RuntimeVersionResponse)
+ check_type(resp, Union[RuntimeVersionResponse,])
@pytest.mark.asyncio
@@ -304,15 +341,16 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
version = SemanticVersionRangeStub.create_json()
kwargs = {
- "query": {
- "includeDeprecated": True,
- },
+ # optionally use GetQuery to validate and reuse parameters
+ "query": GetQuery(
+ include_deprecated=True,
+ ),
}
_get_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.runtimes.get(name, version, **kwargs)
- check_type(resp, RuntimeVersionResponse)
+ check_type(resp, Union[RuntimeVersionResponse,])
@pytest.mark.asyncio
@@ -359,18 +397,19 @@ async def test_list(service: RegistryService, gateway_url: str, httpx_mock: HTTP
"""
# set path params
kwargs = {
- "query": {
- "version": SemanticVersionRangeStub.create_json(),
- "latest": "major",
- "includeDeprecated": False,
- "name": "node*",
- "functionType": [],
- "archiveFormat": [],
- },
+ # optionally use ListQuery to validate and reuse parameters
+ "query": ListQuery(
+ version=SemanticVersionRangeStub.create_json(),
+ latest="major",
+ include_deprecated=False,
+ name="node*",
+ function_type=[],
+ archive_format=[],
+ ),
}
_list_set_mock_response(httpx_mock, gateway_url)
resp = await service.runtimes.list(**kwargs)
- check_type(resp, RuntimeSummaryResponse)
+ check_type(resp, Union[RuntimeSummaryResponse,])
@pytest.mark.asyncio
@@ -424,17 +463,18 @@ async def test_list_versions(
name = "name_example"
kwargs = {
- "query": {
- "version": SemanticVersionRangeStub.create_json(),
- "latest": "major",
- "includeDeprecated": False,
- "functionType": [],
- "archiveFormat": [],
- },
+ # optionally use ListVersionsQuery to validate and reuse parameters
+ "query": ListVersionsQuery(
+ version=SemanticVersionRangeStub.create_json(),
+ latest="major",
+ include_deprecated=False,
+ function_type=[],
+ archive_format=[],
+ ),
}
_list_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.runtimes.list_versions(name, **kwargs)
- check_type(resp, RuntimeSummaryResponse)
+ check_type(resp, Union[RuntimeSummaryResponse,])
@pytest.mark.asyncio
diff --git a/test/api/schemas_api_test.py b/test/api/schemas_api_test.py
index efe9edd4..637e04d6 100644
--- a/test/api/schemas_api_test.py
+++ b/test/api/schemas_api_test.py
@@ -9,11 +9,14 @@
"""
import pytest
-from typing import Dict
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
from urllib.parse import quote
@@ -22,6 +25,10 @@
from waylay.services.registry.api import SchemasApi
from waylay.services.registry.service import RegistryService
+from ..types.function_type_stub import FunctionTypeStub
+
+from ..types.asset_role_stub import AssetRoleStub
+
try:
MODELS_AVAILABLE = find_spec("waylay.services.registry.models") is not None
@@ -76,7 +83,7 @@ async def test_get_by_role(
httpx_mock, gateway_url, quote(str(functionType)), quote(str(role))
)
resp = await service.schemas.get_by_role(functionType, role, **kwargs)
- check_type(resp, Dict[str, object])
+ check_type(resp, Union[Dict[str, object],])
@pytest.mark.asyncio
@@ -123,7 +130,7 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
kwargs = {}
_get_set_mock_response(httpx_mock, gateway_url, quote(str(schemaId)))
resp = await service.schemas.get(schemaId, **kwargs)
- check_type(resp, Dict[str, object])
+ check_type(resp, Union[Dict[str, object],])
@pytest.mark.asyncio
diff --git a/test/api/webscript_functions_api_test.py b/test/api/webscript_functions_api_test.py
index d3401c9e..71a6e1be 100644
--- a/test/api/webscript_functions_api_test.py
+++ b/test/api/webscript_functions_api_test.py
@@ -9,10 +9,14 @@
"""
import pytest
+from typing import Dict, List, get_args, Union
from typeguard import check_type
from pytest_httpx import HTTPXMock
import json
+import sys
import re
+from unittest.mock import patch
+from importlib import reload
from importlib.util import find_spec
from urllib.parse import quote
@@ -21,23 +25,41 @@
from waylay.services.registry.api import WebscriptFunctionsApi
from waylay.services.registry.service import RegistryService
+from ..types.deprecate_previous_policy_stub import DeprecatePreviousPolicyStub
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
+from ..types.multipart_file_upload_stub import MultipartFileUploadStub
from ..types.post_webscript_job_sync_response_v2_stub import (
PostWebscriptJobSyncResponseV2Stub,
)
+from ..types.post_webscript_job_async_response_v2_stub import (
+ PostWebscriptJobAsyncResponseV2Stub,
+)
+
from ..types.post_webscript_job_sync_response_v2_stub import (
PostWebscriptJobSyncResponseV2Stub,
)
+from ..types.post_webscript_job_async_response_v2_stub import (
+ PostWebscriptJobAsyncResponseV2Stub,
+)
+
from ..types.get_webscript_response_v2_stub import GetWebscriptResponseV2Stub
from ..types.get_webscript_response_v2_stub import GetWebscriptResponseV2Stub
+from ..types.job_type_schema_stub import JobTypeSchemaStub
+
+
+from ..types.job_state_result_stub import JobStateResultStub
+
+
+from ..types.function_type_stub import FunctionTypeStub
+
from ..types.timestamp_spec_stub import TimestampSpecStub
@@ -45,6 +67,8 @@
from ..types.jobs_for_webscript_response_v2_stub import JobsForWebscriptResponseV2Stub
+from ..types.status_filter_stub import StatusFilterStub
+
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
@@ -56,10 +80,15 @@
from ..types.timestamp_spec_stub import TimestampSpecStub
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.webscript_versions_response_v2_stub import WebscriptVersionsResponseV2Stub
+from ..types.status_filter_stub import StatusFilterStub
+
+
from ..types.semantic_version_range_stub import SemanticVersionRangeStub
from ..types.timestamp_spec_stub import TimestampSpecStub
@@ -70,6 +99,8 @@
from ..types.timestamp_spec_stub import TimestampSpecStub
+from ..types.archive_format_stub import ArchiveFormatStub
+
from ..types.latest_webscripts_response_v2_stub import LatestWebscriptsResponseV2Stub
@@ -77,53 +108,144 @@
from ..types.get_webscript_response_v2_stub import GetWebscriptResponseV2Stub
+from ..types.deprecate_previous_policy_stub import DeprecatePreviousPolicyStub
from ..types.post_webscript_job_sync_response_v2_stub import (
PostWebscriptJobSyncResponseV2Stub,
)
+from ..types.post_webscript_job_async_response_v2_stub import (
+ PostWebscriptJobAsyncResponseV2Stub,
+)
+
+from ..types.rebuild_policy_stub import RebuildPolicyStub
from ..types.rebuild_webscript_sync_response_v2_stub import (
RebuildWebscriptSyncResponseV2Stub,
)
+from ..types.rebuild_webscript_async_response_v2_stub import (
+ RebuildWebscriptAsyncResponseV2Stub,
+)
+
from ..types.undeployed_response_v2_stub import UndeployedResponseV2Stub
+from ..types.undeploy_submitted_response_v2_stub import UndeploySubmittedResponseV2Stub
+
from ..types.undeployed_response_v2_stub import UndeployedResponseV2Stub
+from ..types.undeploy_submitted_response_v2_stub import UndeploySubmittedResponseV2Stub
+
+from ..types.file_upload_stub import FileUploadStub
from ..types.post_webscript_job_sync_response_v2_stub import (
PostWebscriptJobSyncResponseV2Stub,
)
+from ..types.post_webscript_job_async_response_v2_stub import (
+ PostWebscriptJobAsyncResponseV2Stub,
+)
+
+from ..types.multipart_file_upload_stub import MultipartFileUploadStub
from ..types.post_webscript_job_sync_response_v2_stub import (
PostWebscriptJobSyncResponseV2Stub,
)
+from ..types.post_webscript_job_async_response_v2_stub import (
+ PostWebscriptJobAsyncResponseV2Stub,
+)
+
from ..types.verify_webscript_sync_response_v2_stub import (
VerifyWebscriptSyncResponseV2Stub,
)
+from ..types.post_webscript_job_async_response_v2_stub import (
+ PostWebscriptJobAsyncResponseV2Stub,
+)
+
try:
+ from waylay.services.registry.queries.webscript_functions_api import CreateQuery
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
+ from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ DeleteAssetQuery,
+ )
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+ from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import GetArchiveQuery
+
+ from waylay.services.registry.queries.webscript_functions_api import GetAssetQuery
+
+ from waylay.services.registry.queries.webscript_functions_api import GetLatestQuery
from waylay.services.registry.models import GetWebscriptResponseV2
+
from waylay.services.registry.models import GetWebscriptResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import JobsQuery
from waylay.services.registry.models import JobsForWebscriptResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ ListVersionsQuery,
+ )
from waylay.services.registry.models import WebscriptVersionsResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import ListQuery
from waylay.services.registry.models import LatestWebscriptsResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ PatchMetadataQuery,
+ )
from waylay.services.registry.models import GetWebscriptResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import PublishQuery
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
+ from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import RebuildQuery
from waylay.services.registry.models import RebuildWebscriptSyncResponseV2
+
+ from waylay.services.registry.models import RebuildWebscriptAsyncResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ RemoveVersionQuery,
+ )
from waylay.services.registry.models import UndeployedResponseV2
+
+ from waylay.services.registry.models import UndeploySubmittedResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ RemoveVersionsQuery,
+ )
from waylay.services.registry.models import UndeployedResponseV2
+
+ from waylay.services.registry.models import UndeploySubmittedResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ UpdateAssetQuery,
+ )
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
+ from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import (
+ UpdateAssetsQuery,
+ )
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
+ from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
+
+ from waylay.services.registry.queries.webscript_functions_api import VerifyQuery
from waylay.services.registry.models import VerifyWebscriptSyncResponseV2
+ from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
+
MODELS_AVAILABLE = find_spec("waylay.services.registry.models") is not None
except ImportError:
MODELS_AVAILABLE = False
@@ -164,15 +286,16 @@ async def test_create(
"""
# set path params
kwargs = {
- "query": {
- "deprecatePrevious": "none",
- "dryRun": True,
- "async": True,
- "scaleToZero": False,
- "version": SemanticVersionRangeStub.create_json(),
- "name": "name_example",
- "draft": False,
- },
+ # optionally use CreateQuery to validate and reuse parameters
+ "query": CreateQuery(
+ deprecate_previous="none",
+ dry_run=True,
+ var_async=True,
+ scale_to_zero=False,
+ version=SemanticVersionRangeStub.create_json(),
+ name="name_example",
+ draft=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
"files": {
@@ -182,7 +305,13 @@ async def test_create(
}
_create_set_mock_response(httpx_mock, gateway_url)
resp = await service.webscript_functions.create(**kwargs)
- check_type(resp, PostWebscriptJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostWebscriptJobSyncResponseV2,
+ PostWebscriptJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -247,11 +376,12 @@ async def test_delete_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use DeleteAssetQuery to validate and reuse parameters
+ "query": DeleteAssetQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
}
_delete_asset_set_mock_response(
httpx_mock,
@@ -263,7 +393,13 @@ async def test_delete_asset(
resp = await service.webscript_functions.delete_asset(
name, version, wildcard, **kwargs
)
- check_type(resp, PostWebscriptJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostWebscriptJobSyncResponseV2,
+ PostWebscriptJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -330,9 +466,10 @@ async def test_get_archive(
version = "version_example"
kwargs = {
- "query": {
- "ls": False,
- },
+ # optionally use GetArchiveQuery to validate and reuse parameters
+ "query": GetArchiveQuery(
+ ls=False,
+ ),
}
_get_archive_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
@@ -397,9 +534,10 @@ async def test_get_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "ls": False,
- },
+ # optionally use GetAssetQuery to validate and reuse parameters
+ "query": GetAssetQuery(
+ ls=False,
+ ),
}
_get_asset_set_mock_response(
httpx_mock,
@@ -470,14 +608,15 @@ async def test_get_latest(
name = "name_example"
kwargs = {
- "query": {
- "includeDraft": True,
- "includeDeprecated": True,
- },
+ # optionally use GetLatestQuery to validate and reuse parameters
+ "query": GetLatestQuery(
+ include_draft=True,
+ include_deprecated=True,
+ ),
}
_get_latest_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.webscript_functions.get_latest(name, **kwargs)
- check_type(resp, GetWebscriptResponseV2)
+ check_type(resp, Union[GetWebscriptResponseV2,])
@pytest.mark.asyncio
@@ -533,7 +672,7 @@ async def test_get(service: RegistryService, gateway_url: str, httpx_mock: HTTPX
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.get(name, version, **kwargs)
- check_type(resp, GetWebscriptResponseV2)
+ check_type(resp, Union[GetWebscriptResponseV2,])
@pytest.mark.asyncio
@@ -584,20 +723,21 @@ async def test_jobs(service: RegistryService, gateway_url: str, httpx_mock: HTTP
version = "version_example"
kwargs = {
- "query": {
- "limit": 3.4,
- "type": [],
- "state": [],
- "functionType": [],
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- },
+ # optionally use JobsQuery to validate and reuse parameters
+ "query": JobsQuery(
+ limit=3.4,
+ type=[],
+ state=[],
+ function_type=[],
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ ),
}
_jobs_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.jobs(name, version, **kwargs)
- check_type(resp, JobsForWebscriptResponseV2)
+ check_type(resp, Union[JobsForWebscriptResponseV2,])
@pytest.mark.asyncio
@@ -657,27 +797,28 @@ async def test_list_versions(
name = "name_example"
kwargs = {
- "query": {
- "limit": 3.4,
- "page": 3.4,
- "deprecated": True,
- "draft": True,
- "version": "version_example",
- "status": [],
- "runtimeVersion": SemanticVersionRangeStub.create_json(),
- "createdBy": "@me",
- "updatedBy": "@me",
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- "updatedBefore": TimestampSpecStub.create_json(),
- "updatedAfter": TimestampSpecStub.create_json(),
- "archiveFormat": [],
- "runtime": [],
- },
+ # optionally use ListVersionsQuery to validate and reuse parameters
+ "query": ListVersionsQuery(
+ limit=3.4,
+ page=3.4,
+ deprecated=True,
+ draft=True,
+ version="version_example",
+ status=[],
+ runtime_version=SemanticVersionRangeStub.create_json(),
+ created_by="@me",
+ updated_by="@me",
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ updated_before=TimestampSpecStub.create_json(),
+ updated_after=TimestampSpecStub.create_json(),
+ archive_format=[],
+ runtime=[],
+ ),
}
_list_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.webscript_functions.list_versions(name, **kwargs)
- check_type(resp, WebscriptVersionsResponseV2)
+ check_type(resp, Union[WebscriptVersionsResponseV2,])
@pytest.mark.asyncio
@@ -734,32 +875,33 @@ async def test_list(service: RegistryService, gateway_url: str, httpx_mock: HTTP
"""
# set path params
kwargs = {
- "query": {
- "limit": 3.4,
- "page": 3.4,
- "includeDraft": True,
- "includeDeprecated": True,
- "deprecated": True,
- "draft": True,
- "nameVersion": [],
- "version": "version_example",
- "status": [],
- "runtimeVersion": SemanticVersionRangeStub.create_json(),
- "createdBy": "@me",
- "updatedBy": "@me",
- "createdBefore": TimestampSpecStub.create_json(),
- "createdAfter": TimestampSpecStub.create_json(),
- "updatedBefore": TimestampSpecStub.create_json(),
- "updatedAfter": TimestampSpecStub.create_json(),
- "name": "name_example",
- "archiveFormat": [],
- "runtime": [],
- "latest": True,
- },
+ # optionally use ListQuery to validate and reuse parameters
+ "query": ListQuery(
+ limit=3.4,
+ page=3.4,
+ include_draft=True,
+ include_deprecated=True,
+ deprecated=True,
+ draft=True,
+ name_version=[],
+ version="version_example",
+ status=[],
+ runtime_version=SemanticVersionRangeStub.create_json(),
+ created_by="@me",
+ updated_by="@me",
+ created_before=TimestampSpecStub.create_json(),
+ created_after=TimestampSpecStub.create_json(),
+ updated_before=TimestampSpecStub.create_json(),
+ updated_after=TimestampSpecStub.create_json(),
+ name="name_example",
+ archive_format=[],
+ runtime=[],
+ latest=True,
+ ),
}
_list_set_mock_response(httpx_mock, gateway_url)
resp = await service.webscript_functions.list(**kwargs)
- check_type(resp, LatestWebscriptsResponseV2)
+ check_type(resp, Union[LatestWebscriptsResponseV2,])
@pytest.mark.asyncio
@@ -829,16 +971,17 @@ async def test_patch_metadata(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- },
+ # optionally use PatchMetadataQuery to validate and reuse parameters
+ "query": PatchMetadataQuery(
+ comment="comment_example",
+ ),
"json": FunctionMetaStub.create_instance(),
}
_patch_metadata_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.patch_metadata(name, version, **kwargs)
- check_type(resp, GetWebscriptResponseV2)
+ check_type(resp, Union[GetWebscriptResponseV2,])
@pytest.mark.asyncio
@@ -896,17 +1039,24 @@ async def test_publish(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "deprecatePrevious": "none",
- "async": True,
- },
+ # optionally use PublishQuery to validate and reuse parameters
+ "query": PublishQuery(
+ comment="comment_example",
+ deprecate_previous="none",
+ var_async=True,
+ ),
}
_publish_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.publish(name, version, **kwargs)
- check_type(resp, PostWebscriptJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostWebscriptJobSyncResponseV2,
+ PostWebscriptJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -965,22 +1115,29 @@ async def test_rebuild(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "dryRun": True,
- "async": True,
- "upgrade": "patch",
- "forceVersion": "force_version_example",
- "ignoreChecks": True,
- "scaleToZero": True,
- "skipRebuild": True,
- },
+ # optionally use RebuildQuery to validate and reuse parameters
+ "query": RebuildQuery(
+ comment="comment_example",
+ dry_run=True,
+ var_async=True,
+ upgrade="patch",
+ force_version="force_version_example",
+ ignore_checks=True,
+ scale_to_zero=True,
+ skip_rebuild=True,
+ ),
}
_rebuild_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.rebuild(name, version, **kwargs)
- check_type(resp, RebuildWebscriptSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ RebuildWebscriptSyncResponseV2,
+ RebuildWebscriptAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1044,18 +1201,25 @@ async def test_remove_version(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "force": True,
- "undeploy": True,
- },
+ # optionally use RemoveVersionQuery to validate and reuse parameters
+ "query": RemoveVersionQuery(
+ comment="comment_example",
+ var_async=True,
+ force=True,
+ undeploy=True,
+ ),
}
_remove_version_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.remove_version(name, version, **kwargs)
- check_type(resp, UndeployedResponseV2)
+ check_type(
+ resp,
+ Union[
+ UndeployedResponseV2,
+ UndeploySubmittedResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1111,16 +1275,23 @@ async def test_remove_versions(
name = "name_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "force": True,
- "undeploy": True,
- },
+ # optionally use RemoveVersionsQuery to validate and reuse parameters
+ "query": RemoveVersionsQuery(
+ comment="comment_example",
+ var_async=True,
+ force=True,
+ undeploy=True,
+ ),
}
_remove_versions_set_mock_response(httpx_mock, gateway_url, quote(str(name)))
resp = await service.webscript_functions.remove_versions(name, **kwargs)
- check_type(resp, UndeployedResponseV2)
+ check_type(
+ resp,
+ Union[
+ UndeployedResponseV2,
+ UndeploySubmittedResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1178,11 +1349,12 @@ async def test_update_asset(
wildcard = "wildcard_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use UpdateAssetQuery to validate and reuse parameters
+ "query": UpdateAssetQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
}
@@ -1196,7 +1368,13 @@ async def test_update_asset(
resp = await service.webscript_functions.update_asset(
name, version, wildcard, **kwargs
)
- check_type(resp, PostWebscriptJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostWebscriptJobSyncResponseV2,
+ PostWebscriptJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1265,11 +1443,12 @@ async def test_update_assets(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "chown": False,
- },
+ # optionally use UpdateAssetsQuery to validate and reuse parameters
+ "query": UpdateAssetsQuery(
+ comment="comment_example",
+ var_async=True,
+ chown=False,
+ ),
"content": b"some_binary_content",
"headers": {"content-type": "application/octet-stream"},
"files": {
@@ -1281,7 +1460,13 @@ async def test_update_assets(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.update_assets(name, version, **kwargs)
- check_type(resp, PostWebscriptJobSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ PostWebscriptJobSyncResponseV2,
+ PostWebscriptJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
@@ -1346,17 +1531,24 @@ async def test_verify(
version = "version_example"
kwargs = {
- "query": {
- "comment": "comment_example",
- "async": True,
- "scaleToZero": True,
- },
+ # optionally use VerifyQuery to validate and reuse parameters
+ "query": VerifyQuery(
+ comment="comment_example",
+ var_async=True,
+ scale_to_zero=True,
+ ),
}
_verify_set_mock_response(
httpx_mock, gateway_url, quote(str(name)), quote(str(version))
)
resp = await service.webscript_functions.verify(name, version, **kwargs)
- check_type(resp, VerifyWebscriptSyncResponseV2)
+ check_type(
+ resp,
+ Union[
+ VerifyWebscriptSyncResponseV2,
+ PostWebscriptJobAsyncResponseV2,
+ ],
+ )
@pytest.mark.asyncio
diff --git a/test/openapi.py b/test/openapi.py
index e3d2d3e3..1afbd657 100644
--- a/test/openapi.py
+++ b/test/openapi.py
@@ -1,12 +1,35 @@
import json
import yaml
+
+def with_example_provider(dct):
+ has_example = False
+ if "example" in dct:
+ example, has_example = dct["example"], True
+ elif "examples" in dct:
+ examples = dct["examples"]
+ if isinstance(examples, list) and list:
+ example, has_example = examples[0], True
+ elif "default" in dct:
+ example, has_example = dct["default"], True
+
+ if has_example:
+ provider = (
+ example
+ if example is None or isinstance(example, (dict, list, int, float, bool))
+ else f"'{example}'"
+ )
+ dct.update({"$provider": f"lambda: {provider}"})
+ return dct
+
+
with open("openapi/registry.transformed.openapi.yaml", "r") as file:
OPENAPI_SPEC = yaml.safe_load(file)
MODEL_DEFINITIONS = OPENAPI_SPEC["components"]["schemas"]
-_active_event_data_model_schema = json.loads(r"""{
+_active_event_data_model_schema = json.loads(
+ r"""{
"title" : "ActiveEventData",
"type" : "object",
"properties" : {
@@ -15,10 +38,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ActiveEventData": _active_event_data_model_schema})
-_active_event_sse_model_schema = json.loads(r"""{
+_active_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -33,10 +59,13 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ActiveEventSSE": _active_event_sse_model_schema})
-_alt_version_hal_link_model_schema = json.loads(r"""{
+_alt_version_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"draft" : {
@@ -47,10 +76,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AltVersionHALLink": _alt_version_hal_link_model_schema})
-_any_function_response_model_schema = json.loads(r"""{
+_any_function_response_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/PlugResponseV2"
}, {
@@ -59,10 +91,13 @@
"$ref" : "#/components/schemas/WebscriptResponseV2"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AnyFunctionResponse": _any_function_response_model_schema})
-_any_job_for_function_model_schema = json.loads(r"""{
+_any_job_for_function_model_schema = json.loads(
+ r"""{
"title" : "AnyJobForFunction",
"anyOf" : [ {
"$ref" : "#/components/schemas/Build"
@@ -76,10 +111,13 @@
"$ref" : "#/components/schemas/Scale"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AnyJobForFunction": _any_job_for_function_model_schema})
-_any_job_result_model_schema = json.loads(r"""{
+_any_job_result_model_schema = json.loads(
+ r"""{
"title" : "AnyJobResult",
"anyOf" : [ {
"$ref" : "#/components/schemas/BuildResult"
@@ -97,10 +135,13 @@
"$ref" : "#/components/schemas/CleanupResult"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AnyJobResult": _any_job_result_model_schema})
-_any_job_status_model_schema = json.loads(r"""{
+_any_job_status_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/BuildJobStatus"
}, {
@@ -115,10 +156,13 @@
"$ref" : "#/components/schemas/BatchJobStatus"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AnyJobStatus": _any_job_status_model_schema})
-_any_job_status_summary_model_schema = json.loads(r"""{
+_any_job_status_summary_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/Build_1"
}, {
@@ -133,18 +177,24 @@
"$ref" : "#/components/schemas/Batch"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AnyJobStatusSummary": _any_job_status_summary_model_schema})
-_archive_format_model_schema = json.loads(r"""{
+_archive_format_model_schema = json.loads(
+ r"""{
"title" : "ArchiveFormat",
"type" : "string",
"enum" : [ "node", "python", "golang", "byoml", "native" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ArchiveFormat": _archive_format_model_schema})
-_asset_condition_model_schema = json.loads(r"""{
+_asset_condition_model_schema = json.loads(
+ r"""{
"title" : "AssetCondition",
"required" : [ "pattern", "role" ],
"type" : "object",
@@ -190,10 +240,13 @@
},
"description" : "Describes conditions on the set of files that match a file pattern."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AssetCondition": _asset_condition_model_schema})
-_asset_condition_content_type_model_schema = json.loads(r"""{
+_asset_condition_content_type_model_schema = json.loads(
+ r"""{
"title" : "AssetCondition_contentType",
"description" : "Allowed content type(s) of matching files.",
"anyOf" : [ {
@@ -205,12 +258,15 @@
}
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"AssetCondition_contentType": _asset_condition_content_type_model_schema}
)
-_asset_condition_pattern_model_schema = json.loads(r"""{
+_asset_condition_pattern_model_schema = json.loads(
+ r"""{
"title" : "AssetCondition_pattern",
"description" : "Pattern that selects a file in a function archive",
"anyOf" : [ {
@@ -222,12 +278,15 @@
}
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"AssetCondition_pattern": _asset_condition_pattern_model_schema}
)
-_asset_path_params_v2_model_schema = json.loads(r"""{
+_asset_path_params_v2_model_schema = json.loads(
+ r"""{
"required" : [ "*" ],
"type" : "object",
"properties" : {
@@ -238,19 +297,25 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AssetPathParamsV2": _asset_path_params_v2_model_schema})
-_asset_role_model_schema = json.loads(r"""{
+_asset_role_model_schema = json.loads(
+ r"""{
"title" : "AssetRole",
"type" : "string",
"description" : "Classification of assets with regard to their role.",
"enum" : [ "manifest", "project", "main", "lib", "script", "other" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AssetRole": _asset_role_model_schema})
-_asset_summary_model_schema = json.loads(r"""{
+_asset_summary_model_schema = json.loads(
+ r"""{
"required" : [ "name" ],
"type" : "object",
"properties" : {
@@ -269,10 +334,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AssetSummary": _asset_summary_model_schema})
-_asset_summary_with_hal_link_model_schema = json.loads(r"""{
+_asset_summary_with_hal_link_model_schema = json.loads(
+ r"""{
"title" : "AssetSummaryWithHALLink",
"required" : [ "_links", "name" ],
"type" : "object",
@@ -298,12 +366,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"AssetSummaryWithHALLink": _asset_summary_with_hal_link_model_schema}
)
-_asset_summary_with_hal_link__links_model_schema = json.loads(r"""{
+_asset_summary_with_hal_link__links_model_schema = json.loads(
+ r"""{
"title" : "AssetSummaryWithHALLink__links",
"required" : [ "asset" ],
"type" : "object",
@@ -314,12 +385,15 @@
},
"description" : "HAL links to the asset"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"AssetSummaryWithHALLink__links": _asset_summary_with_hal_link__links_model_schema}
)
-_assets_conditions_model_schema = json.loads(r"""{
+_assets_conditions_model_schema = json.loads(
+ r"""{
"title" : "AssetsConditions",
"type" : "object",
"properties" : {
@@ -339,10 +413,13 @@
},
"description" : "Describes the assets that are required/allowed/supported for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AssetsConditions": _assets_conditions_model_schema})
-_async_deploy_query_model_schema = json.loads(r"""{
+_async_deploy_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecatePrevious" : {
@@ -365,10 +442,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AsyncDeployQuery": _async_deploy_query_model_schema})
-_async_deploy_query_v1_model_schema = json.loads(r"""{
+_async_deploy_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"scaleToZero" : {
@@ -388,10 +468,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AsyncDeployQueryV1": _async_deploy_query_v1_model_schema})
-_async_query_default_false_model_schema = json.loads(r"""{
+_async_query_default_false_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -402,12 +485,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"AsyncQueryDefaultFalse": _async_query_default_false_model_schema}
)
-_async_query_default_true_model_schema = json.loads(r"""{
+_async_query_default_true_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -418,12 +504,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"AsyncQueryDefaultTrue": _async_query_default_true_model_schema}
)
-_async_verify_query_model_schema = json.loads(r"""{
+_async_verify_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -442,10 +531,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"AsyncVerifyQuery": _async_verify_query_model_schema})
-_batch_model_schema = json.loads(r"""{
+_batch_model_schema = json.loads(
+ r"""{
"title" : "Batch",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -488,10 +580,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Batch": _batch_model_schema})
-_batch_args_model_schema = json.loads(r"""{
+_batch_args_model_schema = json.loads(
+ r"""{
"title" : "BatchArgs",
"required" : [ "functionType", "plugName" ],
"type" : "object",
@@ -509,10 +604,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BatchArgs": _batch_args_model_schema})
-_batch_job_status_model_schema = json.loads(r"""{
+_batch_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -552,10 +650,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BatchJobStatus": _batch_job_status_model_schema})
-_batch_result_model_schema = json.loads(r"""{
+_batch_result_model_schema = json.loads(
+ r"""{
"title" : "BatchResult",
"type" : "object",
"properties" : {
@@ -565,10 +666,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BatchResult": _batch_result_model_schema})
-_build_model_schema = json.loads(r"""{
+_build_model_schema = json.loads(
+ r"""{
"title" : "Build",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -618,10 +722,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Build": _build_model_schema})
-_build_1_model_schema = json.loads(r"""{
+_build_1_model_schema = json.loads(
+ r"""{
"title" : "Build",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -664,10 +771,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Build_1": _build_1_model_schema})
-_build_args_model_schema = json.loads(r"""{
+_build_args_model_schema = json.loads(
+ r"""{
"title" : "BuildArgs",
"required" : [ "args", "imageName", "runtimeName", "runtimeVersion", "storageLocation" ],
"type" : "object",
@@ -704,10 +814,13 @@
},
"description" : "Input arguments to a job that builds a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BuildArgs": _build_args_model_schema})
-_build_job_status_model_schema = json.loads(r"""{
+_build_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -747,10 +860,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BuildJobStatus": _build_job_status_model_schema})
-_build_result_model_schema = json.loads(r"""{
+_build_result_model_schema = json.loads(
+ r"""{
"title" : "BuildResult",
"required" : [ "digest" ],
"type" : "object",
@@ -775,10 +891,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BuildResult": _build_result_model_schema})
-_build_spec_model_schema = json.loads(r"""{
+_build_spec_model_schema = json.loads(
+ r"""{
"title" : "BuildSpec",
"required" : [ "args", "context" ],
"type" : "object",
@@ -796,10 +915,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"BuildSpec": _build_spec_model_schema})
-_cleanup_result_model_schema = json.loads(r"""{
+_cleanup_result_model_schema = json.loads(
+ r"""{
"title" : "CleanupResult",
"type" : "object",
"properties" : {
@@ -809,10 +931,13 @@
},
"description" : "The result data for a completed cleanup job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"CleanupResult": _cleanup_result_model_schema})
-_compiled_runtime_version_model_schema = json.loads(r"""{
+_compiled_runtime_version_model_schema = json.loads(
+ r"""{
"title" : "CompiledRuntimeVersion",
"required" : [ "archiveFormat", "deprecated", "functionType", "name", "title", "upgradable", "version" ],
"type" : "object",
@@ -871,12 +996,15 @@
},
"description" : "Compiled build and deployment information for a runtime version. Contains all defaults applied on the _global_, _functionType_, _archiveFormat_, _runtime_ and _runtime version_ level."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"CompiledRuntimeVersion": _compiled_runtime_version_model_schema}
)
-_completed_event_data_model_schema = json.loads(r"""{
+_completed_event_data_model_schema = json.loads(
+ r"""{
"title" : "CompletedEventData",
"required" : [ "returnValue" ],
"type" : "object",
@@ -889,10 +1017,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"CompletedEventData": _completed_event_data_model_schema})
-_completed_event_sse_model_schema = json.loads(r"""{
+_completed_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -907,10 +1038,13 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"CompletedEventSSE": _completed_event_sse_model_schema})
-_content_query_v2_model_schema = json.loads(r"""{
+_content_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"ls" : {
@@ -921,10 +1055,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ContentQueryV2": _content_query_v2_model_schema})
-_content_validation_listing_model_schema = json.loads(r"""{
+_content_validation_listing_model_schema = json.loads(
+ r"""{
"required" : [ "assets" ],
"type" : "object",
"properties" : {
@@ -937,12 +1074,15 @@
},
"description" : "Content listing"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"ContentValidationListing": _content_validation_listing_model_schema}
)
-_create_function_query_v2_model_schema = json.loads(r"""{
+_create_function_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecatePrevious" : {
@@ -977,12 +1117,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"CreateFunctionQueryV2": _create_function_query_v2_model_schema}
)
-_create_kf_serving_async_response_model_schema = json.loads(r"""{
+_create_kf_serving_async_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -998,12 +1141,15 @@
},
"description" : "Model Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"CreateKFServingAsyncResponse": _create_kf_serving_async_response_model_schema}
)
-_create_plug_async_response_model_schema = json.loads(r"""{
+_create_plug_async_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -1019,12 +1165,15 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"CreatePlugAsyncResponse": _create_plug_async_response_model_schema}
)
-_create_webscript_async_response_model_schema = json.loads(r"""{
+_create_webscript_async_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -1040,12 +1189,15 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"CreateWebscriptAsyncResponse": _create_webscript_async_response_model_schema}
)
-_delayed_event_data_model_schema = json.loads(r"""{
+_delayed_event_data_model_schema = json.loads(
+ r"""{
"title" : "DelayedEventData",
"required" : [ "delay" ],
"type" : "object",
@@ -1056,10 +1208,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DelayedEventData": _delayed_event_data_model_schema})
-_delayed_event_sse_model_schema = json.loads(r"""{
+_delayed_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -1074,10 +1229,13 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DelayedEventSSE": _delayed_event_sse_model_schema})
-_deploy_model_schema = json.loads(r"""{
+_deploy_model_schema = json.loads(
+ r"""{
"title" : "Deploy",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -1127,10 +1285,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Deploy": _deploy_model_schema})
-_deploy_1_model_schema = json.loads(r"""{
+_deploy_1_model_schema = json.loads(
+ r"""{
"title" : "Deploy",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -1173,10 +1334,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Deploy_1": _deploy_1_model_schema})
-_deploy_args_model_schema = json.loads(r"""{
+_deploy_args_model_schema = json.loads(
+ r"""{
"title" : "DeployArgs",
"required" : [ "deploySpecOverrides", "endpoint", "imageName", "namespace", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -1213,10 +1377,13 @@
},
"description" : "Input argument to an (openfaas) deployment job for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DeployArgs": _deploy_args_model_schema})
-_deploy_args_deploy_spec_overrides_model_schema = json.loads(r"""{
+_deploy_args_deploy_spec_overrides_model_schema = json.loads(
+ r"""{
"title" : "DeployArgs_deploySpecOverrides",
"type" : "object",
"properties" : {
@@ -1292,12 +1459,15 @@
},
"description" : "Overrides on the deployment specification."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DeployArgs_deploySpecOverrides": _deploy_args_deploy_spec_overrides_model_schema}
)
-_deploy_attributes_filter_model_schema = json.loads(r"""{
+_deploy_attributes_filter_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"endpoint" : {
@@ -1315,12 +1485,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DeployAttributesFilter": _deploy_attributes_filter_model_schema}
)
-_deploy_job_status_model_schema = json.loads(r"""{
+_deploy_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -1360,10 +1533,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DeployJobStatus": _deploy_job_status_model_schema})
-_deploy_result_model_schema = json.loads(r"""{
+_deploy_result_model_schema = json.loads(
+ r"""{
"title" : "DeployResult",
"required" : [ "deploySpec" ],
"type" : "object",
@@ -1374,10 +1550,13 @@
},
"description" : "The result data for a completed deployment job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DeployResult": _deploy_result_model_schema})
-_deploy_spec_model_schema = json.loads(r"""{
+_deploy_spec_model_schema = json.loads(
+ r"""{
"title" : "DeploySpec",
"type" : "object",
"properties" : {
@@ -1386,10 +1565,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DeploySpec": _deploy_spec_model_schema})
-_deploy_spec_openfaas_spec_model_schema = json.loads(r"""{
+_deploy_spec_openfaas_spec_model_schema = json.loads(
+ r"""{
"title" : "DeploySpec_openfaasSpec",
"type" : "object",
"properties" : {
@@ -1465,22 +1647,28 @@
},
"description" : "If specified, it overrides the properties in `default`. Non-specified properties are taken from `default`"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DeploySpec_openfaasSpec": _deploy_spec_openfaas_spec_model_schema}
)
-_deprecate_previous_policy_model_schema = json.loads(r"""{
+_deprecate_previous_policy_model_schema = json.loads(
+ r"""{
"title" : "DeprecatePreviousPolicy",
"type" : "string",
"enum" : [ "none", "all", "patch", "minor" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DeprecatePreviousPolicy": _deprecate_previous_policy_model_schema}
)
-_deprecate_previous_query_model_schema = json.loads(r"""{
+_deprecate_previous_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecatePrevious" : {
@@ -1489,12 +1677,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DeprecatePreviousQuery": _deprecate_previous_query_model_schema}
)
-_deprecated_draft_filter_model_schema = json.loads(r"""{
+_deprecated_draft_filter_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecated" : {
@@ -1508,12 +1699,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DeprecatedDraftFilter": _deprecated_draft_filter_model_schema}
)
-_documentation_model_schema = json.loads(r"""{
+_documentation_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"description" : {
@@ -1542,10 +1736,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Documentation": _documentation_model_schema})
-_documentation_property_model_schema = json.loads(r"""{
+_documentation_property_model_schema = json.loads(
+ r"""{
"required" : [ "description", "name" ],
"type" : "object",
"properties" : {
@@ -1559,12 +1756,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"DocumentationProperty": _documentation_property_model_schema}
)
-_dry_run_query_model_schema = json.loads(r"""{
+_dry_run_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"dryRun" : {
@@ -1574,10 +1774,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"DryRunQuery": _dry_run_query_model_schema})
-_entity_response_model_schema = json.loads(r"""{
+_entity_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "metadata", "name", "runtime", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -1633,10 +1836,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EntityResponse": _entity_response_model_schema})
-_error_and_status_response_model_schema = json.loads(r"""{
+_error_and_status_response_model_schema = json.loads(
+ r"""{
"required" : [ "error", "statusCode" ],
"type" : "object",
"properties" : {
@@ -1648,12 +1854,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"ErrorAndStatusResponse": _error_and_status_response_model_schema}
)
-_error_response_model_schema = json.loads(r"""{
+_error_response_model_schema = json.loads(
+ r"""{
"required" : [ "error" ],
"type" : "object",
"properties" : {
@@ -1662,31 +1871,43 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ErrorResponse": _error_response_model_schema})
-_event_ack_model_schema = json.loads(r"""{
+_event_ack_model_schema = json.loads(
+ r"""{
"type" : "string",
"enum" : [ "ack" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EventAck": _event_ack_model_schema})
-_event_close_model_schema = json.loads(r"""{
+_event_close_model_schema = json.loads(
+ r"""{
"type" : "string",
"enum" : [ "close" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EventClose": _event_close_model_schema})
-_event_keep_alive_model_schema = json.loads(r"""{
+_event_keep_alive_model_schema = json.loads(
+ r"""{
"type" : "string",
"enum" : [ "keep-alive" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EventKeepAlive": _event_keep_alive_model_schema})
-_event_sse_model_schema = json.loads(r"""{
+_event_sse_model_schema = json.loads(
+ r"""{
"description" : "SSE stream events without closing protocol",
"anyOf" : [ {
"$ref" : "#/components/schemas/Stream_Ready"
@@ -1696,10 +1917,13 @@
"$ref" : "#/components/schemas/KeepAliveEventSSE"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EventSSE": _event_sse_model_schema})
-_event_type_sse_model_schema = json.loads(r"""{
+_event_type_sse_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/SupportedEvents"
}, {
@@ -1710,10 +1934,13 @@
"$ref" : "#/components/schemas/EventKeepAlive"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EventTypeSSE": _event_type_sse_model_schema})
-_event_with_close_sse_model_schema = json.loads(r"""{
+_event_with_close_sse_model_schema = json.loads(
+ r"""{
"description" : "SSE stream events with closing protocol",
"anyOf" : [ {
"$ref" : "#/components/schemas/Stream_Ready"
@@ -1725,10 +1952,13 @@
"$ref" : "#/components/schemas/Stream_Closing"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"EventWithCloseSSE": _event_with_close_sse_model_schema})
-_exposed_openfaas_deploy_spec_model_schema = json.loads(r"""{
+_exposed_openfaas_deploy_spec_model_schema = json.loads(
+ r"""{
"title" : "ExposedOpenfaasDeploySpec",
"required" : [ "image", "namespace", "service" ],
"type" : "object",
@@ -1767,12 +1997,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"ExposedOpenfaasDeploySpec": _exposed_openfaas_deploy_spec_model_schema}
)
-_failed_event_data_model_schema = json.loads(r"""{
+_failed_event_data_model_schema = json.loads(
+ r"""{
"title" : "FailedEventData",
"required" : [ "failedReason" ],
"type" : "object",
@@ -1787,10 +2020,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FailedEventData": _failed_event_data_model_schema})
-_failed_event_sse_model_schema = json.loads(r"""{
+_failed_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -1805,10 +2041,13 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FailedEventSSE": _failed_event_sse_model_schema})
-_failure_reason_model_schema = json.loads(r"""{
+_failure_reason_model_schema = json.loads(
+ r"""{
"title" : "FailureReason",
"required" : [ "events", "log" ],
"type" : "object",
@@ -1836,10 +2075,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FailureReason": _failure_reason_model_schema})
-_file_upload_model_schema = json.loads(r"""{
+_file_upload_model_schema = json.loads(
+ r"""{
"title" : "File Upload",
"type" : "object",
"properties" : {
@@ -1850,10 +2092,13 @@
},
"description" : "A single asset file."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"File_Upload": _file_upload_model_schema})
-_force_delete_query_v1_model_schema = json.loads(r"""{
+_force_delete_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -1868,10 +2113,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ForceDeleteQueryV1": _force_delete_query_v1_model_schema})
-_function_delete_query_model_schema = json.loads(r"""{
+_function_delete_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"force" : {
@@ -1885,10 +2133,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionDeleteQuery": _function_delete_query_model_schema})
-_function_deploy_overrides_model_schema = json.loads(r"""{
+_function_deploy_overrides_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deploy" : {
@@ -1896,12 +2147,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"FunctionDeployOverrides": _function_deploy_overrides_model_schema}
)
-_function_deploy_overrides_type_model_schema = json.loads(r"""{
+_function_deploy_overrides_type_model_schema = json.loads(
+ r"""{
"title" : "FunctionDeployOverridesType",
"type" : "object",
"properties" : {
@@ -1934,12 +2188,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"FunctionDeployOverridesType": _function_deploy_overrides_type_model_schema}
)
-_function_entity_query_model_schema = json.loads(r"""{
+_function_entity_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -1964,10 +2221,13 @@
"additionalProperties" : false,
"description" : "Filter on function attributes that do not change across function versions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionEntityQuery": _function_entity_query_model_schema})
-_function_job_args_model_schema = json.loads(r"""{
+_function_job_args_model_schema = json.loads(
+ r"""{
"required" : [ "runtimeName", "runtimeVersion" ],
"type" : "object",
"properties" : {
@@ -1984,10 +2244,13 @@
},
"description" : "Job arguments shared by all function jobs"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionJobArgs": _function_job_args_model_schema})
-_function_manifest_model_schema = json.loads(r"""{
+_function_manifest_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "runtime", "version" ],
"type" : "object",
"properties" : {
@@ -2012,10 +2275,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionManifest": _function_manifest_model_schema})
-_function_meta_model_schema = json.loads(r"""{
+_function_meta_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -2037,10 +2303,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionMeta": _function_meta_model_schema})
-_function_name_version_model_schema = json.loads(r"""{
+_function_name_version_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -2053,10 +2322,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionNameVersion": _function_name_version_model_schema})
-_function_ref_model_schema = json.loads(r"""{
+_function_ref_model_schema = json.loads(
+ r"""{
"title" : "FunctionRef",
"required" : [ "functionType", "name" ],
"type" : "object",
@@ -2082,10 +2354,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionRef": _function_ref_model_schema})
-_function_spec_model_schema = json.loads(r"""{
+_function_spec_model_schema = json.loads(
+ r"""{
"required" : [ "name", "runtime", "version" ],
"type" : "object",
"properties" : {
@@ -2101,18 +2376,24 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionSpec": _function_spec_model_schema})
-_function_type_model_schema = json.loads(r"""{
+_function_type_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "Type of functions supported by the registry service.",
"enum" : [ "plugs", "webscripts", "kfserving" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionType": _function_type_model_schema})
-_function_version_query_model_schema = json.loads(r"""{
+_function_version_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -2155,10 +2436,13 @@
"additionalProperties" : false,
"description" : "Filter on function attributes that can change across function versions. When these query parameters are used, the query is considered a _function version_ listing and no HAL links to latest (_draft_, _published_) versions are included."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"FunctionVersionQuery": _function_version_query_model_schema})
-_get_content_params_v2_model_schema = json.loads(r"""{
+_get_content_params_v2_model_schema = json.loads(
+ r"""{
"required" : [ "*", "name", "version" ],
"type" : "object",
"properties" : {
@@ -2176,10 +2460,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"GetContentParamsV2": _get_content_params_v2_model_schema})
-_get_invokable_webscript_query_model_schema = json.loads(r"""{
+_get_invokable_webscript_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -2204,12 +2491,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetInvokableWebscriptQuery": _get_invokable_webscript_query_model_schema}
)
-_get_model_response_v2_model_schema = json.loads(r"""{
+_get_model_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -2222,10 +2512,13 @@
},
"description" : "Model Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"GetModelResponseV2": _get_model_response_v2_model_schema})
-_get_plug_response_v2_model_schema = json.loads(r"""{
+_get_plug_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -2238,10 +2531,13 @@
},
"description" : "Plug Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"GetPlugResponseV2": _get_plug_response_v2_model_schema})
-_get_plug_response_v2__links_model_schema = json.loads(r"""{
+_get_plug_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "GetPlugResponseV2__links",
"type" : "object",
"properties" : {
@@ -2257,12 +2553,15 @@
},
"description" : "HAL links to related jobs and plugs"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetPlugResponseV2__links": _get_plug_response_v2__links_model_schema}
)
-_get_plug_response_v2__links_draft_model_schema = json.loads(r"""{
+_get_plug_response_v2__links_draft_model_schema = json.loads(
+ r"""{
"title" : "GetPlugResponseV2__links_draft",
"required" : [ "deprecated", "draft", "href", "version" ],
"type" : "object",
@@ -2288,12 +2587,15 @@
"deprecated" : false
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetPlugResponseV2__links_draft": _get_plug_response_v2__links_draft_model_schema}
)
-_get_plug_response_v2__links_published_model_schema = json.loads(r"""{
+_get_plug_response_v2__links_published_model_schema = json.loads(
+ r"""{
"title" : "GetPlugResponseV2__links_published",
"required" : [ "deprecated", "draft", "href", "version" ],
"type" : "object",
@@ -2319,14 +2621,17 @@
"deprecated" : false
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"GetPlugResponseV2__links_published": _get_plug_response_v2__links_published_model_schema
}
)
-_get_runtime_by_name_and_version_query_model_schema = json.loads(r"""{
+_get_runtime_by_name_and_version_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDeprecated" : {
@@ -2337,14 +2642,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"GetRuntimeByNameAndVersionQuery": _get_runtime_by_name_and_version_query_model_schema
}
)
-_get_runtime_by_name_query_model_schema = json.loads(r"""{
+_get_runtime_by_name_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -2374,12 +2682,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetRuntimeByNameQuery": _get_runtime_by_name_query_model_schema}
)
-_get_runtime_example_query_model_schema = json.loads(r"""{
+_get_runtime_example_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"ls" : {
@@ -2395,12 +2706,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetRuntimeExampleQuery": _get_runtime_example_query_model_schema}
)
-_get_runtime_versions_query_model_schema = json.loads(r"""{
+_get_runtime_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -2433,12 +2747,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetRuntimeVersionsQuery": _get_runtime_versions_query_model_schema}
)
-_get_webscript_response_v2_model_schema = json.loads(r"""{
+_get_webscript_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -2451,12 +2768,15 @@
},
"description" : "Webscript Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetWebscriptResponseV2": _get_webscript_response_v2_model_schema}
)
-_get_webscript_response_v2__links_model_schema = json.loads(r"""{
+_get_webscript_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "GetWebscriptResponseV2__links",
"type" : "object",
"properties" : {
@@ -2469,12 +2789,15 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"GetWebscriptResponseV2__links": _get_webscript_response_v2__links_model_schema}
)
-_hal_link_model_schema = json.loads(r"""{
+_hal_link_model_schema = json.loads(
+ r"""{
"title" : "HALLink",
"required" : [ "href" ],
"type" : "object",
@@ -2485,10 +2808,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"HALLink": _hal_link_model_schema})
-_invokable_webscript_response_model_schema = json.loads(r"""{
+_invokable_webscript_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -2501,12 +2827,15 @@
},
"description" : "Webscript Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"InvokableWebscriptResponse": _invokable_webscript_response_model_schema}
)
-_invokable_webscript_response_entity_model_schema = json.loads(r"""{
+_invokable_webscript_response_entity_model_schema = json.loads(
+ r"""{
"title" : "InvokableWebscriptResponse_entity",
"required" : [ "draft", "status", "webscript" ],
"type" : "object",
@@ -2527,14 +2856,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"InvokableWebscriptResponse_entity": _invokable_webscript_response_entity_model_schema
}
)
-_invokable_webscript_response_entity_webscript_model_schema = json.loads(r"""{
+_invokable_webscript_response_entity_webscript_model_schema = json.loads(
+ r"""{
"title" : "InvokableWebscriptResponse_entity_webscript",
"required" : [ "allowHmac", "name", "private", "version" ],
"type" : "object",
@@ -2556,14 +2888,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"InvokableWebscriptResponse_entity_webscript": _invokable_webscript_response_entity_webscript_model_schema
}
)
-_invoke_hal_link_model_schema = json.loads(r"""{
+_invoke_hal_link_model_schema = json.loads(
+ r"""{
"title" : "InvokeHALLink",
"type" : "object",
"properties" : {
@@ -2572,10 +2907,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"InvokeHALLink": _invoke_hal_link_model_schema})
-_invoke_internal_hal_link_model_schema = json.loads(r"""{
+_invoke_internal_hal_link_model_schema = json.loads(
+ r"""{
"title" : "InvokeInternalHALLink",
"type" : "object",
"properties" : {
@@ -2584,12 +2922,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"InvokeInternalHALLink": _invoke_internal_hal_link_model_schema}
)
-_job_and_function_hal_link_model_schema = json.loads(r"""{
+_job_and_function_hal_link_model_schema = json.loads(
+ r"""{
"title" : "JobAndFunctionHALLink",
"description" : "HAL links to related actions.",
"anyOf" : [ {
@@ -2602,12 +2943,15 @@
"$ref" : "#/components/schemas/JobHALLinks"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobAndFunctionHALLink": _job_and_function_hal_link_model_schema}
)
-_job_cause_model_schema = json.loads(r"""{
+_job_cause_model_schema = json.loads(
+ r"""{
"title" : "JobCause",
"required" : [ "changed", "reason" ],
"type" : "object",
@@ -2640,10 +2984,13 @@
},
"description" : "The motivation for including or excluding a job (build, deploy, verify, ...) in response to a rebuild request."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobCause": _job_cause_model_schema})
-_job_causes_model_schema = json.loads(r"""{
+_job_causes_model_schema = json.loads(
+ r"""{
"title" : "JobCauses",
"type" : "object",
"properties" : {
@@ -2665,10 +3012,13 @@
},
"description" : "The motivations for including or excluding a job in response to a rebuild request."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobCauses": _job_causes_model_schema})
-_job_event_payload_active_event_data__model_schema = json.loads(r"""{
+_job_event_payload_active_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -2685,14 +3035,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventPayload_ActiveEventData_": _job_event_payload_active_event_data__model_schema
}
)
-_job_event_payload_completed_event_data__model_schema = json.loads(r"""{
+_job_event_payload_completed_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -2709,14 +3062,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventPayload_CompletedEventData_": _job_event_payload_completed_event_data__model_schema
}
)
-_job_event_payload_delayed_event_data__model_schema = json.loads(r"""{
+_job_event_payload_delayed_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -2733,14 +3089,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventPayload_DelayedEventData_": _job_event_payload_delayed_event_data__model_schema
}
)
-_job_event_payload_failed_event_data__model_schema = json.loads(r"""{
+_job_event_payload_failed_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -2757,14 +3116,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventPayload_FailedEventData_": _job_event_payload_failed_event_data__model_schema
}
)
-_job_event_payload_waiting_children_event_data__model_schema = json.loads(r"""{
+_job_event_payload_waiting_children_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -2781,14 +3143,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventPayload_WaitingChildrenEventData_": _job_event_payload_waiting_children_event_data__model_schema
}
)
-_job_event_payload_waiting_event_data__model_schema = json.loads(r"""{
+_job_event_payload_waiting_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -2805,14 +3170,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventPayload_WaitingEventData_": _job_event_payload_waiting_event_data__model_schema
}
)
-_job_event_response_active_event_data__model_schema = json.loads(r"""{
+_job_event_response_active_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_ActiveEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -2838,14 +3206,17 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventResponse_ActiveEventData_": _job_event_response_active_event_data__model_schema
}
)
-_job_event_response_completed_event_data__model_schema = json.loads(r"""{
+_job_event_response_completed_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_CompletedEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -2871,14 +3242,17 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventResponse_CompletedEventData_": _job_event_response_completed_event_data__model_schema
}
)
-_job_event_response_delayed_event_data__model_schema = json.loads(r"""{
+_job_event_response_delayed_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_DelayedEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -2904,14 +3278,17 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventResponse_DelayedEventData_": _job_event_response_delayed_event_data__model_schema
}
)
-_job_event_response_failed_event_data__model_schema = json.loads(r"""{
+_job_event_response_failed_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_FailedEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -2937,14 +3314,17 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventResponse_FailedEventData_": _job_event_response_failed_event_data__model_schema
}
)
-_job_event_response_waiting_children_event_data__model_schema = json.loads(r"""{
+_job_event_response_waiting_children_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_WaitingChildrenEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -2970,14 +3350,17 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventResponse_WaitingChildrenEventData_": _job_event_response_waiting_children_event_data__model_schema
}
)
-_job_event_response_waiting_event_data__model_schema = json.loads(r"""{
+_job_event_response_waiting_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_WaitingEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -3003,14 +3386,17 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobEventResponse_WaitingEventData_": _job_event_response_waiting_event_data__model_schema
}
)
-_job_event_sse_model_schema = json.loads(r"""{
+_job_event_sse_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/ActiveEventSSE"
}, {
@@ -3025,10 +3411,13 @@
"$ref" : "#/components/schemas/WaitingChildrenEventSSE"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobEventSSE": _job_event_sse_model_schema})
-_job_events_and_function_hal_link_model_schema = json.loads(r"""{
+_job_events_and_function_hal_link_model_schema = json.loads(
+ r"""{
"title" : "JobEventsAndFunctionHALLink",
"description" : "HAL links to related actions.",
"anyOf" : [ {
@@ -3041,12 +3430,15 @@
"$ref" : "#/components/schemas/JobEventsHALLink"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobEventsAndFunctionHALLink": _job_events_and_function_hal_link_model_schema}
)
-_job_events_filter_query_model_schema = json.loads(r"""{
+_job_events_filter_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -3063,12 +3455,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobEventsFilterQuery": _job_events_filter_query_model_schema}
)
-_job_events_hal_link_model_schema = json.loads(r"""{
+_job_events_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"event" : {
@@ -3077,10 +3472,13 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobEventsHALLink": _job_events_hal_link_model_schema})
-_job_hal_links_model_schema = json.loads(r"""{
+_job_hal_links_model_schema = json.loads(
+ r"""{
"title" : "JobHALLinks",
"type" : "object",
"properties" : {
@@ -3093,10 +3491,13 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobHALLinks": _job_hal_links_model_schema})
-_job_query_model_schema = json.loads(r"""{
+_job_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -3134,10 +3535,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobQuery": _job_query_model_schema})
-_job_reference_model_schema = json.loads(r"""{
+_job_reference_model_schema = json.loads(
+ r"""{
"title" : "JobReference",
"required" : [ "type" ],
"type" : "object",
@@ -3151,10 +3555,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobReference": _job_reference_model_schema})
-_job_reference_params_model_schema = json.loads(r"""{
+_job_reference_params_model_schema = json.loads(
+ r"""{
"required" : [ "id", "type" ],
"type" : "object",
"properties" : {
@@ -3167,10 +3574,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobReferenceParams": _job_reference_params_model_schema})
-_job_response_model_schema = json.loads(r"""{
+_job_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "job" ],
"type" : "object",
"properties" : {
@@ -3183,10 +3593,13 @@
},
"description" : "Job Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobResponse": _job_response_model_schema})
-_job_state_model_schema = json.loads(r"""{
+_job_state_model_schema = json.loads(
+ r"""{
"title" : "JobState",
"description" : "Allowed job states",
"anyOf" : [ {
@@ -3201,46 +3614,61 @@
"$ref" : "#/components/schemas/JobStateWaitingChildren"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobState": _job_state_model_schema})
-_job_state_active_model_schema = json.loads(r"""{
+_job_state_active_model_schema = json.loads(
+ r"""{
"title" : "JobStateActive",
"type" : "string",
"description" : "The job is running.",
"enum" : [ "active" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateActive": _job_state_active_model_schema})
-_job_state_completed_model_schema = json.loads(r"""{
+_job_state_completed_model_schema = json.loads(
+ r"""{
"title" : "JobStateCompleted",
"type" : "string",
"description" : "The job has completed successfully.",
"enum" : [ "completed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateCompleted": _job_state_completed_model_schema})
-_job_state_delayed_model_schema = json.loads(r"""{
+_job_state_delayed_model_schema = json.loads(
+ r"""{
"title" : "JobStateDelayed",
"type" : "string",
"description" : "The job has been delayed for retry after a failure.",
"enum" : [ "delayed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateDelayed": _job_state_delayed_model_schema})
-_job_state_failed_model_schema = json.loads(r"""{
+_job_state_failed_model_schema = json.loads(
+ r"""{
"title" : "JobStateFailed",
"type" : "string",
"description" : "The job failed in execution.",
"enum" : [ "failed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateFailed": _job_state_failed_model_schema})
-_job_state_finished_model_schema = json.loads(r"""{
+_job_state_finished_model_schema = json.loads(
+ r"""{
"title" : "JobStateFinished",
"description" : "The job completed successfully or with failure.",
"anyOf" : [ {
@@ -3249,10 +3677,13 @@
"$ref" : "#/components/schemas/JobStateFailed"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateFinished": _job_state_finished_model_schema})
-_job_state_result_model_schema = json.loads(r"""{
+_job_state_result_model_schema = json.loads(
+ r"""{
"title" : "JobStateResult",
"description" : "All reported job states",
"anyOf" : [ {
@@ -3261,39 +3692,51 @@
"$ref" : "#/components/schemas/JobStateUnknown"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateResult": _job_state_result_model_schema})
-_job_state_unknown_model_schema = json.loads(r"""{
+_job_state_unknown_model_schema = json.loads(
+ r"""{
"title" : "JobStateUnknown",
"type" : "string",
"description" : "The job state is unknown (undocument or inconsistent).",
"enum" : [ "unknown" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateUnknown": _job_state_unknown_model_schema})
-_job_state_waiting_model_schema = json.loads(r"""{
+_job_state_waiting_model_schema = json.loads(
+ r"""{
"title" : "JobStateWaiting",
"type" : "string",
"description" : "The job has been queued for execution, but might be waiting because of rate limiting.",
"enum" : [ "waiting" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStateWaiting": _job_state_waiting_model_schema})
-_job_state_waiting_children_model_schema = json.loads(r"""{
+_job_state_waiting_children_model_schema = json.loads(
+ r"""{
"title" : "JobStateWaitingChildren",
"type" : "string",
"description" : "The job is waiting for child jobs to be completed.",
"enum" : [ "waiting-children" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobStateWaitingChildren": _job_state_waiting_children_model_schema}
)
-_job_status_model_schema = json.loads(r"""{
+_job_status_model_schema = json.loads(
+ r"""{
"title" : "JobStatus",
"required" : [ "attemptsMade", "id", "name", "progress" ],
"type" : "object",
@@ -3336,10 +3779,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStatus": _job_status_model_schema})
-_job_status_and_entity_hal_links_model_schema = json.loads(r"""{
+_job_status_and_entity_hal_links_model_schema = json.loads(
+ r"""{
"title" : "JobStatusAndEntityHALLinks",
"description" : "HAL links to related actions.",
"anyOf" : [ {
@@ -3352,12 +3798,15 @@
"$ref" : "#/components/schemas/JobStatusHALLink"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobStatusAndEntityHALLinks": _job_status_and_entity_hal_links_model_schema}
)
-_job_status_hal_link_model_schema = json.loads(r"""{
+_job_status_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"job" : {
@@ -3366,10 +3815,13 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStatusHALLink": _job_status_hal_link_model_schema})
-_job_status_progress_model_schema = json.loads(r"""{
+_job_status_progress_model_schema = json.loads(
+ r"""{
"title" : "JobStatus_progress",
"anyOf" : [ {
"type" : "number"
@@ -3377,10 +3829,13 @@
"type" : "object"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobStatus_progress": _job_status_progress_model_schema})
-_job_submitted_response_model_schema = json.loads(r"""{
+_job_submitted_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message" ],
"type" : "object",
"properties" : {
@@ -3392,54 +3847,72 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobSubmittedResponse": _job_submitted_response_model_schema})
-_job_type_model_schema = json.loads(r"""{
+_job_type_model_schema = json.loads(
+ r"""{
"title" : "JobType",
"type" : "string",
"enum" : [ "build", "deploy", "verify", "undeploy", "batch", "scale", "cleanup", "other" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobType": _job_type_model_schema})
-_job_type_batch_model_schema = json.loads(r"""{
+_job_type_batch_model_schema = json.loads(
+ r"""{
"title" : "JobTypeBatch",
"type" : "string",
"description" : "A job that groups other jobs as a parent.",
"enum" : [ "batch" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeBatch": _job_type_batch_model_schema})
-_job_type_build_model_schema = json.loads(r"""{
+_job_type_build_model_schema = json.loads(
+ r"""{
"title" : "JobTypeBuild",
"type" : "string",
"description" : "Build",
"enum" : [ "build" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeBuild": _job_type_build_model_schema})
-_job_type_deploy_model_schema = json.loads(r"""{
+_job_type_deploy_model_schema = json.loads(
+ r"""{
"title" : "JobTypeDeploy",
"type" : "string",
"description" : "A job that deploys a function image to the openfaas runtime.",
"enum" : [ "deploy" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeDeploy": _job_type_deploy_model_schema})
-_job_type_scale_model_schema = json.loads(r"""{
+_job_type_scale_model_schema = json.loads(
+ r"""{
"title" : "JobTypeScale",
"type" : "string",
"description" : "A job that scales a function to a target.",
"enum" : [ "scale" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeScale": _job_type_scale_model_schema})
-_job_type_schema_model_schema = json.loads(r"""{
+_job_type_schema_model_schema = json.loads(
+ r"""{
"title" : "JobTypeSchema",
"anyOf" : [ {
"$ref" : "#/components/schemas/JobTypeBuild"
@@ -3455,28 +3928,37 @@
"$ref" : "#/components/schemas/JobTypeBatch"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeSchema": _job_type_schema_model_schema})
-_job_type_undeploy_model_schema = json.loads(r"""{
+_job_type_undeploy_model_schema = json.loads(
+ r"""{
"title" : "JobTypeUndeploy",
"type" : "string",
"description" : "A job that undeploys a deployed function and removes it from the registry.",
"enum" : [ "undeploy" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeUndeploy": _job_type_undeploy_model_schema})
-_job_type_verify_model_schema = json.loads(r"""{
+_job_type_verify_model_schema = json.loads(
+ r"""{
"title" : "JobTypeVerify",
"type" : "string",
"description" : "A job that checks the health of a deployed function.",
"enum" : [ "verify" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobTypeVerify": _job_type_verify_model_schema})
-_jobs_for_model_response_v2_model_schema = json.loads(r"""{
+_jobs_for_model_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "function", "jobs" ],
"type" : "object",
"properties" : {
@@ -3496,12 +3978,15 @@
},
"description" : "Model Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobsForModelResponseV2": _jobs_for_model_response_v2_model_schema}
)
-_jobs_for_model_response_v2__links_model_schema = json.loads(r"""{
+_jobs_for_model_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "JobsForModelResponseV2__links",
"type" : "object",
"properties" : {
@@ -3512,12 +3997,15 @@
"additionalProperties" : false,
"description" : "Link to the function entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobsForModelResponseV2__links": _jobs_for_model_response_v2__links_model_schema}
)
-_jobs_for_plug_response_v2_model_schema = json.loads(r"""{
+_jobs_for_plug_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "function", "jobs" ],
"type" : "object",
"properties" : {
@@ -3537,12 +4025,15 @@
},
"description" : "Plug Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobsForPlugResponseV2": _jobs_for_plug_response_v2_model_schema}
)
-_jobs_for_plug_response_v2__links_model_schema = json.loads(r"""{
+_jobs_for_plug_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "JobsForPlugResponseV2__links",
"type" : "object",
"properties" : {
@@ -3553,12 +4044,15 @@
"additionalProperties" : false,
"description" : "Link to the function entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobsForPlugResponseV2__links": _jobs_for_plug_response_v2__links_model_schema}
)
-_jobs_for_webscript_response_v2_model_schema = json.loads(r"""{
+_jobs_for_webscript_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "function", "jobs" ],
"type" : "object",
"properties" : {
@@ -3578,12 +4072,15 @@
},
"description" : "Webscript Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"JobsForWebscriptResponseV2": _jobs_for_webscript_response_v2_model_schema}
)
-_jobs_for_webscript_response_v2__links_model_schema = json.loads(r"""{
+_jobs_for_webscript_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "JobsForWebscriptResponseV2__links",
"type" : "object",
"properties" : {
@@ -3594,14 +4091,17 @@
"additionalProperties" : false,
"description" : "Link to the function entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"JobsForWebscriptResponseV2__links": _jobs_for_webscript_response_v2__links_model_schema
}
)
-_jobs_hal_link_model_schema = json.loads(r"""{
+_jobs_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"jobs" : {
@@ -3609,10 +4109,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobsHALLink": _jobs_hal_link_model_schema})
-_jobs_response_model_schema = json.loads(r"""{
+_jobs_response_model_schema = json.loads(
+ r"""{
"required" : [ "jobs" ],
"type" : "object",
"properties" : {
@@ -3630,10 +4133,13 @@
},
"description" : "Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"JobsResponse": _jobs_response_model_schema})
-_kf_serving_delete_multiple_response_model_schema = json.loads(r"""{
+_kf_serving_delete_multiple_response_model_schema = json.loads(
+ r"""{
"required" : [ "name", "versions" ],
"type" : "object",
"properties" : {
@@ -3649,14 +4155,17 @@
},
"description" : "Models Deleted"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"KFServingDeleteMultipleResponse": _kf_serving_delete_multiple_response_model_schema
}
)
-_kf_serving_delete_multiple_with_job_response_model_schema = json.loads(r"""{
+_kf_serving_delete_multiple_with_job_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message", "name", "versions" ],
"type" : "object",
"properties" : {
@@ -3678,14 +4187,17 @@
},
"description" : "Model Deletions Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"KFServingDeleteMultipleWithJobResponse": _kf_serving_delete_multiple_with_job_response_model_schema
}
)
-_kf_serving_delete_query_v1_model_schema = json.loads(r"""{
+_kf_serving_delete_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -3768,12 +4280,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"KFServingDeleteQueryV1": _kf_serving_delete_query_v1_model_schema}
)
-_kf_serving_delete_query_v2_model_schema = json.loads(r"""{
+_kf_serving_delete_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -3796,12 +4311,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"KFServingDeleteQueryV2": _kf_serving_delete_query_v2_model_schema}
)
-_kf_serving_delete_response_model_schema = json.loads(r"""{
+_kf_serving_delete_response_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -3815,12 +4333,15 @@
},
"description" : "Model Deleted"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"KFServingDeleteResponse": _kf_serving_delete_response_model_schema}
)
-_kf_serving_delete_with_job_response_model_schema = json.loads(r"""{
+_kf_serving_delete_with_job_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message", "name", "version" ],
"type" : "object",
"properties" : {
@@ -3840,14 +4361,17 @@
},
"description" : "Model Delete Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"KFServingDeleteWithJobResponse": _kf_serving_delete_with_job_response_model_schema
}
)
-_kf_serving_latest_version_query_v2_model_schema = json.loads(r"""{
+_kf_serving_latest_version_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -3862,12 +4386,15 @@
"additionalProperties" : false,
"description" : "Named Model latest version query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"KFServingLatestVersionQueryV2": _kf_serving_latest_version_query_v2_model_schema}
)
-_kf_serving_latest_versions_query_v1_model_schema = json.loads(r"""{
+_kf_serving_latest_versions_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -3946,14 +4473,17 @@
"additionalProperties" : false,
"description" : "Model listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"KFServingLatestVersionsQueryV1": _kf_serving_latest_versions_query_v1_model_schema
}
)
-_kf_serving_latest_versions_query_v2_model_schema = json.loads(r"""{
+_kf_serving_latest_versions_query_v2_model_schema = json.loads(
+ r"""{
"description" : "Latest model versions listing query.",
"anyOf" : [ {
"$ref" : "#/components/schemas/LatestFunctionVersionsQuery"
@@ -3961,14 +4491,17 @@
"$ref" : "#/components/schemas/LatestFunctionsQuery"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"KFServingLatestVersionsQueryV2": _kf_serving_latest_versions_query_v2_model_schema
}
)
-_kf_serving_manifest_model_schema = json.loads(r"""{
+_kf_serving_manifest_model_schema = json.loads(
+ r"""{
"title" : "KFServingManifest",
"required" : [ "metadata", "name", "runtime", "version" ],
"type" : "object",
@@ -3995,10 +4528,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"KFServingManifest": _kf_serving_manifest_model_schema})
-_kf_serving_models_response_model_schema = json.loads(r"""{
+_kf_serving_models_response_model_schema = json.loads(
+ r"""{
"required" : [ "models" ],
"type" : "object",
"properties" : {
@@ -4014,12 +4550,15 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"KFServingModelsResponse": _kf_serving_models_response_model_schema}
)
-_kf_serving_response_model_schema = json.loads(r"""{
+_kf_serving_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "metadata", "name", "runtime", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -4076,10 +4615,13 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"KFServingResponse": _kf_serving_response_model_schema})
-_kf_serving_versions_query_v1_model_schema = json.loads(r"""{
+_kf_serving_versions_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -4150,12 +4692,15 @@
"additionalProperties" : false,
"description" : "Named model versions query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"KFServingVersionsQueryV1": _kf_serving_versions_query_v1_model_schema}
)
-_keep_alive_event_sse_model_schema = json.loads(r"""{
+_keep_alive_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "event" ],
"type" : "object",
"properties" : {
@@ -4169,10 +4714,13 @@
},
"description" : "A message that acknowledges that the stream is still alive."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"KeepAliveEventSSE": _keep_alive_event_sse_model_schema})
-_kfserving_response_v2_model_schema = json.loads(r"""{
+_kfserving_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "model", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
"properties" : {
@@ -4223,10 +4771,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"KfservingResponseV2": _kfserving_response_v2_model_schema})
-_language_release_model_schema = json.loads(r"""{
+_language_release_model_schema = json.loads(
+ r"""{
"title" : "LanguageRelease",
"required" : [ "name", "title", "version" ],
"type" : "object",
@@ -4253,10 +4804,13 @@
},
"description" : "Description of the language or framework release used by a runtime (version)."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LanguageRelease": _language_release_model_schema})
-_latest_function_versions_query_model_schema = json.loads(r"""{
+_latest_function_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -4354,12 +4908,15 @@
"additionalProperties" : false,
"description" : "Latest function versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestFunctionVersionsQuery": _latest_function_versions_query_model_schema}
)
-_latest_functions_query_model_schema = json.loads(r"""{
+_latest_functions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -4402,10 +4959,13 @@
"additionalProperties" : false,
"description" : "Request to list latest function versions per named function. A request that only uses these query parameters will include links to the _latest_ draft/published versions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LatestFunctionsQuery": _latest_functions_query_model_schema})
-_latest_models_response_v2_model_schema = json.loads(r"""{
+_latest_models_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -4431,12 +4991,15 @@
},
"description" : "Models Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestModelsResponseV2": _latest_models_response_v2_model_schema}
)
-_latest_models_response_v2_entities_inner_model_schema = json.loads(r"""{
+_latest_models_response_v2_entities_inner_model_schema = json.loads(
+ r"""{
"title" : "LatestModelsResponseV2_entities_inner",
"required" : [ "_links", "createdAt", "createdBy", "deprecated", "draft", "model", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
@@ -4498,14 +5061,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LatestModelsResponseV2_entities_inner": _latest_models_response_v2_entities_inner_model_schema
}
)
-_latest_plug_query_model_schema = json.loads(r"""{
+_latest_plug_query_model_schema = json.loads(
+ r"""{
"required" : [ "type" ],
"type" : "object",
"properties" : {
@@ -4590,10 +5156,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LatestPlugQuery": _latest_plug_query_model_schema})
-_latest_plug_version_query_v2_model_schema = json.loads(r"""{
+_latest_plug_version_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -4611,12 +5180,15 @@
"additionalProperties" : false,
"description" : "Latest named plug version listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestPlugVersionQueryV2": _latest_plug_version_query_v2_model_schema}
)
-_latest_plug_versions_query_model_schema = json.loads(r"""{
+_latest_plug_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"tags" : {
@@ -4720,12 +5292,15 @@
"additionalProperties" : false,
"description" : "Plug versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestPlugVersionsQuery": _latest_plug_versions_query_model_schema}
)
-_latest_plug_versions_query_v2_model_schema = json.loads(r"""{
+_latest_plug_versions_query_v2_model_schema = json.loads(
+ r"""{
"description" : "Latest plug versions listing query.",
"anyOf" : [ {
"$ref" : "#/components/schemas/LatestPlugVersionsQuery"
@@ -4733,12 +5308,15 @@
"$ref" : "#/components/schemas/LatestPlugsQuery"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestPlugVersionsQueryV2": _latest_plug_versions_query_v2_model_schema}
)
-_latest_plugs_query_model_schema = json.loads(r"""{
+_latest_plugs_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -4784,10 +5362,13 @@
"additionalProperties" : false,
"description" : "Latest plug versions listing query with latest links. A request that only uses these query parameters will include links to the _latest_ draft/published versions of the plug."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LatestPlugsQuery": _latest_plugs_query_model_schema})
-_latest_plugs_response_v2_model_schema = json.loads(r"""{
+_latest_plugs_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -4813,12 +5394,15 @@
},
"description" : "Plugs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestPlugsResponseV2": _latest_plugs_response_v2_model_schema}
)
-_latest_plugs_response_v2_entities_inner_model_schema = json.loads(r"""{
+_latest_plugs_response_v2_entities_inner_model_schema = json.loads(
+ r"""{
"title" : "LatestPlugsResponseV2_entities_inner",
"required" : [ "_links", "createdAt", "createdBy", "deprecated", "draft", "plug", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
@@ -4880,23 +5464,29 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LatestPlugsResponseV2_entities_inner": _latest_plugs_response_v2_entities_inner_model_schema
}
)
-_latest_version_level_model_schema = json.loads(r"""{
+_latest_version_level_model_schema = json.loads(
+ r"""{
"title" : "LatestVersionLevel",
"type" : "string",
"description" : "Level of latest versions that should be included.",
"enum" : [ "major", "minor", "patch", "true", "false" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LatestVersionLevel": _latest_version_level_model_schema})
-_latest_webscripts_response_v2_model_schema = json.loads(r"""{
+_latest_webscripts_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -4922,12 +5512,15 @@
},
"description" : "Webscripts Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LatestWebscriptsResponseV2": _latest_webscripts_response_v2_model_schema}
)
-_latest_webscripts_response_v2_entities_inner_model_schema = json.loads(r"""{
+_latest_webscripts_response_v2_entities_inner_model_schema = json.loads(
+ r"""{
"title" : "LatestWebscriptsResponseV2_entities_inner",
"required" : [ "_links", "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates", "webscript" ],
"type" : "object",
@@ -4994,14 +5587,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LatestWebscriptsResponseV2_entities_inner": _latest_webscripts_response_v2_entities_inner_model_schema
}
)
-_legacy_configuration_object_model_schema = json.loads(r"""{
+_legacy_configuration_object_model_schema = json.loads(
+ r"""{
"title" : "LegacyConfigurationObject",
"required" : [ "name", "type" ],
"type" : "object",
@@ -5025,12 +5621,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyConfigurationObject": _legacy_configuration_object_model_schema}
)
-_legacy_configuration_object_format_model_schema = json.loads(r"""{
+_legacy_configuration_object_format_model_schema = json.loads(
+ r"""{
"title" : "LegacyConfigurationObject_format",
"type" : "object",
"properties" : {
@@ -5046,14 +5645,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LegacyConfigurationObject_format": _legacy_configuration_object_format_model_schema
}
)
-_legacy_configuration_response_object_model_schema = json.loads(r"""{
+_legacy_configuration_response_object_model_schema = json.loads(
+ r"""{
"title" : "LegacyConfigurationResponseObject",
"required" : [ "name", "type" ],
"type" : "object",
@@ -5081,14 +5683,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LegacyConfigurationResponseObject": _legacy_configuration_response_object_model_schema
}
)
-_legacy_create_debug_response_model_schema = json.loads(r"""{
+_legacy_create_debug_response_model_schema = json.loads(
+ r"""{
"required" : [ "functionName" ],
"type" : "object",
"properties" : {
@@ -5097,12 +5702,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyCreateDebugResponse": _legacy_create_debug_response_model_schema}
)
-_legacy_debug_plug_manifest_model_schema = json.loads(r"""{
+_legacy_debug_plug_manifest_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "runtime", "script", "tenant", "version" ],
"type" : "object",
"properties" : {
@@ -5137,12 +5745,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyDebugPlugManifest": _legacy_debug_plug_manifest_model_schema}
)
-_legacy_debug_plug_request_model_schema = json.loads(r"""{
+_legacy_debug_plug_request_model_schema = json.loads(
+ r"""{
"required" : [ "script" ],
"type" : "object",
"properties" : {
@@ -5161,12 +5772,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyDebugPlugRequest": _legacy_debug_plug_request_model_schema}
)
-_legacy_documentation_model_schema = json.loads(r"""{
+_legacy_documentation_model_schema = json.loads(
+ r"""{
"required" : [ "configuration", "rawData", "supportedStates" ],
"type" : "object",
"properties" : {
@@ -5190,10 +5804,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LegacyDocumentation": _legacy_documentation_model_schema})
-_legacy_documentation_request_model_schema = json.loads(r"""{
+_legacy_documentation_request_model_schema = json.loads(
+ r"""{
"required" : [ "configuration", "rawData", "supportedStates" ],
"type" : "object",
"properties" : {
@@ -5221,12 +5838,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyDocumentationRequest": _legacy_documentation_request_model_schema}
)
-_legacy_function_meta_model_schema = json.loads(r"""{
+_legacy_function_meta_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -5252,10 +5872,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LegacyFunctionMeta": _legacy_function_meta_model_schema})
-_legacy_plug_create_query_model_schema = json.loads(r"""{
+_legacy_plug_create_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -5274,12 +5897,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugCreateQuery": _legacy_plug_create_query_model_schema}
)
-_legacy_plug_create_request_model_schema = json.loads(r"""{
+_legacy_plug_create_request_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "script", "version" ],
"type" : "object",
"properties" : {
@@ -5304,12 +5930,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugCreateRequest": _legacy_plug_create_request_model_schema}
)
-_legacy_plug_create_response_model_schema = json.loads(r"""{
+_legacy_plug_create_response_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "statusCode", "uri" ],
"type" : "object",
"properties" : {
@@ -5324,12 +5953,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugCreateResponse": _legacy_plug_create_response_model_schema}
)
-_legacy_plug_meta_request_model_schema = json.loads(r"""{
+_legacy_plug_meta_request_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -5362,12 +5994,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugMetaRequest": _legacy_plug_meta_request_model_schema}
)
-_legacy_plug_query_model_schema = json.loads(r"""{
+_legacy_plug_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -5448,10 +6083,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LegacyPlugQuery": _legacy_plug_query_model_schema})
-_legacy_plug_request_model_schema = json.loads(r"""{
+_legacy_plug_request_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "script", "type", "version" ],
"type" : "object",
"properties" : {
@@ -5476,10 +6114,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LegacyPlugRequest": _legacy_plug_request_model_schema})
-_legacy_plug_request_metadata_model_schema = json.loads(r"""{
+_legacy_plug_request_metadata_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugRequest_metadata",
"type" : "object",
"properties" : {
@@ -5540,12 +6181,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugRequest_metadata": _legacy_plug_request_metadata_model_schema}
)
-_legacy_plug_request_metadata_documentation_model_schema = json.loads(r"""{
+_legacy_plug_request_metadata_documentation_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugRequest_metadata_documentation",
"anyOf" : [ {
"$ref" : "#/components/schemas/LegacyPlugRequest_metadata_documentation_anyOf"
@@ -5553,14 +6197,17 @@
"$ref" : "#/components/schemas/Documentation"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LegacyPlugRequest_metadata_documentation": _legacy_plug_request_metadata_documentation_model_schema
}
)
-_legacy_plug_request_metadata_documentation_any_of_model_schema = json.loads(r"""{
+_legacy_plug_request_metadata_documentation_any_of_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"supportedStates" : {
@@ -5584,14 +6231,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LegacyPlugRequest_metadata_documentation_anyOf": _legacy_plug_request_metadata_documentation_any_of_model_schema
}
)
-_legacy_plug_request_metadata_raw_data_inner_model_schema = json.loads(r"""{
+_legacy_plug_request_metadata_raw_data_inner_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugRequest_metadata_rawData_inner",
"required" : [ "parameter" ],
"type" : "object",
@@ -5606,14 +6256,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LegacyPlugRequest_metadata_rawData_inner": _legacy_plug_request_metadata_raw_data_inner_model_schema
}
)
-_legacy_plug_response_model_schema = json.loads(r"""{
+_legacy_plug_response_model_schema = json.loads(
+ r"""{
"required" : [ "commands", "isDeprecated", "mediaType", "metadata", "name", "status", "version" ],
"type" : "object",
"properties" : {
@@ -5679,10 +6332,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LegacyPlugResponse": _legacy_plug_response_model_schema})
-_legacy_plug_response_metadata_model_schema = json.loads(r"""{
+_legacy_plug_response_metadata_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugResponse_metadata",
"type" : "object",
"properties" : {
@@ -5718,12 +6374,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugResponse_metadata": _legacy_plug_response_metadata_model_schema}
)
-_legacy_plug_script_meta_model_schema = json.loads(r"""{
+_legacy_plug_script_meta_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugScriptMeta",
"required" : [ "rawData", "supportedStates" ],
"type" : "object",
@@ -5774,12 +6433,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugScriptMeta": _legacy_plug_script_meta_model_schema}
)
-_legacy_plug_script_meta_raw_data_inner_model_schema = json.loads(r"""{
+_legacy_plug_script_meta_raw_data_inner_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugScriptMeta_rawData_inner",
"required" : [ "parameter" ],
"type" : "object",
@@ -5794,14 +6456,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"LegacyPlugScriptMeta_rawData_inner": _legacy_plug_script_meta_raw_data_inner_model_schema
}
)
-_legacy_plug_script_response_model_schema = json.loads(r"""{
+_legacy_plug_script_response_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugScriptResponse",
"required" : [ "dependencies", "metadata", "name", "script", "type", "version" ],
"type" : "object",
@@ -5829,12 +6494,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyPlugScriptResponse": _legacy_plug_script_response_model_schema}
)
-_legacy_required_properties_inner_model_schema = json.loads(r"""{
+_legacy_required_properties_inner_model_schema = json.loads(
+ r"""{
"title" : "LegacyRequiredProperties_inner",
"anyOf" : [ {
"type" : "string"
@@ -5842,12 +6510,15 @@
"$ref" : "#/components/schemas/LegacyRequiredPropertyObject"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyRequiredProperties_inner": _legacy_required_properties_inner_model_schema}
)
-_legacy_required_property_object_model_schema = json.loads(r"""{
+_legacy_required_property_object_model_schema = json.loads(
+ r"""{
"required" : [ "mandatory", "name", "sensitive", "type" ],
"type" : "object",
"properties" : {
@@ -5865,12 +6536,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"LegacyRequiredPropertyObject": _legacy_required_property_object_model_schema}
)
-_limit_query_model_schema = json.loads(r"""{
+_limit_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -5881,18 +6555,24 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"LimitQuery": _limit_query_model_schema})
-_media_type_model_schema = json.loads(r"""{
+_media_type_model_schema = json.loads(
+ r"""{
"title" : "MediaType",
"type" : "string",
"enum" : [ "application/javascript", "application/java-vm", "text/x-python", "text/x-golang" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"MediaType": _media_type_model_schema})
-_message_and_status_response_model_schema = json.loads(r"""{
+_message_and_status_response_model_schema = json.loads(
+ r"""{
"required" : [ "message", "statusCode" ],
"type" : "object",
"properties" : {
@@ -5904,12 +6584,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"MessageAndStatusResponse": _message_and_status_response_model_schema}
)
-_message_response_model_schema = json.loads(r"""{
+_message_response_model_schema = json.loads(
+ r"""{
"required" : [ "message" ],
"type" : "object",
"properties" : {
@@ -5918,10 +6601,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"MessageResponse": _message_response_model_schema})
-_model_model_schema = json.loads(r"""{
+_model_model_schema = json.loads(
+ r"""{
"title" : "Model",
"required" : [ "model" ],
"type" : "object",
@@ -5934,10 +6620,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Model": _model_model_schema})
-_model_1_model_schema = json.loads(r"""{
+_model_1_model_schema = json.loads(
+ r"""{
"title" : "Model",
"required" : [ "model" ],
"type" : "object",
@@ -5953,10 +6642,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Model_1": _model_1_model_schema})
-_model_2_model_schema = json.loads(r"""{
+_model_2_model_schema = json.loads(
+ r"""{
"title" : "Model",
"required" : [ "model" ],
"type" : "object",
@@ -5969,10 +6661,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Model_2": _model_2_model_schema})
-_model_versions_response_v2_model_schema = json.loads(r"""{
+_model_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -5998,12 +6693,15 @@
},
"description" : "Model Versions Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"ModelVersionsResponseV2": _model_versions_response_v2_model_schema}
)
-_multipart_file_upload__model_schema = json.loads(r"""{
+_multipart_file_upload__model_schema = json.loads(
+ r"""{
"title" : "Multipart file upload.",
"type" : "object",
"properties" : {
@@ -6018,12 +6716,15 @@
"description" : "A multi-part upload containing one or more file assets.",
"nullable" : true
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"Multipart_file_upload_": _multipart_file_upload__model_schema}
)
-_name_model_schema = json.loads(r"""{
+_name_model_schema = json.loads(
+ r"""{
"required" : [ "name" ],
"type" : "object",
"properties" : {
@@ -6033,10 +6734,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Name": _name_model_schema})
-_name_and_version_model_schema = json.loads(r"""{
+_name_and_version_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -6049,10 +6753,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"NameAndVersion": _name_and_version_model_schema})
-_named_function_versions_query_model_schema = json.loads(r"""{
+_named_function_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -6127,12 +6834,15 @@
"additionalProperties" : false,
"description" : "Named function versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"NamedFunctionVersionsQuery": _named_function_versions_query_model_schema}
)
-_named_kf_serving_versions_query_v2_model_schema = json.loads(r"""{
+_named_kf_serving_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -6207,12 +6917,15 @@
"additionalProperties" : false,
"description" : "Named Model versions query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"NamedKFServingVersionsQueryV2": _named_kf_serving_versions_query_v2_model_schema}
)
-_named_parameters_typeof_as_job_reference__model_schema = json.loads(r"""{
+_named_parameters_typeof_as_job_reference__model_schema = json.loads(
+ r"""{
"required" : [ "jobStatus" ],
"type" : "object",
"properties" : {
@@ -6222,14 +6935,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"NamedParameters_typeof_asJobReference_": _named_parameters_typeof_as_job_reference__model_schema
}
)
-_named_parameters_typeof_as_job_reference__job_status_model_schema = json.loads(r"""{
+_named_parameters_typeof_as_job_reference__job_status_model_schema = json.loads(
+ r"""{
"title" : "NamedParameters_typeof_asJobReference__jobStatus",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -6279,14 +6995,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"NamedParameters_typeof_asJobReference__jobStatus": _named_parameters_typeof_as_job_reference__job_status_model_schema
}
)
-_named_parameters_typeof_from_legacy__model_schema = json.loads(r"""{
+_named_parameters_typeof_from_legacy__model_schema = json.loads(
+ r"""{
"required" : [ "metadata" ],
"type" : "object",
"properties" : {
@@ -6299,14 +7018,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"NamedParameters_typeof_fromLegacy_": _named_parameters_typeof_from_legacy__model_schema
}
)
-_named_parameters_typeof_from_legacy_documentation__model_schema = json.loads(r"""{
+_named_parameters_typeof_from_legacy_documentation__model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"legacyDocumentation" : {
@@ -6318,14 +7040,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"NamedParameters_typeof_fromLegacyDocumentation_": _named_parameters_typeof_from_legacy_documentation__model_schema
}
)
-_named_parameters_typeof_is_not_legacy__model_schema = json.loads(r"""{
+_named_parameters_typeof_is_not_legacy__model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"documentation" : {
@@ -6334,14 +7059,17 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"NamedParameters_typeof_isNotLegacy_": _named_parameters_typeof_is_not_legacy__model_schema
}
)
-_named_plug_versions_query_v2_model_schema = json.loads(r"""{
+_named_plug_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"tags" : {
@@ -6419,12 +7147,15 @@
"additionalProperties" : false,
"description" : "Named plug version listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"NamedPlugVersionsQueryV2": _named_plug_versions_query_v2_model_schema}
)
-_named_versions_filter_model_schema = json.loads(r"""{
+_named_versions_filter_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"nameVersion" : {
@@ -6437,10 +7168,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"NamedVersionsFilter": _named_versions_filter_model_schema})
-_named_webscript_versions_query_v2_model_schema = json.loads(r"""{
+_named_webscript_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -6515,12 +7249,15 @@
"additionalProperties" : false,
"description" : "Webscript named versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"NamedWebscriptVersionsQueryV2": _named_webscript_versions_query_v2_model_schema}
)
-_openfaas_deploy_args_model_schema = json.loads(r"""{
+_openfaas_deploy_args_model_schema = json.loads(
+ r"""{
"required" : [ "endpoint", "imageName", "namespace" ],
"type" : "object",
"properties" : {
@@ -6538,10 +7275,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"OpenfaasDeployArgs": _openfaas_deploy_args_model_schema})
-_openfaas_function_ref_model_schema = json.loads(r"""{
+_openfaas_function_ref_model_schema = json.loads(
+ r"""{
"required" : [ "endpoint", "namespace" ],
"type" : "object",
"properties" : {
@@ -6555,10 +7295,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"OpenfaasFunctionRef": _openfaas_function_ref_model_schema})
-_operation_model_schema = json.loads(r"""{
+_operation_model_schema = json.loads(
+ r"""{
"required" : [ "description", "id", "name", "type" ],
"type" : "object",
"properties" : {
@@ -6577,10 +7320,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Operation": _operation_model_schema})
-_operation_status_model_schema = json.loads(r"""{
+_operation_status_model_schema = json.loads(
+ r"""{
"required" : [ "description", "done", "id", "name", "type" ],
"type" : "object",
"properties" : {
@@ -6605,10 +7351,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"OperationStatus": _operation_status_model_schema})
-_operation_status_error_model_schema = json.loads(r"""{
+_operation_status_error_model_schema = json.loads(
+ r"""{
"title" : "OperationStatus_error",
"required" : [ "code", "message", "name" ],
"type" : "object",
@@ -6631,12 +7380,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"OperationStatus_error": _operation_status_error_model_schema}
)
-_paging_query_model_schema = json.loads(r"""{
+_paging_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -6652,10 +7404,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PagingQuery": _paging_query_model_schema})
-_paging_response_model_schema = json.loads(r"""{
+_paging_response_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"count" : {
@@ -6672,10 +7427,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PagingResponse": _paging_response_model_schema})
-_parent_keys_model_schema = json.loads(r"""{
+_parent_keys_model_schema = json.loads(
+ r"""{
"title" : "ParentKeys",
"required" : [ "id" ],
"type" : "object",
@@ -6686,10 +7444,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ParentKeys": _parent_keys_model_schema})
-_patch_interface_query_model_schema = json.loads(r"""{
+_patch_interface_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -6699,10 +7460,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PatchInterfaceQuery": _patch_interface_query_model_schema})
-_patch_metadata_query_model_schema = json.loads(r"""{
+_patch_metadata_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -6712,10 +7476,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PatchMetadataQuery": _patch_metadata_query_model_schema})
-_patch_plug_request_v1_model_schema = json.loads(r"""{
+_patch_plug_request_v1_model_schema = json.loads(
+ r"""{
"required" : [ "metadata" ],
"type" : "object",
"properties" : {
@@ -6725,10 +7492,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PatchPlugRequestV1": _patch_plug_request_v1_model_schema})
-_plug_model_schema = json.loads(r"""{
+_plug_model_schema = json.loads(
+ r"""{
"title" : "Plug",
"required" : [ "plug" ],
"type" : "object",
@@ -6741,10 +7511,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Plug": _plug_model_schema})
-_plug_1_model_schema = json.loads(r"""{
+_plug_1_model_schema = json.loads(
+ r"""{
"title" : "Plug",
"required" : [ "plug" ],
"type" : "object",
@@ -6760,10 +7533,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Plug_1": _plug_1_model_schema})
-_plug_2_model_schema = json.loads(r"""{
+_plug_2_model_schema = json.loads(
+ r"""{
"title" : "Plug",
"required" : [ "plug" ],
"type" : "object",
@@ -6776,10 +7552,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Plug_2": _plug_2_model_schema})
-_plug_delete_force_query_model_schema = json.loads(r"""{
+_plug_delete_force_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"force" : {
@@ -6789,12 +7568,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PlugDeleteForceQuery": _plug_delete_force_query_model_schema}
)
-_plug_delete_query_model_schema = json.loads(r"""{
+_plug_delete_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"force" : {
@@ -6808,10 +7590,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugDeleteQuery": _plug_delete_query_model_schema})
-_plug_interface_model_schema = json.loads(r"""{
+_plug_interface_model_schema = json.loads(
+ r"""{
"title" : "PlugInterface",
"type" : "object",
"properties" : {
@@ -6841,10 +7626,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugInterface": _plug_interface_model_schema})
-_plug_listing_and_query_response_model_schema = json.loads(r"""{
+_plug_listing_and_query_response_model_schema = json.loads(
+ r"""{
"required" : [ "plugs" ],
"type" : "object",
"properties" : {
@@ -6869,12 +7657,15 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PlugListingAndQueryResponse": _plug_listing_and_query_response_model_schema}
)
-_plug_listing_response_model_schema = json.loads(r"""{
+_plug_listing_response_model_schema = json.loads(
+ r"""{
"required" : [ "plugs" ],
"type" : "object",
"properties" : {
@@ -6887,10 +7678,13 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugListingResponse": _plug_listing_response_model_schema})
-_plug_manifest_model_schema = json.loads(r"""{
+_plug_manifest_model_schema = json.loads(
+ r"""{
"title" : "PlugManifest",
"required" : [ "interface", "metadata", "name", "runtime", "type", "version" ],
"type" : "object",
@@ -6923,10 +7717,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugManifest": _plug_manifest_model_schema})
-_plug_meta_model_schema = json.loads(r"""{
+_plug_meta_model_schema = json.loads(
+ r"""{
"title" : "PlugMeta",
"type" : "object",
"properties" : {
@@ -6981,10 +7778,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugMeta": _plug_meta_model_schema})
-_plug_property_model_schema = json.loads(r"""{
+_plug_property_model_schema = json.loads(
+ r"""{
"title" : "PlugProperty",
"required" : [ "name" ],
"type" : "object",
@@ -7012,21 +7812,27 @@
},
"description" : "Interface specification of a plug property."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugProperty": _plug_property_model_schema})
-_plug_property_data_type_model_schema = json.loads(r"""{
+_plug_property_data_type_model_schema = json.loads(
+ r"""{
"title" : "PlugPropertyDataType",
"type" : "string",
"description" : "Datatype supported in plug input or output properties.",
"enum" : [ "string", "integer", "long", "float", "double", "boolean", "object" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PlugPropertyDataType": _plug_property_data_type_model_schema}
)
-_plug_property_format_model_schema = json.loads(r"""{
+_plug_property_format_model_schema = json.loads(
+ r"""{
"title" : "PlugPropertyFormat",
"type" : "object",
"properties" : {
@@ -7044,21 +7850,27 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugPropertyFormat": _plug_property_format_model_schema})
-_plug_property_format_type_model_schema = json.loads(r"""{
+_plug_property_format_type_model_schema = json.loads(
+ r"""{
"title" : "PlugPropertyFormatType",
"type" : "string",
"description" : "Value domain for a plug input or output property.",
"enum" : [ "enum", "resource", "vault", "duration", "code", "url", "date", "template" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PlugPropertyFormatType": _plug_property_format_type_model_schema}
)
-_plug_response_model_schema = json.loads(r"""{
+_plug_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "isDeprecated", "metadata", "name", "runtime", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -7117,10 +7929,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugResponse": _plug_response_model_schema})
-_plug_response_v2_model_schema = json.loads(r"""{
+_plug_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "plug", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
"properties" : {
@@ -7171,18 +7986,24 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugResponseV2": _plug_response_v2_model_schema})
-_plug_type_model_schema = json.loads(r"""{
+_plug_type_model_schema = json.loads(
+ r"""{
"title" : "PlugType",
"type" : "string",
"enum" : [ "sensor", "actuator", "transformer" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugType": _plug_type_model_schema})
-_plug_type_query_model_schema = json.loads(r"""{
+_plug_type_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -7191,10 +8012,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PlugTypeQuery": _plug_type_query_model_schema})
-_plug_versions_response_v2_model_schema = json.loads(r"""{
+_plug_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -7220,12 +8044,15 @@
},
"description" : "Plugs Versions Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PlugVersionsResponseV2": _plug_versions_response_v2_model_schema}
)
-_post_model_job_async_response_v2_model_schema = json.loads(r"""{
+_post_model_job_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7241,12 +8068,15 @@
},
"description" : "Model Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PostModelJobAsyncResponseV2": _post_model_job_async_response_v2_model_schema}
)
-_post_model_job_sync_response_v2_model_schema = json.loads(r"""{
+_post_model_job_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7259,12 +8089,15 @@
},
"description" : "Model Deployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PostModelJobSyncResponseV2": _post_model_job_sync_response_v2_model_schema}
)
-_post_plug_job_async_response_v2_model_schema = json.loads(r"""{
+_post_plug_job_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7280,12 +8113,15 @@
},
"description" : "Plug Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PostPlugJobAsyncResponseV2": _post_plug_job_async_response_v2_model_schema}
)
-_post_plug_job_sync_response_v2_model_schema = json.loads(r"""{
+_post_plug_job_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7298,12 +8134,15 @@
},
"description" : "Plug Deployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"PostPlugJobSyncResponseV2": _post_plug_job_sync_response_v2_model_schema}
)
-_post_webscript_job_async_response_v2_model_schema = json.loads(r"""{
+_post_webscript_job_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7319,14 +8158,17 @@
},
"description" : "Webscript Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"PostWebscriptJobAsyncResponseV2": _post_webscript_job_async_response_v2_model_schema
}
)
-_post_webscript_job_sync_response_v2_model_schema = json.loads(r"""{
+_post_webscript_job_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7339,14 +8181,17 @@
},
"description" : "Webscript Deployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"PostWebscriptJobSyncResponseV2": _post_webscript_job_sync_response_v2_model_schema
}
)
-_provided_dependency_model_schema = json.loads(r"""{
+_provided_dependency_model_schema = json.loads(
+ r"""{
"title" : "ProvidedDependency",
"required" : [ "name" ],
"type" : "object",
@@ -7399,10 +8244,13 @@
},
"description" : "Library dependency that is provided by this runtime."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ProvidedDependency": _provided_dependency_model_schema})
-_publish_function_query_model_schema = json.loads(r"""{
+_publish_function_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -7420,18 +8268,24 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"PublishFunctionQuery": _publish_function_query_model_schema})
-_queue_events_model_schema = json.loads(r"""{
+_queue_events_model_schema = json.loads(
+ r"""{
"title" : "QueueEvents",
"type" : "string",
"enum" : [ "completed", "failed", "active", "delayed", "waiting", "waiting-children", "added", "cleaned", "drained", "error", "paused", "progress", "removed", "resumed", "retries-exhausted", "stalled" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"QueueEvents": _queue_events_model_schema})
-_rebuild_computed_response_model_schema = json.loads(r"""{
+_rebuild_computed_response_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "message" ],
"type" : "object",
"properties" : {
@@ -7444,12 +8298,15 @@
},
"description" : "Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildComputedResponse": _rebuild_computed_response_model_schema}
)
-_rebuild_model_async_response_v2_model_schema = json.loads(r"""{
+_rebuild_model_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7468,12 +8325,15 @@
},
"description" : "Model Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildModelAsyncResponseV2": _rebuild_model_async_response_v2_model_schema}
)
-_rebuild_model_sync_response_v2_model_schema = json.loads(r"""{
+_rebuild_model_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7489,12 +8349,15 @@
},
"description" : "Model Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildModelSyncResponseV2": _rebuild_model_sync_response_v2_model_schema}
)
-_rebuild_plug_async_response_v2_model_schema = json.loads(r"""{
+_rebuild_plug_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7513,12 +8376,15 @@
},
"description" : "Plug Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildPlugAsyncResponseV2": _rebuild_plug_async_response_v2_model_schema}
)
-_rebuild_plug_sync_response_v2_model_schema = json.loads(r"""{
+_rebuild_plug_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7534,20 +8400,26 @@
},
"description" : "Plug Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildPlugSyncResponseV2": _rebuild_plug_sync_response_v2_model_schema}
)
-_rebuild_policy_model_schema = json.loads(r"""{
+_rebuild_policy_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "The policy to select a new runtime version when a rebuild is issued.",
"enum" : [ "patch", "minor", "major", "same" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RebuildPolicy": _rebuild_policy_model_schema})
-_rebuild_query_params_model_schema = json.loads(r"""{
+_rebuild_query_params_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"upgrade" : {
@@ -7575,10 +8447,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RebuildQueryParams": _rebuild_query_params_model_schema})
-_rebuild_query_v2_model_schema = json.loads(r"""{
+_rebuild_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -7615,10 +8490,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RebuildQueryV2": _rebuild_query_v2_model_schema})
-_rebuild_submitted_response_model_schema = json.loads(r"""{
+_rebuild_submitted_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "message" ],
"type" : "object",
"properties" : {
@@ -7634,12 +8512,15 @@
},
"description" : "Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildSubmittedResponse": _rebuild_submitted_response_model_schema}
)
-_rebuild_webscript_async_response_v2_model_schema = json.loads(r"""{
+_rebuild_webscript_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7658,14 +8539,17 @@
},
"description" : "Webscript Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"RebuildWebscriptAsyncResponseV2": _rebuild_webscript_async_response_v2_model_schema
}
)
-_rebuild_webscript_sync_response_v2_model_schema = json.loads(r"""{
+_rebuild_webscript_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -7681,12 +8565,15 @@
},
"description" : "Webscript Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RebuildWebscriptSyncResponseV2": _rebuild_webscript_sync_response_v2_model_schema}
)
-_remove_function_query_v2_model_schema = json.loads(r"""{
+_remove_function_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -7709,12 +8596,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RemoveFunctionQueryV2": _remove_function_query_v2_model_schema}
)
-_remove_plug_query_v2_model_schema = json.loads(r"""{
+_remove_plug_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -7737,19 +8627,25 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RemovePlugQueryV2": _remove_plug_query_v2_model_schema})
-_request_operation_model_schema = json.loads(r"""{
+_request_operation_model_schema = json.loads(
+ r"""{
"title" : "RequestOperation",
"type" : "string",
"description" : "A modifying operation on the function.",
"enum" : [ "create", "metadata-update", "assets-update", "rebuild", "verify", "publish", "deprecate", "undeploy" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RequestOperation": _request_operation_model_schema})
-_resource_limits_model_schema = json.loads(r"""{
+_resource_limits_model_schema = json.loads(
+ r"""{
"title" : "ResourceLimits",
"required" : [ "cpu", "memory" ],
"type" : "object",
@@ -7764,10 +8660,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ResourceLimits": _resource_limits_model_schema})
-_root_page_response_model_schema = json.loads(r"""{
+_root_page_response_model_schema = json.loads(
+ r"""{
"required" : [ "enabled", "name", "revision", "version" ],
"type" : "object",
"properties" : {
@@ -7789,10 +8688,13 @@
},
"description" : "Status Page"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RootPageResponse": _root_page_response_model_schema})
-_runtime_attributes_model_schema = json.loads(r"""{
+_runtime_attributes_model_schema = json.loads(
+ r"""{
"title" : "RuntimeAttributes",
"required" : [ "deprecated", "name", "upgradable", "version" ],
"type" : "object",
@@ -7815,10 +8717,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeAttributes": _runtime_attributes_model_schema})
-_runtime_info_model_schema = json.loads(r"""{
+_runtime_info_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "functionType", "name" ],
"type" : "object",
"properties" : {
@@ -7834,10 +8739,13 @@
},
"description" : "Runtime attributes that are the same for all versions of a runtime."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeInfo": _runtime_info_model_schema})
-_runtime_name_query_model_schema = json.loads(r"""{
+_runtime_name_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -7864,10 +8772,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeNameQuery": _runtime_name_query_model_schema})
-_runtime_params_model_schema = json.loads(r"""{
+_runtime_params_model_schema = json.loads(
+ r"""{
"required" : [ "name" ],
"type" : "object",
"properties" : {
@@ -7877,10 +8788,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeParams": _runtime_params_model_schema})
-_runtime_query_model_schema = json.loads(r"""{
+_runtime_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -7918,10 +8832,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeQuery": _runtime_query_model_schema})
-_runtime_reference_model_schema = json.loads(r"""{
+_runtime_reference_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -7934,10 +8851,13 @@
},
"description" : "Reference to a runtime version."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeReference": _runtime_reference_model_schema})
-_runtime_specification_model_schema = json.loads(r"""{
+_runtime_specification_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"build" : {
@@ -7966,10 +8886,13 @@
},
"description" : "Runtime (version) specification that says\n* what assets are required/allowed to build the function\n* what build parameters are used\n* what deployment parameters are used\n* which dependencies are provided by the runtime"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeSpecification": _runtime_specification_model_schema})
-_runtime_summary_model_schema = json.loads(r"""{
+_runtime_summary_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "functionType", "name", "title", "versions" ],
"type" : "object",
"properties" : {
@@ -7997,10 +8920,13 @@
},
"description" : "A summary representation of the runtime, and (selected) versions of it."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeSummary": _runtime_summary_model_schema})
-_runtime_summary_attrs_model_schema = json.loads(r"""{
+_runtime_summary_attrs_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "functionType", "name", "title" ],
"type" : "object",
"properties" : {
@@ -8021,10 +8947,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeSummaryAttrs": _runtime_summary_attrs_model_schema})
-_runtime_summary_response_model_schema = json.loads(r"""{
+_runtime_summary_response_model_schema = json.loads(
+ r"""{
"required" : [ "runtimes" ],
"type" : "object",
"properties" : {
@@ -8037,12 +8966,15 @@
},
"description" : "Runtimes Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RuntimeSummaryResponse": _runtime_summary_response_model_schema}
)
-_runtime_version_and_path_params_model_schema = json.loads(r"""{
+_runtime_version_and_path_params_model_schema = json.loads(
+ r"""{
"required" : [ "*", "name", "version" ],
"type" : "object",
"properties" : {
@@ -8059,12 +8991,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RuntimeVersionAndPathParams": _runtime_version_and_path_params_model_schema}
)
-_runtime_version_info_model_schema = json.loads(r"""{
+_runtime_version_info_model_schema = json.loads(
+ r"""{
"title" : "RuntimeVersionInfo",
"required" : [ "deprecated", "title", "upgradable", "version" ],
"type" : "object",
@@ -8093,10 +9028,13 @@
},
"description" : "A summary of a selected version for a runtime"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeVersionInfo": _runtime_version_info_model_schema})
-_runtime_version_params_model_schema = json.loads(r"""{
+_runtime_version_params_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -8109,10 +9047,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeVersionParams": _runtime_version_params_model_schema})
-_runtime_version_query_model_schema = json.loads(r"""{
+_runtime_version_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -8129,10 +9070,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeVersionQuery": _runtime_version_query_model_schema})
-_runtime_version_response_model_schema = json.loads(r"""{
+_runtime_version_response_model_schema = json.loads(
+ r"""{
"required" : [ "runtime" ],
"type" : "object",
"properties" : {
@@ -8142,12 +9086,15 @@
},
"description" : ": Runtime Version Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RuntimeVersionResponse": _runtime_version_response_model_schema}
)
-_runtime_version_specification_model_schema = json.loads(r"""{
+_runtime_version_specification_model_schema = json.loads(
+ r"""{
"required" : [ "title", "version" ],
"type" : "object",
"properties" : {
@@ -8185,12 +9132,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RuntimeVersionSpecification": _runtime_version_specification_model_schema}
)
-_runtime_version_status_model_schema = json.loads(r"""{
+_runtime_version_status_model_schema = json.loads(
+ r"""{
"required" : [ "deprecated", "upgradable" ],
"type" : "object",
"properties" : {
@@ -8204,10 +9154,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"RuntimeVersionStatus": _runtime_version_status_model_schema})
-_runtime_version_summary_model_schema = json.loads(r"""{
+_runtime_version_summary_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "deprecated", "functionType", "name", "title", "upgradable", "version" ],
"type" : "object",
"properties" : {
@@ -8239,12 +9192,15 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"RuntimeVersionSummary": _runtime_version_summary_model_schema}
)
-_scale_model_schema = json.loads(r"""{
+_scale_model_schema = json.loads(
+ r"""{
"title" : "Scale",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -8294,10 +9250,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Scale": _scale_model_schema})
-_scale_1_model_schema = json.loads(r"""{
+_scale_1_model_schema = json.loads(
+ r"""{
"title" : "Scale",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -8340,10 +9299,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Scale_1": _scale_1_model_schema})
-_scale_args_model_schema = json.loads(r"""{
+_scale_args_model_schema = json.loads(
+ r"""{
"title" : "ScaleArgs",
"required" : [ "endpoint", "namespace", "replicas", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -8377,10 +9339,13 @@
},
"description" : "Input argument to an (openfaas) scale job for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ScaleArgs": _scale_args_model_schema})
-_scale_job_status_model_schema = json.loads(r"""{
+_scale_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -8419,10 +9384,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"ScaleJobStatus": _scale_job_status_model_schema})
-_schema_by_id_params_model_schema = json.loads(r"""{
+_schema_by_id_params_model_schema = json.loads(
+ r"""{
"required" : [ "schemaId" ],
"type" : "object",
"properties" : {
@@ -8433,10 +9401,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"SchemaByIdParams": _schema_by_id_params_model_schema})
-_schema_params_model_schema = json.loads(r"""{
+_schema_params_model_schema = json.loads(
+ r"""{
"required" : [ "functionType", "role" ],
"type" : "object",
"properties" : {
@@ -8449,10 +9420,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"SchemaParams": _schema_params_model_schema})
-_semantic_version_range_model_schema = json.loads(r"""{
+_semantic_version_range_model_schema = json.loads(
+ r"""{
"title" : "SemanticVersionRange",
"description" : "A range of semantic versions. See https://devhints.io/semver",
"anyOf" : [ {
@@ -8461,27 +9435,36 @@
"$ref" : "#/components/schemas/SemanticVersion"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"SemanticVersionRange": _semantic_version_range_model_schema})
-_status_model_schema = json.loads(r"""{
+_status_model_schema = json.loads(
+ r"""{
"title" : "Status",
"type" : "string",
"description" : "Status for a deployed function.",
"enum" : [ "registered", "running", "pending", "deployed", "unhealthy", "killed", "failed", "undeploying", "undeployed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Status": _status_model_schema})
-_status_any_model_schema = json.loads(r"""{
+_status_any_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "Includes *all* statuses (including `undeployed`) as a filter",
"enum" : [ "any" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"StatusAny": _status_any_model_schema})
-_status_filter_model_schema = json.loads(r"""{
+_status_filter_model_schema = json.loads(
+ r"""{
"description" : "Inclusion or exclusion filter on the `status` property.",
"anyOf" : [ {
"$ref" : "#/components/schemas/StatusInclude"
@@ -8491,19 +9474,25 @@
"$ref" : "#/components/schemas/StatusAny"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"StatusFilter": _status_filter_model_schema})
-_status_include_model_schema = json.loads(r"""{
+_status_include_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "Inlude a status as a filter.",
"example" : "running",
"enum" : [ "registered", "running", "pending", "deployed", "unhealthy", "failed", "undeploying", "undeployed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"StatusInclude": _status_include_model_schema})
-_status_response_model_schema = json.loads(r"""{
+_status_response_model_schema = json.loads(
+ r"""{
"required" : [ "statusCode" ],
"type" : "object",
"properties" : {
@@ -8512,10 +9501,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"StatusResponse": _status_response_model_schema})
-_stream_closing_model_schema = json.loads(r"""{
+_stream_closing_model_schema = json.loads(
+ r"""{
"title" : "Stream Closing",
"required" : [ "data", "event" ],
"type" : "object",
@@ -8531,10 +9523,13 @@
},
"description" : "A message that notifies that the server will not send more events, and that the client should close."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Stream_Closing": _stream_closing_model_schema})
-_stream_ready_model_schema = json.loads(r"""{
+_stream_ready_model_schema = json.loads(
+ r"""{
"title" : "Stream Ready",
"required" : [ "data", "event" ],
"type" : "object",
@@ -8550,18 +9545,24 @@
},
"description" : "A message that acknowledges that the server will sent job state changes."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Stream_Ready": _stream_ready_model_schema})
-_supported_events_model_schema = json.loads(r"""{
+_supported_events_model_schema = json.loads(
+ r"""{
"title" : "SupportedEvents",
"type" : "string",
"enum" : [ "completed", "failed", "active", "delayed", "waiting", "waiting-children" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"SupportedEvents": _supported_events_model_schema})
-_tag_model_schema = json.loads(r"""{
+_tag_model_schema = json.loads(
+ r"""{
"title" : "Tag",
"required" : [ "color", "name" ],
"type" : "object",
@@ -8579,10 +9580,13 @@
},
"description" : "One or more tags can be assigned to a function entity to facilitate grouping and searching."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Tag": _tag_model_schema})
-_tag_query_model_schema = json.loads(r"""{
+_tag_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -8598,10 +9602,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"TagQuery": _tag_query_model_schema})
-_tags_filter_model_schema = json.loads(r"""{
+_tags_filter_model_schema = json.loads(
+ r"""{
"title" : "TagsFilter",
"anyOf" : [ {
"type" : "array",
@@ -8612,10 +9619,13 @@
"type" : "string"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"TagsFilter": _tags_filter_model_schema})
-_tags_query_model_schema = json.loads(r"""{
+_tags_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"tags" : {
@@ -8624,10 +9634,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"TagsQuery": _tags_query_model_schema})
-_timestamp_absolute_model_schema = json.loads(r"""{
+_timestamp_absolute_model_schema = json.loads(
+ r"""{
"title" : "TimestampAbsolute",
"description" : "An absolute timestamp as an ISO8601 string",
"anyOf" : [ {
@@ -8636,10 +9649,13 @@
"$ref" : "#/components/schemas/SO8601Date"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"TimestampAbsolute": _timestamp_absolute_model_schema})
-_timestamp_age_model_schema = json.loads(r"""{
+_timestamp_age_model_schema = json.loads(
+ r"""{
"title" : "TimestampAge",
"description" : "A timestamp expressed as a age relative to now",
"anyOf" : [ {
@@ -8648,10 +9664,13 @@
"$ref" : "#/components/schemas/DurationSpec"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"TimestampAge": _timestamp_age_model_schema})
-_timestamp_spec_model_schema = json.loads(r"""{
+_timestamp_spec_model_schema = json.loads(
+ r"""{
"title" : "TimestampSpec",
"description" : "A timestamp specification.",
"anyOf" : [ {
@@ -8660,10 +9679,13 @@
"$ref" : "#/components/schemas/TimestampAbsolute"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"TimestampSpec": _timestamp_spec_model_schema})
-_undeploy_model_schema = json.loads(r"""{
+_undeploy_model_schema = json.loads(
+ r"""{
"title" : "Undeploy",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -8713,10 +9735,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Undeploy": _undeploy_model_schema})
-_undeploy_1_model_schema = json.loads(r"""{
+_undeploy_1_model_schema = json.loads(
+ r"""{
"title" : "Undeploy",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -8759,10 +9784,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Undeploy_1": _undeploy_1_model_schema})
-_undeploy_args_model_schema = json.loads(r"""{
+_undeploy_args_model_schema = json.loads(
+ r"""{
"title" : "UndeployArgs",
"required" : [ "deleteEntity", "endpoint", "isNativePlug", "namespace", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -8800,10 +9828,13 @@
},
"description" : "Input argument to an (openfaas) undeployment job for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UndeployArgs": _undeploy_args_model_schema})
-_undeploy_job_status_model_schema = json.loads(r"""{
+_undeploy_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -8843,10 +9874,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UndeployJobStatus": _undeploy_job_status_model_schema})
-_undeploy_result_model_schema = json.loads(r"""{
+_undeploy_result_model_schema = json.loads(
+ r"""{
"title" : "UndeployResult",
"required" : [ "assets", "deployment", "registration" ],
"type" : "object",
@@ -8866,10 +9900,13 @@
},
"description" : "The result data for a completed undeployment job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UndeployResult": _undeploy_result_model_schema})
-_undeploy_submitted_response_v2_model_schema = json.loads(r"""{
+_undeploy_submitted_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message", "versions" ],
"type" : "object",
"properties" : {
@@ -8889,12 +9926,15 @@
},
"description" : "Undeployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"UndeploySubmittedResponseV2": _undeploy_submitted_response_v2_model_schema}
)
-_undeployed_response_v2_model_schema = json.loads(r"""{
+_undeployed_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "message", "versions" ],
"type" : "object",
"properties" : {
@@ -8911,10 +9951,13 @@
},
"description" : "Undeployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UndeployedResponseV2": _undeployed_response_v2_model_schema})
-_unhealthy_invokable_webscript_error_model_schema = json.loads(r"""{
+_unhealthy_invokable_webscript_error_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "code", "entity", "error" ],
"type" : "object",
"properties" : {
@@ -8933,14 +9976,17 @@
},
"description" : "Webscript Not Healthy"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"UnhealthyInvokableWebscriptError": _unhealthy_invokable_webscript_error_model_schema
}
)
-_update_comment_model_schema = json.loads(r"""{
+_update_comment_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -8949,10 +9995,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UpdateComment": _update_comment_model_schema})
-_update_draft_query_model_schema = json.loads(r"""{
+_update_draft_query_model_schema = json.loads(
+ r"""{
"required" : [ "chown" ],
"type" : "object",
"properties" : {
@@ -8973,10 +10022,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UpdateDraftQuery": _update_draft_query_model_schema})
-_update_metadata_request_v1_model_schema = json.loads(r"""{
+_update_metadata_request_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -9021,12 +10073,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"UpdateMetadataRequestV1": _update_metadata_request_v1_model_schema}
)
-_update_metadata_request_v2_model_schema = json.loads(r"""{
+_update_metadata_request_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -9071,12 +10126,15 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"UpdateMetadataRequestV2": _update_metadata_request_v2_model_schema}
)
-_update_record_model_schema = json.loads(r"""{
+_update_record_model_schema = json.loads(
+ r"""{
"title" : "UpdateRecord",
"required" : [ "at", "by", "operation" ],
"type" : "object",
@@ -9110,10 +10168,13 @@
},
"description" : "An update report corresponding to a modifying operation initiated by a user/administrator on the entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UpdateRecord": _update_record_model_schema})
-_user_plug_meta_model_schema = json.loads(r"""{
+_user_plug_meta_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -9158,10 +10219,13 @@
},
"description" : "Plug metadata that the user can update as `metadata`"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"UserPlugMeta": _user_plug_meta_model_schema})
-_verify_model_schema = json.loads(r"""{
+_verify_model_schema = json.loads(
+ r"""{
"title" : "Verify",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -9211,10 +10275,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Verify": _verify_model_schema})
-_verify_1_model_schema = json.loads(r"""{
+_verify_1_model_schema = json.loads(
+ r"""{
"title" : "Verify",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -9257,10 +10324,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Verify_1": _verify_1_model_schema})
-_verify_args_model_schema = json.loads(r"""{
+_verify_args_model_schema = json.loads(
+ r"""{
"title" : "VerifyArgs",
"required" : [ "endpoint", "namespace", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -9289,10 +10359,13 @@
},
"description" : "Input arguments for an (openfaas) deployment verification job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VerifyArgs": _verify_args_model_schema})
-_verify_job_status_model_schema = json.loads(r"""{
+_verify_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -9332,10 +10405,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VerifyJobStatus": _verify_job_status_model_schema})
-_verify_model_sync_response_v2_model_schema = json.loads(r"""{
+_verify_model_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message", "result" ],
"type" : "object",
"properties" : {
@@ -9351,12 +10427,15 @@
},
"description" : "Model Health Verified"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"VerifyModelSyncResponseV2": _verify_model_sync_response_v2_model_schema}
)
-_verify_plug_sync_response_v2_model_schema = json.loads(r"""{
+_verify_plug_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message", "result" ],
"type" : "object",
"properties" : {
@@ -9372,12 +10451,15 @@
},
"description" : "Plug Health Verified"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"VerifyPlugSyncResponseV2": _verify_plug_sync_response_v2_model_schema}
)
-_verify_query_v1_model_schema = json.loads(r"""{
+_verify_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"scaleToZero" : {
@@ -9387,10 +10469,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VerifyQueryV1": _verify_query_v1_model_schema})
-_verify_result_model_schema = json.loads(r"""{
+_verify_result_model_schema = json.loads(
+ r"""{
"title" : "VerifyResult",
"required" : [ "healthy" ],
"type" : "object",
@@ -9408,10 +10493,13 @@
},
"description" : "The result data for a completed verification job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VerifyResult": _verify_result_model_schema})
-_verify_webscript_sync_response_v2_model_schema = json.loads(r"""{
+_verify_webscript_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message", "result" ],
"type" : "object",
"properties" : {
@@ -9427,12 +10515,15 @@
},
"description" : "Webscript Health Verified"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"VerifyWebscriptSyncResponseV2": _verify_webscript_sync_response_v2_model_schema}
)
-_version_includes_model_schema = json.loads(r"""{
+_version_includes_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -9446,10 +10537,13 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VersionIncludes": _version_includes_model_schema})
-_versions_query_model_schema = json.loads(r"""{
+_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -9547,10 +10641,13 @@
"additionalProperties" : false,
"description" : "Function versions paged query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VersionsQuery": _versions_query_model_schema})
-_versions_query_v2_model_schema = json.loads(r"""{
+_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -9648,10 +10745,13 @@
"additionalProperties" : false,
"description" : "Function versions paged query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VersionsQueryV2": _versions_query_v2_model_schema})
-_versions_response_v2_model_schema = json.loads(r"""{
+_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -9677,10 +10777,13 @@
},
"description" : "Version Listing Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"VersionsResponseV2": _versions_response_v2_model_schema})
-_waiting_children_event_sse_model_schema = json.loads(r"""{
+_waiting_children_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -9695,12 +10798,15 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"WaitingChildrenEventSSE": _waiting_children_event_sse_model_schema}
)
-_waiting_event_data_model_schema = json.loads(r"""{
+_waiting_event_data_model_schema = json.loads(
+ r"""{
"title" : "WaitingEventData",
"type" : "object",
"properties" : {
@@ -9709,10 +10815,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WaitingEventData": _waiting_event_data_model_schema})
-_waiting_event_sse_model_schema = json.loads(r"""{
+_waiting_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -9727,10 +10836,13 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WaitingEventSSE": _waiting_event_sse_model_schema})
-_webscript_model_schema = json.loads(r"""{
+_webscript_model_schema = json.loads(
+ r"""{
"title" : "Webscript",
"required" : [ "webscript" ],
"type" : "object",
@@ -9743,10 +10855,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Webscript": _webscript_model_schema})
-_webscript_1_model_schema = json.loads(r"""{
+_webscript_1_model_schema = json.loads(
+ r"""{
"title" : "Webscript",
"required" : [ "webscript" ],
"type" : "object",
@@ -9762,10 +10877,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Webscript_1": _webscript_1_model_schema})
-_webscript_2_model_schema = json.loads(r"""{
+_webscript_2_model_schema = json.loads(
+ r"""{
"title" : "Webscript",
"required" : [ "webscript" ],
"type" : "object",
@@ -9778,10 +10896,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"Webscript_2": _webscript_2_model_schema})
-_webscript_latest_version_query_v2_model_schema = json.loads(r"""{
+_webscript_latest_version_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -9796,12 +10917,15 @@
"additionalProperties" : false,
"description" : "Webscript latest named version query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"WebscriptLatestVersionQueryV2": _webscript_latest_version_query_v2_model_schema}
)
-_webscript_latest_versions_query_v1_model_schema = json.loads(r"""{
+_webscript_latest_versions_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -9880,12 +11004,15 @@
"additionalProperties" : false,
"description" : "Webscript lastest versions listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"WebscriptLatestVersionsQueryV1": _webscript_latest_versions_query_v1_model_schema}
)
-_webscript_latest_versions_query_v2_model_schema = json.loads(r"""{
+_webscript_latest_versions_query_v2_model_schema = json.loads(
+ r"""{
"description" : "Webscript lastest versions listing query.",
"anyOf" : [ {
"$ref" : "#/components/schemas/LatestFunctionVersionsQuery"
@@ -9893,12 +11020,15 @@
"$ref" : "#/components/schemas/LatestFunctionsQuery"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"WebscriptLatestVersionsQueryV2": _webscript_latest_versions_query_v2_model_schema}
)
-_webscript_manifest_model_schema = json.loads(r"""{
+_webscript_manifest_model_schema = json.loads(
+ r"""{
"title" : "WebscriptManifest",
"required" : [ "allowHmac", "metadata", "name", "private", "runtime", "version" ],
"type" : "object",
@@ -9935,10 +11065,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WebscriptManifest": _webscript_manifest_model_schema})
-_webscript_response_model_schema = json.loads(r"""{
+_webscript_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "metadata", "name", "runtime", "secret", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -9999,10 +11132,13 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WebscriptResponse": _webscript_response_model_schema})
-_webscript_response_v2_model_schema = json.loads(r"""{
+_webscript_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates", "webscript" ],
"type" : "object",
"properties" : {
@@ -10057,10 +11193,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WebscriptResponseV2": _webscript_response_v2_model_schema})
-_webscript_response_with_invoke_link_v2_model_schema = json.loads(r"""{
+_webscript_response_with_invoke_link_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates", "webscript" ],
"type" : "object",
"properties" : {
@@ -10118,14 +11257,17 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{
"WebscriptResponseWithInvokeLinkV2": _webscript_response_with_invoke_link_v2_model_schema
}
)
-_webscript_versions_response_v2_model_schema = json.loads(r"""{
+_webscript_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -10151,12 +11293,15 @@
},
"description" : "Webscript Versions Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update(
{"WebscriptVersionsResponseV2": _webscript_versions_response_v2_model_schema}
)
-_with_asset_hal_link_model_schema = json.loads(r"""{
+_with_asset_hal_link_model_schema = json.loads(
+ r"""{
"required" : [ "_links" ],
"type" : "object",
"properties" : {
@@ -10165,10 +11310,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WithAssetHALLink": _with_asset_hal_link_model_schema})
-_with_entity_attributes_model_schema = json.loads(r"""{
+_with_entity_attributes_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
"properties" : {
@@ -10216,10 +11364,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WithEntityAttributes": _with_entity_attributes_model_schema})
-_with_limit_model_schema = json.loads(r"""{
+_with_limit_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -10228,10 +11379,13 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WithLimit": _with_limit_model_schema})
-_with_paging_model_schema = json.loads(r"""{
+_with_paging_model_schema = json.loads(
+ r"""{
"required" : [ "count" ],
"type" : "object",
"properties" : {
@@ -10249,5 +11403,7 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
MODEL_DEFINITIONS.update({"WithPaging": _with_paging_model_schema})
diff --git a/test/types/active_event_data_stub.py b/test/types/active_event_data_stub.py
index 38e3bf95..b85f38f3 100644
--- a/test/types/active_event_data_stub.py
+++ b/test/types/active_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.active_event_data import ActiveEventData
@@ -22,10 +29,10 @@
ActiveEventDataAdapter = TypeAdapter(ActiveEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ActiveEventData not available: {exc}")
MODELS_AVAILABLE = False
-active_event_data_model_schema = json.loads(r"""{
+active_event_data_model_schema = json.loads(
+ r"""{
"title" : "ActiveEventData",
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
active_event_data_model_schema.update({"definitions": MODEL_DEFINITIONS})
active_event_data_faker = JSF(active_event_data_model_schema, allow_none_optionals=1)
diff --git a/test/types/active_event_sse_stub.py b/test/types/active_event_sse_stub.py
index 8a00b490..a8601680 100644
--- a/test/types/active_event_sse_stub.py
+++ b/test/types/active_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.active_event_sse import ActiveEventSSE
@@ -22,10 +29,10 @@
ActiveEventSSEAdapter = TypeAdapter(ActiveEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ActiveEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-active_event_sse_model_schema = json.loads(r"""{
+active_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
active_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
active_event_sse_faker = JSF(active_event_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/alt_version_hal_link_stub.py b/test/types/alt_version_hal_link_stub.py
index 34be18ae..3f064419 100644
--- a/test/types/alt_version_hal_link_stub.py
+++ b/test/types/alt_version_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.alt_version_hal_link import AltVersionHALLink
@@ -22,10 +29,10 @@
AltVersionHALLinkAdapter = TypeAdapter(AltVersionHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AltVersionHALLink not available: {exc}")
MODELS_AVAILABLE = False
-alt_version_hal_link_model_schema = json.loads(r"""{
+alt_version_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"draft" : {
@@ -36,7 +43,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
alt_version_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
alt_version_hal_link_faker = JSF(
diff --git a/test/types/any_function_response_stub.py b/test/types/any_function_response_stub.py
index 0a7ab3a1..5c0f1269 100644
--- a/test/types/any_function_response_stub.py
+++ b/test/types/any_function_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.any_function_response import (
@@ -24,10 +31,10 @@
AnyFunctionResponseAdapter = TypeAdapter(AnyFunctionResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AnyFunctionResponse not available: {exc}")
MODELS_AVAILABLE = False
-any_function_response_model_schema = json.loads(r"""{
+any_function_response_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/PlugResponseV2"
}, {
@@ -36,7 +43,9 @@
"$ref" : "#/components/schemas/WebscriptResponseV2"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
any_function_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
any_function_response_faker = JSF(
diff --git a/test/types/any_job_for_function_stub.py b/test/types/any_job_for_function_stub.py
index ef469374..b9da61ae 100644
--- a/test/types/any_job_for_function_stub.py
+++ b/test/types/any_job_for_function_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.any_job_for_function import AnyJobForFunction
@@ -22,10 +29,10 @@
AnyJobForFunctionAdapter = TypeAdapter(AnyJobForFunction)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AnyJobForFunction not available: {exc}")
MODELS_AVAILABLE = False
-any_job_for_function_model_schema = json.loads(r"""{
+any_job_for_function_model_schema = json.loads(
+ r"""{
"title" : "AnyJobForFunction",
"anyOf" : [ {
"$ref" : "#/components/schemas/Build"
@@ -39,7 +46,9 @@
"$ref" : "#/components/schemas/Scale"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
any_job_for_function_model_schema.update({"definitions": MODEL_DEFINITIONS})
any_job_for_function_faker = JSF(
diff --git a/test/types/any_job_result_stub.py b/test/types/any_job_result_stub.py
index 25f00c84..faaff425 100644
--- a/test/types/any_job_result_stub.py
+++ b/test/types/any_job_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.any_job_result import AnyJobResult
@@ -22,10 +29,10 @@
AnyJobResultAdapter = TypeAdapter(AnyJobResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AnyJobResult not available: {exc}")
MODELS_AVAILABLE = False
-any_job_result_model_schema = json.loads(r"""{
+any_job_result_model_schema = json.loads(
+ r"""{
"title" : "AnyJobResult",
"anyOf" : [ {
"$ref" : "#/components/schemas/BuildResult"
@@ -43,7 +50,9 @@
"$ref" : "#/components/schemas/CleanupResult"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
any_job_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
any_job_result_faker = JSF(any_job_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/any_job_status_stub.py b/test/types/any_job_status_stub.py
index 9671db4e..d33bebef 100644
--- a/test/types/any_job_status_stub.py
+++ b/test/types/any_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.any_job_status import AnyJobStatus
@@ -22,10 +29,10 @@
AnyJobStatusAdapter = TypeAdapter(AnyJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AnyJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-any_job_status_model_schema = json.loads(r"""{
+any_job_status_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/BuildJobStatus"
}, {
@@ -40,7 +47,9 @@
"$ref" : "#/components/schemas/BatchJobStatus"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
any_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
any_job_status_faker = JSF(any_job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/any_job_status_summary_stub.py b/test/types/any_job_status_summary_stub.py
index ff24f803..4f8bbf4d 100644
--- a/test/types/any_job_status_summary_stub.py
+++ b/test/types/any_job_status_summary_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.any_job_status_summary import (
@@ -24,10 +31,10 @@
AnyJobStatusSummaryAdapter = TypeAdapter(AnyJobStatusSummary)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AnyJobStatusSummary not available: {exc}")
MODELS_AVAILABLE = False
-any_job_status_summary_model_schema = json.loads(r"""{
+any_job_status_summary_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/Build_1"
}, {
@@ -42,7 +49,9 @@
"$ref" : "#/components/schemas/Batch"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
any_job_status_summary_model_schema.update({"definitions": MODEL_DEFINITIONS})
any_job_status_summary_faker = JSF(
diff --git a/test/types/archive_format_stub.py b/test/types/archive_format_stub.py
index d7e54826..2c150406 100644
--- a/test/types/archive_format_stub.py
+++ b/test/types/archive_format_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.archive_format import ArchiveFormat
@@ -22,15 +29,17 @@
ArchiveFormatAdapter = TypeAdapter(ArchiveFormat)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ArchiveFormat not available: {exc}")
MODELS_AVAILABLE = False
-archive_format_model_schema = json.loads(r"""{
+archive_format_model_schema = json.loads(
+ r"""{
"title" : "ArchiveFormat",
"type" : "string",
"enum" : [ "node", "python", "golang", "byoml", "native" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
archive_format_model_schema.update({"definitions": MODEL_DEFINITIONS})
archive_format_faker = JSF(archive_format_model_schema, allow_none_optionals=1)
diff --git a/test/types/asset_condition_content_type_stub.py b/test/types/asset_condition_content_type_stub.py
index 1256e0ae..ee4f834f 100644
--- a/test/types/asset_condition_content_type_stub.py
+++ b/test/types/asset_condition_content_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_condition_content_type import (
@@ -24,10 +31,10 @@
AssetConditionContentTypeAdapter = TypeAdapter(AssetConditionContentType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetConditionContentType not available: {exc}")
MODELS_AVAILABLE = False
-asset_condition_content_type_model_schema = json.loads(r"""{
+asset_condition_content_type_model_schema = json.loads(
+ r"""{
"title" : "AssetCondition_contentType",
"description" : "Allowed content type(s) of matching files.",
"anyOf" : [ {
@@ -39,7 +46,9 @@
}
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_condition_content_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_condition_content_type_faker = JSF(
diff --git a/test/types/asset_condition_pattern_stub.py b/test/types/asset_condition_pattern_stub.py
index 4e3491ff..b2a89ff7 100644
--- a/test/types/asset_condition_pattern_stub.py
+++ b/test/types/asset_condition_pattern_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_condition_pattern import (
@@ -24,10 +31,10 @@
AssetConditionPatternAdapter = TypeAdapter(AssetConditionPattern)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetConditionPattern not available: {exc}")
MODELS_AVAILABLE = False
-asset_condition_pattern_model_schema = json.loads(r"""{
+asset_condition_pattern_model_schema = json.loads(
+ r"""{
"title" : "AssetCondition_pattern",
"description" : "Pattern that selects a file in a function archive",
"anyOf" : [ {
@@ -39,7 +46,9 @@
}
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_condition_pattern_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_condition_pattern_faker = JSF(
diff --git a/test/types/asset_condition_stub.py b/test/types/asset_condition_stub.py
index f6d83da2..b97614b6 100644
--- a/test/types/asset_condition_stub.py
+++ b/test/types/asset_condition_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_condition import AssetCondition
@@ -22,10 +29,10 @@
AssetConditionAdapter = TypeAdapter(AssetCondition)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetCondition not available: {exc}")
MODELS_AVAILABLE = False
-asset_condition_model_schema = json.loads(r"""{
+asset_condition_model_schema = json.loads(
+ r"""{
"title" : "AssetCondition",
"required" : [ "pattern", "role" ],
"type" : "object",
@@ -71,7 +78,9 @@
},
"description" : "Describes conditions on the set of files that match a file pattern."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_condition_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_condition_faker = JSF(asset_condition_model_schema, allow_none_optionals=1)
diff --git a/test/types/asset_path_params_v2_stub.py b/test/types/asset_path_params_v2_stub.py
index 984e328a..23792b69 100644
--- a/test/types/asset_path_params_v2_stub.py
+++ b/test/types/asset_path_params_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_path_params_v2 import AssetPathParamsV2
@@ -22,10 +29,10 @@
AssetPathParamsV2Adapter = TypeAdapter(AssetPathParamsV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetPathParamsV2 not available: {exc}")
MODELS_AVAILABLE = False
-asset_path_params_v2_model_schema = json.loads(r"""{
+asset_path_params_v2_model_schema = json.loads(
+ r"""{
"required" : [ "*" ],
"type" : "object",
"properties" : {
@@ -36,7 +43,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_path_params_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_path_params_v2_faker = JSF(
diff --git a/test/types/asset_role_stub.py b/test/types/asset_role_stub.py
index b787d0f0..0b141159 100644
--- a/test/types/asset_role_stub.py
+++ b/test/types/asset_role_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_role import AssetRole
@@ -22,16 +29,18 @@
AssetRoleAdapter = TypeAdapter(AssetRole)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetRole not available: {exc}")
MODELS_AVAILABLE = False
-asset_role_model_schema = json.loads(r"""{
+asset_role_model_schema = json.loads(
+ r"""{
"title" : "AssetRole",
"type" : "string",
"description" : "Classification of assets with regard to their role.",
"enum" : [ "manifest", "project", "main", "lib", "script", "other" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_role_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_role_faker = JSF(asset_role_model_schema, allow_none_optionals=1)
diff --git a/test/types/asset_summary_stub.py b/test/types/asset_summary_stub.py
index 4cb9caf2..f1ece4a5 100644
--- a/test/types/asset_summary_stub.py
+++ b/test/types/asset_summary_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_summary import AssetSummary
@@ -22,10 +29,10 @@
AssetSummaryAdapter = TypeAdapter(AssetSummary)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetSummary not available: {exc}")
MODELS_AVAILABLE = False
-asset_summary_model_schema = json.loads(r"""{
+asset_summary_model_schema = json.loads(
+ r"""{
"required" : [ "name" ],
"type" : "object",
"properties" : {
@@ -44,7 +51,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_summary_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_summary_faker = JSF(asset_summary_model_schema, allow_none_optionals=1)
diff --git a/test/types/asset_summary_with_hal_link_links_stub.py b/test/types/asset_summary_with_hal_link_links_stub.py
index bcdb2396..29ef47ec 100644
--- a/test/types/asset_summary_with_hal_link_links_stub.py
+++ b/test/types/asset_summary_with_hal_link_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_summary_with_hal_link_links import (
@@ -24,10 +31,10 @@
AssetSummaryWithHALLinkLinksAdapter = TypeAdapter(AssetSummaryWithHALLinkLinks)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetSummaryWithHALLinkLinks not available: {exc}")
MODELS_AVAILABLE = False
-asset_summary_with_hal_link__links_model_schema = json.loads(r"""{
+asset_summary_with_hal_link__links_model_schema = json.loads(
+ r"""{
"title" : "AssetSummaryWithHALLink__links",
"required" : [ "asset" ],
"type" : "object",
@@ -38,7 +45,9 @@
},
"description" : "HAL links to the asset"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_summary_with_hal_link__links_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/asset_summary_with_hal_link_stub.py b/test/types/asset_summary_with_hal_link_stub.py
index 2954e5c4..882b0ce2 100644
--- a/test/types/asset_summary_with_hal_link_stub.py
+++ b/test/types/asset_summary_with_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.asset_summary_with_hal_link import (
@@ -24,10 +31,10 @@
AssetSummaryWithHALLinkAdapter = TypeAdapter(AssetSummaryWithHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetSummaryWithHALLink not available: {exc}")
MODELS_AVAILABLE = False
-asset_summary_with_hal_link_model_schema = json.loads(r"""{
+asset_summary_with_hal_link_model_schema = json.loads(
+ r"""{
"title" : "AssetSummaryWithHALLink",
"required" : [ "_links", "name" ],
"type" : "object",
@@ -53,7 +60,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
asset_summary_with_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
asset_summary_with_hal_link_faker = JSF(
diff --git a/test/types/assets_conditions_stub.py b/test/types/assets_conditions_stub.py
index 3c3f0b23..ee201c7c 100644
--- a/test/types/assets_conditions_stub.py
+++ b/test/types/assets_conditions_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.assets_conditions import AssetsConditions
@@ -22,10 +29,10 @@
AssetsConditionsAdapter = TypeAdapter(AssetsConditions)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AssetsConditions not available: {exc}")
MODELS_AVAILABLE = False
-assets_conditions_model_schema = json.loads(r"""{
+assets_conditions_model_schema = json.loads(
+ r"""{
"title" : "AssetsConditions",
"type" : "object",
"properties" : {
@@ -45,7 +52,9 @@
},
"description" : "Describes the assets that are required/allowed/supported for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
assets_conditions_model_schema.update({"definitions": MODEL_DEFINITIONS})
assets_conditions_faker = JSF(assets_conditions_model_schema, allow_none_optionals=1)
diff --git a/test/types/async_deploy_query_stub.py b/test/types/async_deploy_query_stub.py
index ea5f6a05..074ab60f 100644
--- a/test/types/async_deploy_query_stub.py
+++ b/test/types/async_deploy_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.async_deploy_query import AsyncDeployQuery
@@ -22,10 +29,10 @@
AsyncDeployQueryAdapter = TypeAdapter(AsyncDeployQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AsyncDeployQuery not available: {exc}")
MODELS_AVAILABLE = False
-async_deploy_query_model_schema = json.loads(r"""{
+async_deploy_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecatePrevious" : {
@@ -48,7 +55,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
async_deploy_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
async_deploy_query_faker = JSF(async_deploy_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/async_deploy_query_v1_stub.py b/test/types/async_deploy_query_v1_stub.py
index 329f40ee..080b620d 100644
--- a/test/types/async_deploy_query_v1_stub.py
+++ b/test/types/async_deploy_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.async_deploy_query_v1 import AsyncDeployQueryV1
@@ -22,10 +29,10 @@
AsyncDeployQueryV1Adapter = TypeAdapter(AsyncDeployQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AsyncDeployQueryV1 not available: {exc}")
MODELS_AVAILABLE = False
-async_deploy_query_v1_model_schema = json.loads(r"""{
+async_deploy_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"scaleToZero" : {
@@ -45,7 +52,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
async_deploy_query_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
async_deploy_query_v1_faker = JSF(
diff --git a/test/types/async_query_default_false_stub.py b/test/types/async_query_default_false_stub.py
index 4d4f3fdf..c2db1b88 100644
--- a/test/types/async_query_default_false_stub.py
+++ b/test/types/async_query_default_false_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.async_query_default_false import (
@@ -24,10 +31,10 @@
AsyncQueryDefaultFalseAdapter = TypeAdapter(AsyncQueryDefaultFalse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AsyncQueryDefaultFalse not available: {exc}")
MODELS_AVAILABLE = False
-async_query_default_false_model_schema = json.loads(r"""{
+async_query_default_false_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -38,7 +45,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
async_query_default_false_model_schema.update({"definitions": MODEL_DEFINITIONS})
async_query_default_false_faker = JSF(
diff --git a/test/types/async_query_default_true_stub.py b/test/types/async_query_default_true_stub.py
index 56054547..3c73aafa 100644
--- a/test/types/async_query_default_true_stub.py
+++ b/test/types/async_query_default_true_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.async_query_default_true import (
@@ -24,10 +31,10 @@
AsyncQueryDefaultTrueAdapter = TypeAdapter(AsyncQueryDefaultTrue)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AsyncQueryDefaultTrue not available: {exc}")
MODELS_AVAILABLE = False
-async_query_default_true_model_schema = json.loads(r"""{
+async_query_default_true_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -38,7 +45,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
async_query_default_true_model_schema.update({"definitions": MODEL_DEFINITIONS})
async_query_default_true_faker = JSF(
diff --git a/test/types/async_verify_query_stub.py b/test/types/async_verify_query_stub.py
index 98cfebe6..cca67a42 100644
--- a/test/types/async_verify_query_stub.py
+++ b/test/types/async_verify_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.async_verify_query import AsyncVerifyQuery
@@ -22,10 +29,10 @@
AsyncVerifyQueryAdapter = TypeAdapter(AsyncVerifyQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for AsyncVerifyQuery not available: {exc}")
MODELS_AVAILABLE = False
-async_verify_query_model_schema = json.loads(r"""{
+async_verify_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -44,7 +51,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
async_verify_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
async_verify_query_faker = JSF(async_verify_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/batch_args_stub.py b/test/types/batch_args_stub.py
index 1aa59f0b..ff8105ab 100644
--- a/test/types/batch_args_stub.py
+++ b/test/types/batch_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.batch_args import BatchArgs
@@ -22,10 +29,10 @@
BatchArgsAdapter = TypeAdapter(BatchArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BatchArgs not available: {exc}")
MODELS_AVAILABLE = False
-batch_args_model_schema = json.loads(r"""{
+batch_args_model_schema = json.loads(
+ r"""{
"title" : "BatchArgs",
"required" : [ "functionType", "plugName" ],
"type" : "object",
@@ -43,7 +50,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
batch_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
batch_args_faker = JSF(batch_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/batch_job_status_stub.py b/test/types/batch_job_status_stub.py
index 99f79faf..2e895c33 100644
--- a/test/types/batch_job_status_stub.py
+++ b/test/types/batch_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.batch_job_status import BatchJobStatus
@@ -22,10 +29,10 @@
BatchJobStatusAdapter = TypeAdapter(BatchJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BatchJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-batch_job_status_model_schema = json.loads(r"""{
+batch_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -65,7 +72,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
batch_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
batch_job_status_faker = JSF(batch_job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/batch_result_stub.py b/test/types/batch_result_stub.py
index 07f32df5..dff92066 100644
--- a/test/types/batch_result_stub.py
+++ b/test/types/batch_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.batch_result import BatchResult
@@ -22,10 +29,10 @@
BatchResultAdapter = TypeAdapter(BatchResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BatchResult not available: {exc}")
MODELS_AVAILABLE = False
-batch_result_model_schema = json.loads(r"""{
+batch_result_model_schema = json.loads(
+ r"""{
"title" : "BatchResult",
"type" : "object",
"properties" : {
@@ -35,7 +42,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
batch_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
batch_result_faker = JSF(batch_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/batch_stub.py b/test/types/batch_stub.py
index 96bf6a2a..229f2107 100644
--- a/test/types/batch_stub.py
+++ b/test/types/batch_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.batch import Batch
@@ -22,10 +29,10 @@
BatchAdapter = TypeAdapter(Batch)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Batch not available: {exc}")
MODELS_AVAILABLE = False
-batch_model_schema = json.loads(r"""{
+batch_model_schema = json.loads(
+ r"""{
"title" : "Batch",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
batch_model_schema.update({"definitions": MODEL_DEFINITIONS})
batch_faker = JSF(batch_model_schema, allow_none_optionals=1)
diff --git a/test/types/build1_stub.py b/test/types/build1_stub.py
index fc47e743..a502cf8b 100644
--- a/test/types/build1_stub.py
+++ b/test/types/build1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.build1 import Build1
@@ -22,10 +29,10 @@
Build1Adapter = TypeAdapter(Build1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Build1 not available: {exc}")
MODELS_AVAILABLE = False
-build_1_model_schema = json.loads(r"""{
+build_1_model_schema = json.loads(
+ r"""{
"title" : "Build",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
build_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
build_1_faker = JSF(build_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/build_args_stub.py b/test/types/build_args_stub.py
index 40b7e13b..0f069e8b 100644
--- a/test/types/build_args_stub.py
+++ b/test/types/build_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.build_args import BuildArgs
@@ -22,10 +29,10 @@
BuildArgsAdapter = TypeAdapter(BuildArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BuildArgs not available: {exc}")
MODELS_AVAILABLE = False
-build_args_model_schema = json.loads(r"""{
+build_args_model_schema = json.loads(
+ r"""{
"title" : "BuildArgs",
"required" : [ "args", "imageName", "runtimeName", "runtimeVersion", "storageLocation" ],
"type" : "object",
@@ -62,7 +69,9 @@
},
"description" : "Input arguments to a job that builds a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
build_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
build_args_faker = JSF(build_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/build_job_status_stub.py b/test/types/build_job_status_stub.py
index 9f535a27..7ee1bdef 100644
--- a/test/types/build_job_status_stub.py
+++ b/test/types/build_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.build_job_status import BuildJobStatus
@@ -22,10 +29,10 @@
BuildJobStatusAdapter = TypeAdapter(BuildJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BuildJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-build_job_status_model_schema = json.loads(r"""{
+build_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -65,7 +72,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
build_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
build_job_status_faker = JSF(build_job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/build_result_stub.py b/test/types/build_result_stub.py
index 29b8ae87..137b3758 100644
--- a/test/types/build_result_stub.py
+++ b/test/types/build_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.build_result import BuildResult
@@ -22,10 +29,10 @@
BuildResultAdapter = TypeAdapter(BuildResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BuildResult not available: {exc}")
MODELS_AVAILABLE = False
-build_result_model_schema = json.loads(r"""{
+build_result_model_schema = json.loads(
+ r"""{
"title" : "BuildResult",
"required" : [ "digest" ],
"type" : "object",
@@ -50,7 +57,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
build_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
build_result_faker = JSF(build_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/build_spec_stub.py b/test/types/build_spec_stub.py
index a156234a..96a74a7c 100644
--- a/test/types/build_spec_stub.py
+++ b/test/types/build_spec_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.build_spec import BuildSpec
@@ -22,10 +29,10 @@
BuildSpecAdapter = TypeAdapter(BuildSpec)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for BuildSpec not available: {exc}")
MODELS_AVAILABLE = False
-build_spec_model_schema = json.loads(r"""{
+build_spec_model_schema = json.loads(
+ r"""{
"title" : "BuildSpec",
"required" : [ "args", "context" ],
"type" : "object",
@@ -43,7 +50,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
build_spec_model_schema.update({"definitions": MODEL_DEFINITIONS})
build_spec_faker = JSF(build_spec_model_schema, allow_none_optionals=1)
diff --git a/test/types/build_stub.py b/test/types/build_stub.py
index 0f26333d..e4e4d262 100644
--- a/test/types/build_stub.py
+++ b/test/types/build_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.build import Build
@@ -22,10 +29,10 @@
BuildAdapter = TypeAdapter(Build)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Build not available: {exc}")
MODELS_AVAILABLE = False
-build_model_schema = json.loads(r"""{
+build_model_schema = json.loads(
+ r"""{
"title" : "Build",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -75,7 +82,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
build_model_schema.update({"definitions": MODEL_DEFINITIONS})
build_faker = JSF(build_model_schema, allow_none_optionals=1)
diff --git a/test/types/cleanup_result_stub.py b/test/types/cleanup_result_stub.py
index 2a7cb70a..5947a543 100644
--- a/test/types/cleanup_result_stub.py
+++ b/test/types/cleanup_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.cleanup_result import CleanupResult
@@ -22,10 +29,10 @@
CleanupResultAdapter = TypeAdapter(CleanupResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CleanupResult not available: {exc}")
MODELS_AVAILABLE = False
-cleanup_result_model_schema = json.loads(r"""{
+cleanup_result_model_schema = json.loads(
+ r"""{
"title" : "CleanupResult",
"type" : "object",
"properties" : {
@@ -35,7 +42,9 @@
},
"description" : "The result data for a completed cleanup job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
cleanup_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
cleanup_result_faker = JSF(cleanup_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/compiled_runtime_version_stub.py b/test/types/compiled_runtime_version_stub.py
index 4460f587..33854c6c 100644
--- a/test/types/compiled_runtime_version_stub.py
+++ b/test/types/compiled_runtime_version_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.compiled_runtime_version import (
@@ -24,10 +31,10 @@
CompiledRuntimeVersionAdapter = TypeAdapter(CompiledRuntimeVersion)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CompiledRuntimeVersion not available: {exc}")
MODELS_AVAILABLE = False
-compiled_runtime_version_model_schema = json.loads(r"""{
+compiled_runtime_version_model_schema = json.loads(
+ r"""{
"title" : "CompiledRuntimeVersion",
"required" : [ "archiveFormat", "deprecated", "functionType", "name", "title", "upgradable", "version" ],
"type" : "object",
@@ -86,7 +93,9 @@
},
"description" : "Compiled build and deployment information for a runtime version. Contains all defaults applied on the _global_, _functionType_, _archiveFormat_, _runtime_ and _runtime version_ level."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
compiled_runtime_version_model_schema.update({"definitions": MODEL_DEFINITIONS})
compiled_runtime_version_faker = JSF(
diff --git a/test/types/completed_event_data_stub.py b/test/types/completed_event_data_stub.py
index 8a626095..4046f1f7 100644
--- a/test/types/completed_event_data_stub.py
+++ b/test/types/completed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.completed_event_data import CompletedEventData
@@ -22,10 +29,10 @@
CompletedEventDataAdapter = TypeAdapter(CompletedEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CompletedEventData not available: {exc}")
MODELS_AVAILABLE = False
-completed_event_data_model_schema = json.loads(r"""{
+completed_event_data_model_schema = json.loads(
+ r"""{
"title" : "CompletedEventData",
"required" : [ "returnValue" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
completed_event_data_model_schema.update({"definitions": MODEL_DEFINITIONS})
completed_event_data_faker = JSF(
diff --git a/test/types/completed_event_sse_stub.py b/test/types/completed_event_sse_stub.py
index 41d1ef21..5e55da0e 100644
--- a/test/types/completed_event_sse_stub.py
+++ b/test/types/completed_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.completed_event_sse import CompletedEventSSE
@@ -22,10 +29,10 @@
CompletedEventSSEAdapter = TypeAdapter(CompletedEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CompletedEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-completed_event_sse_model_schema = json.loads(r"""{
+completed_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
completed_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
completed_event_sse_faker = JSF(
diff --git a/test/types/content_query_v2_stub.py b/test/types/content_query_v2_stub.py
index c76455fc..a2dd7464 100644
--- a/test/types/content_query_v2_stub.py
+++ b/test/types/content_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.content_query_v2 import ContentQueryV2
@@ -22,10 +29,10 @@
ContentQueryV2Adapter = TypeAdapter(ContentQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ContentQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-content_query_v2_model_schema = json.loads(r"""{
+content_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"ls" : {
@@ -36,7 +43,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
content_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
content_query_v2_faker = JSF(content_query_v2_model_schema, allow_none_optionals=1)
diff --git a/test/types/content_validation_listing_stub.py b/test/types/content_validation_listing_stub.py
index dc6c0d8e..ed4c49b6 100644
--- a/test/types/content_validation_listing_stub.py
+++ b/test/types/content_validation_listing_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.content_validation_listing import (
@@ -24,10 +31,10 @@
ContentValidationListingAdapter = TypeAdapter(ContentValidationListing)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ContentValidationListing not available: {exc}")
MODELS_AVAILABLE = False
-content_validation_listing_model_schema = json.loads(r"""{
+content_validation_listing_model_schema = json.loads(
+ r"""{
"required" : [ "assets" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Content listing"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
content_validation_listing_model_schema.update({"definitions": MODEL_DEFINITIONS})
content_validation_listing_faker = JSF(
diff --git a/test/types/create_function_query_v2_stub.py b/test/types/create_function_query_v2_stub.py
index 6c916860..83f8979a 100644
--- a/test/types/create_function_query_v2_stub.py
+++ b/test/types/create_function_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.create_function_query_v2 import (
@@ -24,10 +31,10 @@
CreateFunctionQueryV2Adapter = TypeAdapter(CreateFunctionQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CreateFunctionQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-create_function_query_v2_model_schema = json.loads(r"""{
+create_function_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecatePrevious" : {
@@ -62,7 +69,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
create_function_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
create_function_query_v2_faker = JSF(
diff --git a/test/types/create_kf_serving_async_response_stub.py b/test/types/create_kf_serving_async_response_stub.py
index 0513f339..a24ad30e 100644
--- a/test/types/create_kf_serving_async_response_stub.py
+++ b/test/types/create_kf_serving_async_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.create_kf_serving_async_response import (
@@ -24,10 +31,10 @@
CreateKFServingAsyncResponseAdapter = TypeAdapter(CreateKFServingAsyncResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CreateKFServingAsyncResponse not available: {exc}")
MODELS_AVAILABLE = False
-create_kf_serving_async_response_model_schema = json.loads(r"""{
+create_kf_serving_async_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Model Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
create_kf_serving_async_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
create_kf_serving_async_response_faker = JSF(
diff --git a/test/types/create_plug_async_response_stub.py b/test/types/create_plug_async_response_stub.py
index 1aa5531e..14d45e6c 100644
--- a/test/types/create_plug_async_response_stub.py
+++ b/test/types/create_plug_async_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.create_plug_async_response import (
@@ -24,10 +31,10 @@
CreatePlugAsyncResponseAdapter = TypeAdapter(CreatePlugAsyncResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CreatePlugAsyncResponse not available: {exc}")
MODELS_AVAILABLE = False
-create_plug_async_response_model_schema = json.loads(r"""{
+create_plug_async_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
create_plug_async_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
create_plug_async_response_faker = JSF(
diff --git a/test/types/create_webscript_async_response_stub.py b/test/types/create_webscript_async_response_stub.py
index a76d9fa0..48d2e586 100644
--- a/test/types/create_webscript_async_response_stub.py
+++ b/test/types/create_webscript_async_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.create_webscript_async_response import (
@@ -24,10 +31,10 @@
CreateWebscriptAsyncResponseAdapter = TypeAdapter(CreateWebscriptAsyncResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for CreateWebscriptAsyncResponse not available: {exc}")
MODELS_AVAILABLE = False
-create_webscript_async_response_model_schema = json.loads(r"""{
+create_webscript_async_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
create_webscript_async_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
create_webscript_async_response_faker = JSF(
diff --git a/test/types/delayed_event_data_stub.py b/test/types/delayed_event_data_stub.py
index 399650b4..9c02a8f5 100644
--- a/test/types/delayed_event_data_stub.py
+++ b/test/types/delayed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.delayed_event_data import DelayedEventData
@@ -22,10 +29,10 @@
DelayedEventDataAdapter = TypeAdapter(DelayedEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DelayedEventData not available: {exc}")
MODELS_AVAILABLE = False
-delayed_event_data_model_schema = json.loads(r"""{
+delayed_event_data_model_schema = json.loads(
+ r"""{
"title" : "DelayedEventData",
"required" : [ "delay" ],
"type" : "object",
@@ -36,7 +43,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
delayed_event_data_model_schema.update({"definitions": MODEL_DEFINITIONS})
delayed_event_data_faker = JSF(delayed_event_data_model_schema, allow_none_optionals=1)
diff --git a/test/types/delayed_event_sse_stub.py b/test/types/delayed_event_sse_stub.py
index 67716b43..db9acd68 100644
--- a/test/types/delayed_event_sse_stub.py
+++ b/test/types/delayed_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.delayed_event_sse import DelayedEventSSE
@@ -22,10 +29,10 @@
DelayedEventSSEAdapter = TypeAdapter(DelayedEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DelayedEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-delayed_event_sse_model_schema = json.loads(r"""{
+delayed_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
delayed_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
delayed_event_sse_faker = JSF(delayed_event_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/deploy1_stub.py b/test/types/deploy1_stub.py
index 3c725531..1ca0b3dd 100644
--- a/test/types/deploy1_stub.py
+++ b/test/types/deploy1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy1 import Deploy1
@@ -22,10 +29,10 @@
Deploy1Adapter = TypeAdapter(Deploy1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Deploy1 not available: {exc}")
MODELS_AVAILABLE = False
-deploy_1_model_schema = json.loads(r"""{
+deploy_1_model_schema = json.loads(
+ r"""{
"title" : "Deploy",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_1_faker = JSF(deploy_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/deploy_args_deploy_spec_overrides_stub.py b/test/types/deploy_args_deploy_spec_overrides_stub.py
index 5ff76c34..ab14614c 100644
--- a/test/types/deploy_args_deploy_spec_overrides_stub.py
+++ b/test/types/deploy_args_deploy_spec_overrides_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_args_deploy_spec_overrides import (
@@ -24,12 +31,10 @@
DeployArgsDeploySpecOverridesAdapter = TypeAdapter(DeployArgsDeploySpecOverrides)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for DeployArgsDeploySpecOverrides not available: {exc}"
- )
MODELS_AVAILABLE = False
-deploy_args_deploy_spec_overrides_model_schema = json.loads(r"""{
+deploy_args_deploy_spec_overrides_model_schema = json.loads(
+ r"""{
"title" : "DeployArgs_deploySpecOverrides",
"type" : "object",
"properties" : {
@@ -105,7 +110,9 @@
},
"description" : "Overrides on the deployment specification."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_args_deploy_spec_overrides_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/deploy_args_stub.py b/test/types/deploy_args_stub.py
index 286525dd..aca6297f 100644
--- a/test/types/deploy_args_stub.py
+++ b/test/types/deploy_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_args import DeployArgs
@@ -22,10 +29,10 @@
DeployArgsAdapter = TypeAdapter(DeployArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeployArgs not available: {exc}")
MODELS_AVAILABLE = False
-deploy_args_model_schema = json.loads(r"""{
+deploy_args_model_schema = json.loads(
+ r"""{
"title" : "DeployArgs",
"required" : [ "deploySpecOverrides", "endpoint", "imageName", "namespace", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -62,7 +69,9 @@
},
"description" : "Input argument to an (openfaas) deployment job for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_args_faker = JSF(deploy_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/deploy_attributes_filter_stub.py b/test/types/deploy_attributes_filter_stub.py
index c5890702..5fbb3e8d 100644
--- a/test/types/deploy_attributes_filter_stub.py
+++ b/test/types/deploy_attributes_filter_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_attributes_filter import (
@@ -24,10 +31,10 @@
DeployAttributesFilterAdapter = TypeAdapter(DeployAttributesFilter)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeployAttributesFilter not available: {exc}")
MODELS_AVAILABLE = False
-deploy_attributes_filter_model_schema = json.loads(r"""{
+deploy_attributes_filter_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"endpoint" : {
@@ -45,7 +52,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_attributes_filter_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_attributes_filter_faker = JSF(
diff --git a/test/types/deploy_job_status_stub.py b/test/types/deploy_job_status_stub.py
index 71cfd810..302c9259 100644
--- a/test/types/deploy_job_status_stub.py
+++ b/test/types/deploy_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_job_status import DeployJobStatus
@@ -22,10 +29,10 @@
DeployJobStatusAdapter = TypeAdapter(DeployJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeployJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-deploy_job_status_model_schema = json.loads(r"""{
+deploy_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -65,7 +72,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_job_status_faker = JSF(deploy_job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/deploy_result_stub.py b/test/types/deploy_result_stub.py
index 0b786ba7..1c09eac0 100644
--- a/test/types/deploy_result_stub.py
+++ b/test/types/deploy_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_result import DeployResult
@@ -22,10 +29,10 @@
DeployResultAdapter = TypeAdapter(DeployResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeployResult not available: {exc}")
MODELS_AVAILABLE = False
-deploy_result_model_schema = json.loads(r"""{
+deploy_result_model_schema = json.loads(
+ r"""{
"title" : "DeployResult",
"required" : [ "deploySpec" ],
"type" : "object",
@@ -36,7 +43,9 @@
},
"description" : "The result data for a completed deployment job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_result_faker = JSF(deploy_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/deploy_spec_openfaas_spec_stub.py b/test/types/deploy_spec_openfaas_spec_stub.py
index 079116e0..2088c40a 100644
--- a/test/types/deploy_spec_openfaas_spec_stub.py
+++ b/test/types/deploy_spec_openfaas_spec_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_spec_openfaas_spec import (
@@ -24,10 +31,10 @@
DeploySpecOpenfaasSpecAdapter = TypeAdapter(DeploySpecOpenfaasSpec)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeploySpecOpenfaasSpec not available: {exc}")
MODELS_AVAILABLE = False
-deploy_spec_openfaas_spec_model_schema = json.loads(r"""{
+deploy_spec_openfaas_spec_model_schema = json.loads(
+ r"""{
"title" : "DeploySpec_openfaasSpec",
"type" : "object",
"properties" : {
@@ -103,7 +110,9 @@
},
"description" : "If specified, it overrides the properties in `default`. Non-specified properties are taken from `default`"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_spec_openfaas_spec_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_spec_openfaas_spec_faker = JSF(
diff --git a/test/types/deploy_spec_stub.py b/test/types/deploy_spec_stub.py
index 6a07e0c1..6d9deeec 100644
--- a/test/types/deploy_spec_stub.py
+++ b/test/types/deploy_spec_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy_spec import DeploySpec
@@ -22,10 +29,10 @@
DeploySpecAdapter = TypeAdapter(DeploySpec)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeploySpec not available: {exc}")
MODELS_AVAILABLE = False
-deploy_spec_model_schema = json.loads(r"""{
+deploy_spec_model_schema = json.loads(
+ r"""{
"title" : "DeploySpec",
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_spec_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_spec_faker = JSF(deploy_spec_model_schema, allow_none_optionals=1)
diff --git a/test/types/deploy_stub.py b/test/types/deploy_stub.py
index aa85c093..3b8b0e4a 100644
--- a/test/types/deploy_stub.py
+++ b/test/types/deploy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deploy import Deploy
@@ -22,10 +29,10 @@
DeployAdapter = TypeAdapter(Deploy)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Deploy not available: {exc}")
MODELS_AVAILABLE = False
-deploy_model_schema = json.loads(r"""{
+deploy_model_schema = json.loads(
+ r"""{
"title" : "Deploy",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -75,7 +82,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deploy_model_schema.update({"definitions": MODEL_DEFINITIONS})
deploy_faker = JSF(deploy_model_schema, allow_none_optionals=1)
diff --git a/test/types/deprecate_previous_policy_stub.py b/test/types/deprecate_previous_policy_stub.py
index 670ac21f..61ea3a5d 100644
--- a/test/types/deprecate_previous_policy_stub.py
+++ b/test/types/deprecate_previous_policy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deprecate_previous_policy import (
@@ -24,15 +31,17 @@
DeprecatePreviousPolicyAdapter = TypeAdapter(DeprecatePreviousPolicy)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeprecatePreviousPolicy not available: {exc}")
MODELS_AVAILABLE = False
-deprecate_previous_policy_model_schema = json.loads(r"""{
+deprecate_previous_policy_model_schema = json.loads(
+ r"""{
"title" : "DeprecatePreviousPolicy",
"type" : "string",
"enum" : [ "none", "all", "patch", "minor" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deprecate_previous_policy_model_schema.update({"definitions": MODEL_DEFINITIONS})
deprecate_previous_policy_faker = JSF(
diff --git a/test/types/deprecate_previous_query_stub.py b/test/types/deprecate_previous_query_stub.py
index 8e1b3079..e7029b95 100644
--- a/test/types/deprecate_previous_query_stub.py
+++ b/test/types/deprecate_previous_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deprecate_previous_query import (
@@ -24,10 +31,10 @@
DeprecatePreviousQueryAdapter = TypeAdapter(DeprecatePreviousQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeprecatePreviousQuery not available: {exc}")
MODELS_AVAILABLE = False
-deprecate_previous_query_model_schema = json.loads(r"""{
+deprecate_previous_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecatePrevious" : {
@@ -36,7 +43,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deprecate_previous_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
deprecate_previous_query_faker = JSF(
diff --git a/test/types/deprecated_draft_filter_stub.py b/test/types/deprecated_draft_filter_stub.py
index cd32e57a..1b994c6c 100644
--- a/test/types/deprecated_draft_filter_stub.py
+++ b/test/types/deprecated_draft_filter_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.deprecated_draft_filter import (
@@ -24,10 +31,10 @@
DeprecatedDraftFilterAdapter = TypeAdapter(DeprecatedDraftFilter)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DeprecatedDraftFilter not available: {exc}")
MODELS_AVAILABLE = False
-deprecated_draft_filter_model_schema = json.loads(r"""{
+deprecated_draft_filter_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deprecated" : {
@@ -41,7 +48,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
deprecated_draft_filter_model_schema.update({"definitions": MODEL_DEFINITIONS})
deprecated_draft_filter_faker = JSF(
diff --git a/test/types/documentation_property_stub.py b/test/types/documentation_property_stub.py
index 8ce7f38e..680ee3e0 100644
--- a/test/types/documentation_property_stub.py
+++ b/test/types/documentation_property_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.documentation_property import (
@@ -24,10 +31,10 @@
DocumentationPropertyAdapter = TypeAdapter(DocumentationProperty)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DocumentationProperty not available: {exc}")
MODELS_AVAILABLE = False
-documentation_property_model_schema = json.loads(r"""{
+documentation_property_model_schema = json.loads(
+ r"""{
"required" : [ "description", "name" ],
"type" : "object",
"properties" : {
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
documentation_property_model_schema.update({"definitions": MODEL_DEFINITIONS})
documentation_property_faker = JSF(
diff --git a/test/types/documentation_stub.py b/test/types/documentation_stub.py
index 8e1d54ee..a0b045d5 100644
--- a/test/types/documentation_stub.py
+++ b/test/types/documentation_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.documentation import Documentation
@@ -22,10 +29,10 @@
DocumentationAdapter = TypeAdapter(Documentation)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Documentation not available: {exc}")
MODELS_AVAILABLE = False
-documentation_model_schema = json.loads(r"""{
+documentation_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"description" : {
@@ -54,7 +61,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
documentation_model_schema.update({"definitions": MODEL_DEFINITIONS})
documentation_faker = JSF(documentation_model_schema, allow_none_optionals=1)
diff --git a/test/types/dry_run_query_stub.py b/test/types/dry_run_query_stub.py
index e033bbda..76761e4b 100644
--- a/test/types/dry_run_query_stub.py
+++ b/test/types/dry_run_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.dry_run_query import DryRunQuery
@@ -22,10 +29,10 @@
DryRunQueryAdapter = TypeAdapter(DryRunQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for DryRunQuery not available: {exc}")
MODELS_AVAILABLE = False
-dry_run_query_model_schema = json.loads(r"""{
+dry_run_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"dryRun" : {
@@ -35,7 +42,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
dry_run_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
dry_run_query_faker = JSF(dry_run_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/entity_response_stub.py b/test/types/entity_response_stub.py
index ce5c34bd..1f22a45d 100644
--- a/test/types/entity_response_stub.py
+++ b/test/types/entity_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.entity_response import EntityResponse
@@ -22,10 +29,10 @@
EntityResponseAdapter = TypeAdapter(EntityResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EntityResponse not available: {exc}")
MODELS_AVAILABLE = False
-entity_response_model_schema = json.loads(r"""{
+entity_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "metadata", "name", "runtime", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -81,7 +88,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
entity_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
entity_response_faker = JSF(entity_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/error_and_status_response_stub.py b/test/types/error_and_status_response_stub.py
index 0d6ab450..bad60d53 100644
--- a/test/types/error_and_status_response_stub.py
+++ b/test/types/error_and_status_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.error_and_status_response import (
@@ -24,10 +31,10 @@
ErrorAndStatusResponseAdapter = TypeAdapter(ErrorAndStatusResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ErrorAndStatusResponse not available: {exc}")
MODELS_AVAILABLE = False
-error_and_status_response_model_schema = json.loads(r"""{
+error_and_status_response_model_schema = json.loads(
+ r"""{
"required" : [ "error", "statusCode" ],
"type" : "object",
"properties" : {
@@ -39,7 +46,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
error_and_status_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
error_and_status_response_faker = JSF(
diff --git a/test/types/error_response_stub.py b/test/types/error_response_stub.py
index 8f1247f2..84b807b5 100644
--- a/test/types/error_response_stub.py
+++ b/test/types/error_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.error_response import ErrorResponse
@@ -22,10 +29,10 @@
ErrorResponseAdapter = TypeAdapter(ErrorResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ErrorResponse not available: {exc}")
MODELS_AVAILABLE = False
-error_response_model_schema = json.loads(r"""{
+error_response_model_schema = json.loads(
+ r"""{
"required" : [ "error" ],
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
error_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
error_response_faker = JSF(error_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/event_ack_stub.py b/test/types/event_ack_stub.py
index 93d1bf54..2daf34b8 100644
--- a/test/types/event_ack_stub.py
+++ b/test/types/event_ack_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.event_ack import EventAck
@@ -22,14 +29,16 @@
EventAckAdapter = TypeAdapter(EventAck)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EventAck not available: {exc}")
MODELS_AVAILABLE = False
-event_ack_model_schema = json.loads(r"""{
+event_ack_model_schema = json.loads(
+ r"""{
"type" : "string",
"enum" : [ "ack" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
event_ack_model_schema.update({"definitions": MODEL_DEFINITIONS})
event_ack_faker = JSF(event_ack_model_schema, allow_none_optionals=1)
diff --git a/test/types/event_close_stub.py b/test/types/event_close_stub.py
index 54163624..bb52468e 100644
--- a/test/types/event_close_stub.py
+++ b/test/types/event_close_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.event_close import EventClose
@@ -22,14 +29,16 @@
EventCloseAdapter = TypeAdapter(EventClose)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EventClose not available: {exc}")
MODELS_AVAILABLE = False
-event_close_model_schema = json.loads(r"""{
+event_close_model_schema = json.loads(
+ r"""{
"type" : "string",
"enum" : [ "close" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
event_close_model_schema.update({"definitions": MODEL_DEFINITIONS})
event_close_faker = JSF(event_close_model_schema, allow_none_optionals=1)
diff --git a/test/types/event_keep_alive_stub.py b/test/types/event_keep_alive_stub.py
index d6a8a127..97fd5394 100644
--- a/test/types/event_keep_alive_stub.py
+++ b/test/types/event_keep_alive_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.event_keep_alive import EventKeepAlive
@@ -22,14 +29,16 @@
EventKeepAliveAdapter = TypeAdapter(EventKeepAlive)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EventKeepAlive not available: {exc}")
MODELS_AVAILABLE = False
-event_keep_alive_model_schema = json.loads(r"""{
+event_keep_alive_model_schema = json.loads(
+ r"""{
"type" : "string",
"enum" : [ "keep-alive" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
event_keep_alive_model_schema.update({"definitions": MODEL_DEFINITIONS})
event_keep_alive_faker = JSF(event_keep_alive_model_schema, allow_none_optionals=1)
diff --git a/test/types/event_sse_stub.py b/test/types/event_sse_stub.py
index 9a87bf0f..49e7c8ad 100644
--- a/test/types/event_sse_stub.py
+++ b/test/types/event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.event_sse import EventSSE
@@ -22,10 +29,10 @@
EventSSEAdapter = TypeAdapter(EventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EventSSE not available: {exc}")
MODELS_AVAILABLE = False
-event_sse_model_schema = json.loads(r"""{
+event_sse_model_schema = json.loads(
+ r"""{
"description" : "SSE stream events without closing protocol",
"anyOf" : [ {
"$ref" : "#/components/schemas/Stream_Ready"
@@ -35,7 +42,9 @@
"$ref" : "#/components/schemas/KeepAliveEventSSE"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
event_sse_faker = JSF(event_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/event_type_sse_stub.py b/test/types/event_type_sse_stub.py
index 1588a198..fda876eb 100644
--- a/test/types/event_type_sse_stub.py
+++ b/test/types/event_type_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.event_type_sse import EventTypeSSE
@@ -22,10 +29,10 @@
EventTypeSSEAdapter = TypeAdapter(EventTypeSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EventTypeSSE not available: {exc}")
MODELS_AVAILABLE = False
-event_type_sse_model_schema = json.loads(r"""{
+event_type_sse_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/SupportedEvents"
}, {
@@ -36,7 +43,9 @@
"$ref" : "#/components/schemas/EventKeepAlive"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
event_type_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
event_type_sse_faker = JSF(event_type_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/event_with_close_sse_stub.py b/test/types/event_with_close_sse_stub.py
index 494582c6..a9a82c89 100644
--- a/test/types/event_with_close_sse_stub.py
+++ b/test/types/event_with_close_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.event_with_close_sse import EventWithCloseSSE
@@ -22,10 +29,10 @@
EventWithCloseSSEAdapter = TypeAdapter(EventWithCloseSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for EventWithCloseSSE not available: {exc}")
MODELS_AVAILABLE = False
-event_with_close_sse_model_schema = json.loads(r"""{
+event_with_close_sse_model_schema = json.loads(
+ r"""{
"description" : "SSE stream events with closing protocol",
"anyOf" : [ {
"$ref" : "#/components/schemas/Stream_Ready"
@@ -37,7 +44,9 @@
"$ref" : "#/components/schemas/Stream_Closing"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
event_with_close_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
event_with_close_sse_faker = JSF(
diff --git a/test/types/exposed_openfaas_deploy_spec_stub.py b/test/types/exposed_openfaas_deploy_spec_stub.py
index 65201e30..dadbaafc 100644
--- a/test/types/exposed_openfaas_deploy_spec_stub.py
+++ b/test/types/exposed_openfaas_deploy_spec_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.exposed_openfaas_deploy_spec import (
@@ -24,10 +31,10 @@
ExposedOpenfaasDeploySpecAdapter = TypeAdapter(ExposedOpenfaasDeploySpec)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ExposedOpenfaasDeploySpec not available: {exc}")
MODELS_AVAILABLE = False
-exposed_openfaas_deploy_spec_model_schema = json.loads(r"""{
+exposed_openfaas_deploy_spec_model_schema = json.loads(
+ r"""{
"title" : "ExposedOpenfaasDeploySpec",
"required" : [ "image", "namespace", "service" ],
"type" : "object",
@@ -66,7 +73,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
exposed_openfaas_deploy_spec_model_schema.update({"definitions": MODEL_DEFINITIONS})
exposed_openfaas_deploy_spec_faker = JSF(
diff --git a/test/types/failed_event_data_stub.py b/test/types/failed_event_data_stub.py
index b3e0e926..f61d44ed 100644
--- a/test/types/failed_event_data_stub.py
+++ b/test/types/failed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.failed_event_data import FailedEventData
@@ -22,10 +29,10 @@
FailedEventDataAdapter = TypeAdapter(FailedEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FailedEventData not available: {exc}")
MODELS_AVAILABLE = False
-failed_event_data_model_schema = json.loads(r"""{
+failed_event_data_model_schema = json.loads(
+ r"""{
"title" : "FailedEventData",
"required" : [ "failedReason" ],
"type" : "object",
@@ -40,7 +47,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
failed_event_data_model_schema.update({"definitions": MODEL_DEFINITIONS})
failed_event_data_faker = JSF(failed_event_data_model_schema, allow_none_optionals=1)
diff --git a/test/types/failed_event_sse_stub.py b/test/types/failed_event_sse_stub.py
index c7022222..6f26783e 100644
--- a/test/types/failed_event_sse_stub.py
+++ b/test/types/failed_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.failed_event_sse import FailedEventSSE
@@ -22,10 +29,10 @@
FailedEventSSEAdapter = TypeAdapter(FailedEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FailedEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-failed_event_sse_model_schema = json.loads(r"""{
+failed_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
failed_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
failed_event_sse_faker = JSF(failed_event_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/failure_reason_stub.py b/test/types/failure_reason_stub.py
index c9c51827..57e908de 100644
--- a/test/types/failure_reason_stub.py
+++ b/test/types/failure_reason_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.failure_reason import FailureReason
@@ -22,10 +29,10 @@
FailureReasonAdapter = TypeAdapter(FailureReason)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FailureReason not available: {exc}")
MODELS_AVAILABLE = False
-failure_reason_model_schema = json.loads(r"""{
+failure_reason_model_schema = json.loads(
+ r"""{
"title" : "FailureReason",
"required" : [ "events", "log" ],
"type" : "object",
@@ -53,7 +60,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
failure_reason_model_schema.update({"definitions": MODEL_DEFINITIONS})
failure_reason_faker = JSF(failure_reason_model_schema, allow_none_optionals=1)
diff --git a/test/types/file_upload_stub.py b/test/types/file_upload_stub.py
index 7de26d2b..8da9c83a 100644
--- a/test/types/file_upload_stub.py
+++ b/test/types/file_upload_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.file_upload import FileUpload
@@ -22,10 +29,10 @@
FileUploadAdapter = TypeAdapter(FileUpload)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FileUpload not available: {exc}")
MODELS_AVAILABLE = False
-file_upload_model_schema = json.loads(r"""{
+file_upload_model_schema = json.loads(
+ r"""{
"title" : "File Upload",
"type" : "object",
"properties" : {
@@ -36,7 +43,9 @@
},
"description" : "A single asset file."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
file_upload_model_schema.update({"definitions": MODEL_DEFINITIONS})
file_upload_faker = JSF(file_upload_model_schema, allow_none_optionals=1)
diff --git a/test/types/force_delete_query_v1_stub.py b/test/types/force_delete_query_v1_stub.py
index 3524cad0..c26ef013 100644
--- a/test/types/force_delete_query_v1_stub.py
+++ b/test/types/force_delete_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.force_delete_query_v1 import ForceDeleteQueryV1
@@ -22,10 +29,10 @@
ForceDeleteQueryV1Adapter = TypeAdapter(ForceDeleteQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ForceDeleteQueryV1 not available: {exc}")
MODELS_AVAILABLE = False
-force_delete_query_v1_model_schema = json.loads(r"""{
+force_delete_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -40,7 +47,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
force_delete_query_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
force_delete_query_v1_faker = JSF(
diff --git a/test/types/function_delete_query_stub.py b/test/types/function_delete_query_stub.py
index 11f64813..938a88d5 100644
--- a/test/types/function_delete_query_stub.py
+++ b/test/types/function_delete_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_delete_query import (
@@ -24,10 +31,10 @@
FunctionDeleteQueryAdapter = TypeAdapter(FunctionDeleteQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionDeleteQuery not available: {exc}")
MODELS_AVAILABLE = False
-function_delete_query_model_schema = json.loads(r"""{
+function_delete_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"force" : {
@@ -41,7 +48,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_delete_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_delete_query_faker = JSF(
diff --git a/test/types/function_deploy_overrides_stub.py b/test/types/function_deploy_overrides_stub.py
index ab2e0970..976bc1ca 100644
--- a/test/types/function_deploy_overrides_stub.py
+++ b/test/types/function_deploy_overrides_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_deploy_overrides import (
@@ -24,10 +31,10 @@
FunctionDeployOverridesAdapter = TypeAdapter(FunctionDeployOverrides)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionDeployOverrides not available: {exc}")
MODELS_AVAILABLE = False
-function_deploy_overrides_model_schema = json.loads(r"""{
+function_deploy_overrides_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"deploy" : {
@@ -35,7 +42,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_deploy_overrides_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_deploy_overrides_faker = JSF(
diff --git a/test/types/function_deploy_overrides_type_stub.py b/test/types/function_deploy_overrides_type_stub.py
index cb054494..f9c43680 100644
--- a/test/types/function_deploy_overrides_type_stub.py
+++ b/test/types/function_deploy_overrides_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_deploy_overrides_type import (
@@ -24,10 +31,10 @@
FunctionDeployOverridesTypeAdapter = TypeAdapter(FunctionDeployOverridesType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionDeployOverridesType not available: {exc}")
MODELS_AVAILABLE = False
-function_deploy_overrides_type_model_schema = json.loads(r"""{
+function_deploy_overrides_type_model_schema = json.loads(
+ r"""{
"title" : "FunctionDeployOverridesType",
"type" : "object",
"properties" : {
@@ -60,7 +67,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_deploy_overrides_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_deploy_overrides_type_faker = JSF(
diff --git a/test/types/function_entity_query_stub.py b/test/types/function_entity_query_stub.py
index 2ed3aa33..31b9b243 100644
--- a/test/types/function_entity_query_stub.py
+++ b/test/types/function_entity_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_entity_query import (
@@ -24,10 +31,10 @@
FunctionEntityQueryAdapter = TypeAdapter(FunctionEntityQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionEntityQuery not available: {exc}")
MODELS_AVAILABLE = False
-function_entity_query_model_schema = json.loads(r"""{
+function_entity_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -52,7 +59,9 @@
"additionalProperties" : false,
"description" : "Filter on function attributes that do not change across function versions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_entity_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_entity_query_faker = JSF(
diff --git a/test/types/function_job_args_stub.py b/test/types/function_job_args_stub.py
index fa87bcf3..5f589d20 100644
--- a/test/types/function_job_args_stub.py
+++ b/test/types/function_job_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_job_args import FunctionJobArgs
@@ -22,10 +29,10 @@
FunctionJobArgsAdapter = TypeAdapter(FunctionJobArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionJobArgs not available: {exc}")
MODELS_AVAILABLE = False
-function_job_args_model_schema = json.loads(r"""{
+function_job_args_model_schema = json.loads(
+ r"""{
"required" : [ "runtimeName", "runtimeVersion" ],
"type" : "object",
"properties" : {
@@ -42,7 +49,9 @@
},
"description" : "Job arguments shared by all function jobs"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_job_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_job_args_faker = JSF(function_job_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/function_manifest_stub.py b/test/types/function_manifest_stub.py
index 169fa565..e7964d16 100644
--- a/test/types/function_manifest_stub.py
+++ b/test/types/function_manifest_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_manifest import FunctionManifest
@@ -22,10 +29,10 @@
FunctionManifestAdapter = TypeAdapter(FunctionManifest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionManifest not available: {exc}")
MODELS_AVAILABLE = False
-function_manifest_model_schema = json.loads(r"""{
+function_manifest_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "runtime", "version" ],
"type" : "object",
"properties" : {
@@ -50,7 +57,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_manifest_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_manifest_faker = JSF(function_manifest_model_schema, allow_none_optionals=1)
diff --git a/test/types/function_meta_stub.py b/test/types/function_meta_stub.py
index 522d5bb2..494077cd 100644
--- a/test/types/function_meta_stub.py
+++ b/test/types/function_meta_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_meta import FunctionMeta
@@ -22,10 +29,10 @@
FunctionMetaAdapter = TypeAdapter(FunctionMeta)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionMeta not available: {exc}")
MODELS_AVAILABLE = False
-function_meta_model_schema = json.loads(r"""{
+function_meta_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -47,7 +54,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_meta_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_meta_faker = JSF(function_meta_model_schema, allow_none_optionals=1)
diff --git a/test/types/function_name_version_stub.py b/test/types/function_name_version_stub.py
index 39906424..ff5af9ad 100644
--- a/test/types/function_name_version_stub.py
+++ b/test/types/function_name_version_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_name_version import (
@@ -24,10 +31,10 @@
FunctionNameVersionAdapter = TypeAdapter(FunctionNameVersion)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionNameVersion not available: {exc}")
MODELS_AVAILABLE = False
-function_name_version_model_schema = json.loads(r"""{
+function_name_version_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_name_version_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_name_version_faker = JSF(
diff --git a/test/types/function_ref_stub.py b/test/types/function_ref_stub.py
index de890299..035e5a64 100644
--- a/test/types/function_ref_stub.py
+++ b/test/types/function_ref_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_ref import FunctionRef
@@ -22,10 +29,10 @@
FunctionRefAdapter = TypeAdapter(FunctionRef)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionRef not available: {exc}")
MODELS_AVAILABLE = False
-function_ref_model_schema = json.loads(r"""{
+function_ref_model_schema = json.loads(
+ r"""{
"title" : "FunctionRef",
"required" : [ "functionType", "name" ],
"type" : "object",
@@ -51,7 +58,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_ref_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_ref_faker = JSF(function_ref_model_schema, allow_none_optionals=1)
diff --git a/test/types/function_spec_stub.py b/test/types/function_spec_stub.py
index cae2362d..aa797548 100644
--- a/test/types/function_spec_stub.py
+++ b/test/types/function_spec_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_spec import FunctionSpec
@@ -22,10 +29,10 @@
FunctionSpecAdapter = TypeAdapter(FunctionSpec)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionSpec not available: {exc}")
MODELS_AVAILABLE = False
-function_spec_model_schema = json.loads(r"""{
+function_spec_model_schema = json.loads(
+ r"""{
"required" : [ "name", "runtime", "version" ],
"type" : "object",
"properties" : {
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_spec_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_spec_faker = JSF(function_spec_model_schema, allow_none_optionals=1)
diff --git a/test/types/function_type_stub.py b/test/types/function_type_stub.py
index 821b2cd3..8d7c9cd9 100644
--- a/test/types/function_type_stub.py
+++ b/test/types/function_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_type import FunctionType
@@ -22,15 +29,17 @@
FunctionTypeAdapter = TypeAdapter(FunctionType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionType not available: {exc}")
MODELS_AVAILABLE = False
-function_type_model_schema = json.loads(r"""{
+function_type_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "Type of functions supported by the registry service.",
"enum" : [ "plugs", "webscripts", "kfserving" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_type_faker = JSF(function_type_model_schema, allow_none_optionals=1)
diff --git a/test/types/function_version_query_stub.py b/test/types/function_version_query_stub.py
index abd3e4e6..a92d4417 100644
--- a/test/types/function_version_query_stub.py
+++ b/test/types/function_version_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.function_version_query import (
@@ -24,10 +31,10 @@
FunctionVersionQueryAdapter = TypeAdapter(FunctionVersionQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for FunctionVersionQuery not available: {exc}")
MODELS_AVAILABLE = False
-function_version_query_model_schema = json.loads(r"""{
+function_version_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -70,7 +77,9 @@
"additionalProperties" : false,
"description" : "Filter on function attributes that can change across function versions. When these query parameters are used, the query is considered a _function version_ listing and no HAL links to latest (_draft_, _published_) versions are included."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
function_version_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
function_version_query_faker = JSF(
diff --git a/test/types/get_content_params_v2_stub.py b/test/types/get_content_params_v2_stub.py
index 9f93e339..95684ddc 100644
--- a/test/types/get_content_params_v2_stub.py
+++ b/test/types/get_content_params_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_content_params_v2 import GetContentParamsV2
@@ -22,10 +29,10 @@
GetContentParamsV2Adapter = TypeAdapter(GetContentParamsV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetContentParamsV2 not available: {exc}")
MODELS_AVAILABLE = False
-get_content_params_v2_model_schema = json.loads(r"""{
+get_content_params_v2_model_schema = json.loads(
+ r"""{
"required" : [ "*", "name", "version" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_content_params_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_content_params_v2_faker = JSF(
diff --git a/test/types/get_invokable_webscript_query_stub.py b/test/types/get_invokable_webscript_query_stub.py
index 51cf243a..5c2c2059 100644
--- a/test/types/get_invokable_webscript_query_stub.py
+++ b/test/types/get_invokable_webscript_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_invokable_webscript_query import (
@@ -24,10 +31,10 @@
GetInvokableWebscriptQueryAdapter = TypeAdapter(GetInvokableWebscriptQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetInvokableWebscriptQuery not available: {exc}")
MODELS_AVAILABLE = False
-get_invokable_webscript_query_model_schema = json.loads(r"""{
+get_invokable_webscript_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -52,7 +59,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_invokable_webscript_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_invokable_webscript_query_faker = JSF(
diff --git a/test/types/get_model_response_v2_stub.py b/test/types/get_model_response_v2_stub.py
index 7e00aed9..817af56d 100644
--- a/test/types/get_model_response_v2_stub.py
+++ b/test/types/get_model_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_model_response_v2 import GetModelResponseV2
@@ -22,10 +29,10 @@
GetModelResponseV2Adapter = TypeAdapter(GetModelResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetModelResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-get_model_response_v2_model_schema = json.loads(r"""{
+get_model_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"description" : "Model Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_model_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_model_response_v2_faker = JSF(
diff --git a/test/types/get_plug_response_v2_links_draft_stub.py b/test/types/get_plug_response_v2_links_draft_stub.py
index d48aa654..72a899be 100644
--- a/test/types/get_plug_response_v2_links_draft_stub.py
+++ b/test/types/get_plug_response_v2_links_draft_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_plug_response_v2_links_draft import (
@@ -24,10 +31,10 @@
GetPlugResponseV2LinksDraftAdapter = TypeAdapter(GetPlugResponseV2LinksDraft)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetPlugResponseV2LinksDraft not available: {exc}")
MODELS_AVAILABLE = False
-get_plug_response_v2__links_draft_model_schema = json.loads(r"""{
+get_plug_response_v2__links_draft_model_schema = json.loads(
+ r"""{
"title" : "GetPlugResponseV2__links_draft",
"required" : [ "deprecated", "draft", "href", "version" ],
"type" : "object",
@@ -53,7 +60,9 @@
"deprecated" : false
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_plug_response_v2__links_draft_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/get_plug_response_v2_links_published_stub.py b/test/types/get_plug_response_v2_links_published_stub.py
index b60fbbc5..946c11cc 100644
--- a/test/types/get_plug_response_v2_links_published_stub.py
+++ b/test/types/get_plug_response_v2_links_published_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_plug_response_v2_links_published import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for GetPlugResponseV2LinksPublished not available: {exc}"
- )
MODELS_AVAILABLE = False
-get_plug_response_v2__links_published_model_schema = json.loads(r"""{
+get_plug_response_v2__links_published_model_schema = json.loads(
+ r"""{
"title" : "GetPlugResponseV2__links_published",
"required" : [ "deprecated", "draft", "href", "version" ],
"type" : "object",
@@ -57,7 +62,9 @@
"deprecated" : false
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_plug_response_v2__links_published_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/get_plug_response_v2_links_stub.py b/test/types/get_plug_response_v2_links_stub.py
index b3d9968c..eec24f03 100644
--- a/test/types/get_plug_response_v2_links_stub.py
+++ b/test/types/get_plug_response_v2_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_plug_response_v2_links import (
@@ -24,10 +31,10 @@
GetPlugResponseV2LinksAdapter = TypeAdapter(GetPlugResponseV2Links)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetPlugResponseV2Links not available: {exc}")
MODELS_AVAILABLE = False
-get_plug_response_v2__links_model_schema = json.loads(r"""{
+get_plug_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "GetPlugResponseV2__links",
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "HAL links to related jobs and plugs"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_plug_response_v2__links_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_plug_response_v2__links_faker = JSF(
diff --git a/test/types/get_plug_response_v2_stub.py b/test/types/get_plug_response_v2_stub.py
index a842a359..63515e67 100644
--- a/test/types/get_plug_response_v2_stub.py
+++ b/test/types/get_plug_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_plug_response_v2 import GetPlugResponseV2
@@ -22,10 +29,10 @@
GetPlugResponseV2Adapter = TypeAdapter(GetPlugResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetPlugResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-get_plug_response_v2_model_schema = json.loads(r"""{
+get_plug_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"description" : "Plug Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_plug_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_plug_response_v2_faker = JSF(
diff --git a/test/types/get_runtime_by_name_and_version_query_stub.py b/test/types/get_runtime_by_name_and_version_query_stub.py
index 3153a470..9383df81 100644
--- a/test/types/get_runtime_by_name_and_version_query_stub.py
+++ b/test/types/get_runtime_by_name_and_version_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_runtime_by_name_and_version_query import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for GetRuntimeByNameAndVersionQuery not available: {exc}"
- )
MODELS_AVAILABLE = False
-get_runtime_by_name_and_version_query_model_schema = json.loads(r"""{
+get_runtime_by_name_and_version_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDeprecated" : {
@@ -42,7 +47,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_runtime_by_name_and_version_query_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/get_runtime_by_name_query_stub.py b/test/types/get_runtime_by_name_query_stub.py
index 9175935f..16f1aa3b 100644
--- a/test/types/get_runtime_by_name_query_stub.py
+++ b/test/types/get_runtime_by_name_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_runtime_by_name_query import (
@@ -24,10 +31,10 @@
GetRuntimeByNameQueryAdapter = TypeAdapter(GetRuntimeByNameQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetRuntimeByNameQuery not available: {exc}")
MODELS_AVAILABLE = False
-get_runtime_by_name_query_model_schema = json.loads(r"""{
+get_runtime_by_name_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -57,7 +64,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_runtime_by_name_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_runtime_by_name_query_faker = JSF(
diff --git a/test/types/get_runtime_example_query_stub.py b/test/types/get_runtime_example_query_stub.py
index 561ce8c4..4cfcb9a4 100644
--- a/test/types/get_runtime_example_query_stub.py
+++ b/test/types/get_runtime_example_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_runtime_example_query import (
@@ -24,10 +31,10 @@
GetRuntimeExampleQueryAdapter = TypeAdapter(GetRuntimeExampleQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetRuntimeExampleQuery not available: {exc}")
MODELS_AVAILABLE = False
-get_runtime_example_query_model_schema = json.loads(r"""{
+get_runtime_example_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"ls" : {
@@ -43,7 +50,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_runtime_example_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_runtime_example_query_faker = JSF(
diff --git a/test/types/get_runtime_versions_query_stub.py b/test/types/get_runtime_versions_query_stub.py
index abbcc8f2..296349aa 100644
--- a/test/types/get_runtime_versions_query_stub.py
+++ b/test/types/get_runtime_versions_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_runtime_versions_query import (
@@ -24,10 +31,10 @@
GetRuntimeVersionsQueryAdapter = TypeAdapter(GetRuntimeVersionsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetRuntimeVersionsQuery not available: {exc}")
MODELS_AVAILABLE = False
-get_runtime_versions_query_model_schema = json.loads(r"""{
+get_runtime_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -60,7 +67,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_runtime_versions_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_runtime_versions_query_faker = JSF(
diff --git a/test/types/get_webscript_response_v2_links_stub.py b/test/types/get_webscript_response_v2_links_stub.py
index d4f9e539..18beb6ef 100644
--- a/test/types/get_webscript_response_v2_links_stub.py
+++ b/test/types/get_webscript_response_v2_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_webscript_response_v2_links import (
@@ -24,10 +31,10 @@
GetWebscriptResponseV2LinksAdapter = TypeAdapter(GetWebscriptResponseV2Links)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetWebscriptResponseV2Links not available: {exc}")
MODELS_AVAILABLE = False
-get_webscript_response_v2__links_model_schema = json.loads(r"""{
+get_webscript_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "GetWebscriptResponseV2__links",
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_webscript_response_v2__links_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_webscript_response_v2__links_faker = JSF(
diff --git a/test/types/get_webscript_response_v2_stub.py b/test/types/get_webscript_response_v2_stub.py
index 395a21dd..ec492a42 100644
--- a/test/types/get_webscript_response_v2_stub.py
+++ b/test/types/get_webscript_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.get_webscript_response_v2 import (
@@ -24,10 +31,10 @@
GetWebscriptResponseV2Adapter = TypeAdapter(GetWebscriptResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for GetWebscriptResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-get_webscript_response_v2_model_schema = json.loads(r"""{
+get_webscript_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Webscript Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
get_webscript_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
get_webscript_response_v2_faker = JSF(
diff --git a/test/types/hal_link_stub.py b/test/types/hal_link_stub.py
index 09c957f5..026ace29 100644
--- a/test/types/hal_link_stub.py
+++ b/test/types/hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.hal_link import HALLink
@@ -22,10 +29,10 @@
HALLinkAdapter = TypeAdapter(HALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for HALLink not available: {exc}")
MODELS_AVAILABLE = False
-hal_link_model_schema = json.loads(r"""{
+hal_link_model_schema = json.loads(
+ r"""{
"title" : "HALLink",
"required" : [ "href" ],
"type" : "object",
@@ -36,7 +43,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
hal_link_faker = JSF(hal_link_model_schema, allow_none_optionals=1)
diff --git a/test/types/invokable_webscript_response_entity_stub.py b/test/types/invokable_webscript_response_entity_stub.py
index b0a3179d..1d606247 100644
--- a/test/types/invokable_webscript_response_entity_stub.py
+++ b/test/types/invokable_webscript_response_entity_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.invokable_webscript_response_entity import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for InvokableWebscriptResponseEntity not available: {exc}"
- )
MODELS_AVAILABLE = False
-invokable_webscript_response_entity_model_schema = json.loads(r"""{
+invokable_webscript_response_entity_model_schema = json.loads(
+ r"""{
"title" : "InvokableWebscriptResponse_entity",
"required" : [ "draft", "status", "webscript" ],
"type" : "object",
@@ -52,7 +57,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
invokable_webscript_response_entity_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/invokable_webscript_response_entity_webscript_stub.py b/test/types/invokable_webscript_response_entity_webscript_stub.py
index f019cef4..077244e9 100644
--- a/test/types/invokable_webscript_response_entity_webscript_stub.py
+++ b/test/types/invokable_webscript_response_entity_webscript_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.invokable_webscript_response_entity_webscript import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for InvokableWebscriptResponseEntityWebscript not available: {exc}"
- )
MODELS_AVAILABLE = False
-invokable_webscript_response_entity_webscript_model_schema = json.loads(r"""{
+invokable_webscript_response_entity_webscript_model_schema = json.loads(
+ r"""{
"title" : "InvokableWebscriptResponse_entity_webscript",
"required" : [ "allowHmac", "name", "private", "version" ],
"type" : "object",
@@ -53,7 +58,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
invokable_webscript_response_entity_webscript_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/invokable_webscript_response_stub.py b/test/types/invokable_webscript_response_stub.py
index cdca3f04..fc244700 100644
--- a/test/types/invokable_webscript_response_stub.py
+++ b/test/types/invokable_webscript_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.invokable_webscript_response import (
@@ -24,10 +31,10 @@
InvokableWebscriptResponseAdapter = TypeAdapter(InvokableWebscriptResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for InvokableWebscriptResponse not available: {exc}")
MODELS_AVAILABLE = False
-invokable_webscript_response_model_schema = json.loads(r"""{
+invokable_webscript_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Webscript Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
invokable_webscript_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
invokable_webscript_response_faker = JSF(
diff --git a/test/types/invoke_hal_link_stub.py b/test/types/invoke_hal_link_stub.py
index 451fff1d..1645a393 100644
--- a/test/types/invoke_hal_link_stub.py
+++ b/test/types/invoke_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.invoke_hal_link import InvokeHALLink
@@ -22,10 +29,10 @@
InvokeHALLinkAdapter = TypeAdapter(InvokeHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for InvokeHALLink not available: {exc}")
MODELS_AVAILABLE = False
-invoke_hal_link_model_schema = json.loads(r"""{
+invoke_hal_link_model_schema = json.loads(
+ r"""{
"title" : "InvokeHALLink",
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
invoke_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
invoke_hal_link_faker = JSF(invoke_hal_link_model_schema, allow_none_optionals=1)
diff --git a/test/types/invoke_internal_hal_link_stub.py b/test/types/invoke_internal_hal_link_stub.py
index 6ecd25ba..9a3ff978 100644
--- a/test/types/invoke_internal_hal_link_stub.py
+++ b/test/types/invoke_internal_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.invoke_internal_hal_link import (
@@ -24,10 +31,10 @@
InvokeInternalHALLinkAdapter = TypeAdapter(InvokeInternalHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for InvokeInternalHALLink not available: {exc}")
MODELS_AVAILABLE = False
-invoke_internal_hal_link_model_schema = json.loads(r"""{
+invoke_internal_hal_link_model_schema = json.loads(
+ r"""{
"title" : "InvokeInternalHALLink",
"type" : "object",
"properties" : {
@@ -36,7 +43,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
invoke_internal_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
invoke_internal_hal_link_faker = JSF(
diff --git a/test/types/job_and_function_hal_link_stub.py b/test/types/job_and_function_hal_link_stub.py
index 42baa105..8cc65b5e 100644
--- a/test/types/job_and_function_hal_link_stub.py
+++ b/test/types/job_and_function_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_and_function_hal_link import (
@@ -24,10 +31,10 @@
JobAndFunctionHALLinkAdapter = TypeAdapter(JobAndFunctionHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobAndFunctionHALLink not available: {exc}")
MODELS_AVAILABLE = False
-job_and_function_hal_link_model_schema = json.loads(r"""{
+job_and_function_hal_link_model_schema = json.loads(
+ r"""{
"title" : "JobAndFunctionHALLink",
"description" : "HAL links to related actions.",
"anyOf" : [ {
@@ -40,7 +47,9 @@
"$ref" : "#/components/schemas/JobHALLinks"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_and_function_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_and_function_hal_link_faker = JSF(
diff --git a/test/types/job_cause_stub.py b/test/types/job_cause_stub.py
index c2412f1d..8aceb5cb 100644
--- a/test/types/job_cause_stub.py
+++ b/test/types/job_cause_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_cause import JobCause
@@ -22,10 +29,10 @@
JobCauseAdapter = TypeAdapter(JobCause)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobCause not available: {exc}")
MODELS_AVAILABLE = False
-job_cause_model_schema = json.loads(r"""{
+job_cause_model_schema = json.loads(
+ r"""{
"title" : "JobCause",
"required" : [ "changed", "reason" ],
"type" : "object",
@@ -58,7 +65,9 @@
},
"description" : "The motivation for including or excluding a job (build, deploy, verify, ...) in response to a rebuild request."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_cause_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_cause_faker = JSF(job_cause_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_causes_stub.py b/test/types/job_causes_stub.py
index 3b5b5fd8..b88de137 100644
--- a/test/types/job_causes_stub.py
+++ b/test/types/job_causes_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_causes import JobCauses
@@ -22,10 +29,10 @@
JobCausesAdapter = TypeAdapter(JobCauses)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobCauses not available: {exc}")
MODELS_AVAILABLE = False
-job_causes_model_schema = json.loads(r"""{
+job_causes_model_schema = json.loads(
+ r"""{
"title" : "JobCauses",
"type" : "object",
"properties" : {
@@ -47,7 +54,9 @@
},
"description" : "The motivations for including or excluding a job in response to a rebuild request."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_causes_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_causes_faker = JSF(job_causes_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_event_payload_active_event_data_stub.py b/test/types/job_event_payload_active_event_data_stub.py
index 6a1adebd..56e160ae 100644
--- a/test/types/job_event_payload_active_event_data_stub.py
+++ b/test/types/job_event_payload_active_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_payload_active_event_data import (
@@ -24,12 +31,10 @@
JobEventPayloadActiveEventDataAdapter = TypeAdapter(JobEventPayloadActiveEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventPayloadActiveEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_payload_active_event_data__model_schema = json.loads(r"""{
+job_event_payload_active_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -46,7 +51,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_payload_active_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_payload_completed_event_data_stub.py b/test/types/job_event_payload_completed_event_data_stub.py
index 585cda4f..a2e9fc99 100644
--- a/test/types/job_event_payload_completed_event_data_stub.py
+++ b/test/types/job_event_payload_completed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_payload_completed_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventPayloadCompletedEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_payload_completed_event_data__model_schema = json.loads(r"""{
+job_event_payload_completed_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -48,7 +53,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_payload_completed_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_payload_delayed_event_data_stub.py b/test/types/job_event_payload_delayed_event_data_stub.py
index 12b213d1..4e7fb17d 100644
--- a/test/types/job_event_payload_delayed_event_data_stub.py
+++ b/test/types/job_event_payload_delayed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_payload_delayed_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventPayloadDelayedEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_payload_delayed_event_data__model_schema = json.loads(r"""{
+job_event_payload_delayed_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -48,7 +53,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_payload_delayed_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_payload_failed_event_data_stub.py b/test/types/job_event_payload_failed_event_data_stub.py
index 8980e238..f77690b1 100644
--- a/test/types/job_event_payload_failed_event_data_stub.py
+++ b/test/types/job_event_payload_failed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_payload_failed_event_data import (
@@ -24,12 +31,10 @@
JobEventPayloadFailedEventDataAdapter = TypeAdapter(JobEventPayloadFailedEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventPayloadFailedEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_payload_failed_event_data__model_schema = json.loads(r"""{
+job_event_payload_failed_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -46,7 +51,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_payload_failed_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_payload_waiting_children_event_data_stub.py b/test/types/job_event_payload_waiting_children_event_data_stub.py
index 8fa7b0e2..6144047a 100644
--- a/test/types/job_event_payload_waiting_children_event_data_stub.py
+++ b/test/types/job_event_payload_waiting_children_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_payload_waiting_children_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventPayloadWaitingChildrenEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_payload_waiting_children_event_data__model_schema = json.loads(r"""{
+job_event_payload_waiting_children_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -48,7 +53,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_payload_waiting_children_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_payload_waiting_event_data_stub.py b/test/types/job_event_payload_waiting_event_data_stub.py
index 766c1ee6..a2c2fae7 100644
--- a/test/types/job_event_payload_waiting_event_data_stub.py
+++ b/test/types/job_event_payload_waiting_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_payload_waiting_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventPayloadWaitingEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_payload_waiting_event_data__model_schema = json.loads(r"""{
+job_event_payload_waiting_event_data__model_schema = json.loads(
+ r"""{
"required" : [ "data", "job", "timestamp" ],
"type" : "object",
"properties" : {
@@ -48,7 +53,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_payload_waiting_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_response_active_event_data_stub.py b/test/types/job_event_response_active_event_data_stub.py
index be3868eb..69bab7fa 100644
--- a/test/types/job_event_response_active_event_data_stub.py
+++ b/test/types/job_event_response_active_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_response_active_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventResponseActiveEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_response_active_event_data__model_schema = json.loads(r"""{
+job_event_response_active_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_ActiveEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -57,7 +62,9 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_response_active_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_response_completed_event_data_stub.py b/test/types/job_event_response_completed_event_data_stub.py
index bf8b64dd..d8ceb9dd 100644
--- a/test/types/job_event_response_completed_event_data_stub.py
+++ b/test/types/job_event_response_completed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_response_completed_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventResponseCompletedEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_response_completed_event_data__model_schema = json.loads(r"""{
+job_event_response_completed_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_CompletedEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -57,7 +62,9 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_response_completed_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_response_delayed_event_data_stub.py b/test/types/job_event_response_delayed_event_data_stub.py
index cfe28d8f..0ed878df 100644
--- a/test/types/job_event_response_delayed_event_data_stub.py
+++ b/test/types/job_event_response_delayed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_response_delayed_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventResponseDelayedEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_response_delayed_event_data__model_schema = json.loads(r"""{
+job_event_response_delayed_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_DelayedEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -57,7 +62,9 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_response_delayed_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_response_failed_event_data_stub.py b/test/types/job_event_response_failed_event_data_stub.py
index 54f26fd9..f5bfc6ef 100644
--- a/test/types/job_event_response_failed_event_data_stub.py
+++ b/test/types/job_event_response_failed_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_response_failed_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventResponseFailedEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_response_failed_event_data__model_schema = json.loads(r"""{
+job_event_response_failed_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_FailedEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -57,7 +62,9 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_response_failed_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_response_waiting_children_event_data_stub.py b/test/types/job_event_response_waiting_children_event_data_stub.py
index 8142a03f..0f120d63 100644
--- a/test/types/job_event_response_waiting_children_event_data_stub.py
+++ b/test/types/job_event_response_waiting_children_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_response_waiting_children_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventResponseWaitingChildrenEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_response_waiting_children_event_data__model_schema = json.loads(r"""{
+job_event_response_waiting_children_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_WaitingChildrenEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -57,7 +62,9 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_response_waiting_children_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_response_waiting_event_data_stub.py b/test/types/job_event_response_waiting_event_data_stub.py
index 84000729..98bff68c 100644
--- a/test/types/job_event_response_waiting_event_data_stub.py
+++ b/test/types/job_event_response_waiting_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_response_waiting_event_data import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobEventResponseWaitingEventData not available: {exc}"
- )
MODELS_AVAILABLE = False
-job_event_response_waiting_event_data__model_schema = json.loads(r"""{
+job_event_response_waiting_event_data__model_schema = json.loads(
+ r"""{
"title" : "JobEventResponse_WaitingEventData_",
"required" : [ "_links", "data", "function", "job", "timestamp" ],
"type" : "object",
@@ -57,7 +62,9 @@
},
"description" : "Event object describing a state change of a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_response_waiting_event_data__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/job_event_sse_stub.py b/test/types/job_event_sse_stub.py
index 767e198f..515c6c83 100644
--- a/test/types/job_event_sse_stub.py
+++ b/test/types/job_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_event_sse import JobEventSSE
@@ -22,10 +29,10 @@
JobEventSSEAdapter = TypeAdapter(JobEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-job_event_sse_model_schema = json.loads(r"""{
+job_event_sse_model_schema = json.loads(
+ r"""{
"anyOf" : [ {
"$ref" : "#/components/schemas/ActiveEventSSE"
}, {
@@ -40,7 +47,9 @@
"$ref" : "#/components/schemas/WaitingChildrenEventSSE"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_event_sse_faker = JSF(job_event_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_events_and_function_hal_link_stub.py b/test/types/job_events_and_function_hal_link_stub.py
index 08788189..07a372fb 100644
--- a/test/types/job_events_and_function_hal_link_stub.py
+++ b/test/types/job_events_and_function_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_events_and_function_hal_link import (
@@ -24,10 +31,10 @@
JobEventsAndFunctionHALLinkAdapter = TypeAdapter(JobEventsAndFunctionHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobEventsAndFunctionHALLink not available: {exc}")
MODELS_AVAILABLE = False
-job_events_and_function_hal_link_model_schema = json.loads(r"""{
+job_events_and_function_hal_link_model_schema = json.loads(
+ r"""{
"title" : "JobEventsAndFunctionHALLink",
"description" : "HAL links to related actions.",
"anyOf" : [ {
@@ -40,7 +47,9 @@
"$ref" : "#/components/schemas/JobEventsHALLink"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_events_and_function_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_events_and_function_hal_link_faker = JSF(
diff --git a/test/types/job_events_filter_query_stub.py b/test/types/job_events_filter_query_stub.py
index 4f57df65..99c07b42 100644
--- a/test/types/job_events_filter_query_stub.py
+++ b/test/types/job_events_filter_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_events_filter_query import (
@@ -24,10 +31,10 @@
JobEventsFilterQueryAdapter = TypeAdapter(JobEventsFilterQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobEventsFilterQuery not available: {exc}")
MODELS_AVAILABLE = False
-job_events_filter_query_model_schema = json.loads(r"""{
+job_events_filter_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -44,7 +51,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_events_filter_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_events_filter_query_faker = JSF(
diff --git a/test/types/job_events_hal_link_stub.py b/test/types/job_events_hal_link_stub.py
index f59c062c..ca1d0677 100644
--- a/test/types/job_events_hal_link_stub.py
+++ b/test/types/job_events_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_events_hal_link import JobEventsHALLink
@@ -22,10 +29,10 @@
JobEventsHALLinkAdapter = TypeAdapter(JobEventsHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobEventsHALLink not available: {exc}")
MODELS_AVAILABLE = False
-job_events_hal_link_model_schema = json.loads(r"""{
+job_events_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"event" : {
@@ -34,7 +41,9 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_events_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_events_hal_link_faker = JSF(
diff --git a/test/types/job_hal_links_stub.py b/test/types/job_hal_links_stub.py
index d5868973..89bbabf0 100644
--- a/test/types/job_hal_links_stub.py
+++ b/test/types/job_hal_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_hal_links import JobHALLinks
@@ -22,10 +29,10 @@
JobHALLinksAdapter = TypeAdapter(JobHALLinks)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobHALLinks not available: {exc}")
MODELS_AVAILABLE = False
-job_hal_links_model_schema = json.loads(r"""{
+job_hal_links_model_schema = json.loads(
+ r"""{
"title" : "JobHALLinks",
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_hal_links_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_hal_links_faker = JSF(job_hal_links_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_query_stub.py b/test/types/job_query_stub.py
index e577d8bd..6eef5d9e 100644
--- a/test/types/job_query_stub.py
+++ b/test/types/job_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_query import JobQuery
@@ -22,10 +29,10 @@
JobQueryAdapter = TypeAdapter(JobQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobQuery not available: {exc}")
MODELS_AVAILABLE = False
-job_query_model_schema = json.loads(r"""{
+job_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -63,7 +70,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_query_faker = JSF(job_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_reference_params_stub.py b/test/types/job_reference_params_stub.py
index 010cd2e7..eed5c76b 100644
--- a/test/types/job_reference_params_stub.py
+++ b/test/types/job_reference_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_reference_params import JobReferenceParams
@@ -22,10 +29,10 @@
JobReferenceParamsAdapter = TypeAdapter(JobReferenceParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobReferenceParams not available: {exc}")
MODELS_AVAILABLE = False
-job_reference_params_model_schema = json.loads(r"""{
+job_reference_params_model_schema = json.loads(
+ r"""{
"required" : [ "id", "type" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_reference_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_reference_params_faker = JSF(
diff --git a/test/types/job_reference_stub.py b/test/types/job_reference_stub.py
index 50bade5b..52fa0e7b 100644
--- a/test/types/job_reference_stub.py
+++ b/test/types/job_reference_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_reference import JobReference
@@ -22,10 +29,10 @@
JobReferenceAdapter = TypeAdapter(JobReference)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobReference not available: {exc}")
MODELS_AVAILABLE = False
-job_reference_model_schema = json.loads(r"""{
+job_reference_model_schema = json.loads(
+ r"""{
"title" : "JobReference",
"required" : [ "type" ],
"type" : "object",
@@ -39,7 +46,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_reference_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_reference_faker = JSF(job_reference_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_response_stub.py b/test/types/job_response_stub.py
index c4763dd1..149b1d68 100644
--- a/test/types/job_response_stub.py
+++ b/test/types/job_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_response import JobResponse
@@ -22,10 +29,10 @@
JobResponseAdapter = TypeAdapter(JobResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobResponse not available: {exc}")
MODELS_AVAILABLE = False
-job_response_model_schema = json.loads(r"""{
+job_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "job" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"description" : "Job Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_response_faker = JSF(job_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_active_stub.py b/test/types/job_state_active_stub.py
index a5add043..3ccc748b 100644
--- a/test/types/job_state_active_stub.py
+++ b/test/types/job_state_active_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_active import JobStateActive
@@ -22,16 +29,18 @@
JobStateActiveAdapter = TypeAdapter(JobStateActive)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateActive not available: {exc}")
MODELS_AVAILABLE = False
-job_state_active_model_schema = json.loads(r"""{
+job_state_active_model_schema = json.loads(
+ r"""{
"title" : "JobStateActive",
"type" : "string",
"description" : "The job is running.",
"enum" : [ "active" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_active_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_active_faker = JSF(job_state_active_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_completed_stub.py b/test/types/job_state_completed_stub.py
index 84d70333..024e22b7 100644
--- a/test/types/job_state_completed_stub.py
+++ b/test/types/job_state_completed_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_completed import JobStateCompleted
@@ -22,16 +29,18 @@
JobStateCompletedAdapter = TypeAdapter(JobStateCompleted)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateCompleted not available: {exc}")
MODELS_AVAILABLE = False
-job_state_completed_model_schema = json.loads(r"""{
+job_state_completed_model_schema = json.loads(
+ r"""{
"title" : "JobStateCompleted",
"type" : "string",
"description" : "The job has completed successfully.",
"enum" : [ "completed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_completed_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_completed_faker = JSF(
diff --git a/test/types/job_state_delayed_stub.py b/test/types/job_state_delayed_stub.py
index ad5c4c3a..4e502b2d 100644
--- a/test/types/job_state_delayed_stub.py
+++ b/test/types/job_state_delayed_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_delayed import JobStateDelayed
@@ -22,16 +29,18 @@
JobStateDelayedAdapter = TypeAdapter(JobStateDelayed)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateDelayed not available: {exc}")
MODELS_AVAILABLE = False
-job_state_delayed_model_schema = json.loads(r"""{
+job_state_delayed_model_schema = json.loads(
+ r"""{
"title" : "JobStateDelayed",
"type" : "string",
"description" : "The job has been delayed for retry after a failure.",
"enum" : [ "delayed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_delayed_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_delayed_faker = JSF(job_state_delayed_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_failed_stub.py b/test/types/job_state_failed_stub.py
index e3785a62..fa69f259 100644
--- a/test/types/job_state_failed_stub.py
+++ b/test/types/job_state_failed_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_failed import JobStateFailed
@@ -22,16 +29,18 @@
JobStateFailedAdapter = TypeAdapter(JobStateFailed)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateFailed not available: {exc}")
MODELS_AVAILABLE = False
-job_state_failed_model_schema = json.loads(r"""{
+job_state_failed_model_schema = json.loads(
+ r"""{
"title" : "JobStateFailed",
"type" : "string",
"description" : "The job failed in execution.",
"enum" : [ "failed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_failed_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_failed_faker = JSF(job_state_failed_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_finished_stub.py b/test/types/job_state_finished_stub.py
index 1b2bffaf..22994f57 100644
--- a/test/types/job_state_finished_stub.py
+++ b/test/types/job_state_finished_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_finished import JobStateFinished
@@ -22,10 +29,10 @@
JobStateFinishedAdapter = TypeAdapter(JobStateFinished)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateFinished not available: {exc}")
MODELS_AVAILABLE = False
-job_state_finished_model_schema = json.loads(r"""{
+job_state_finished_model_schema = json.loads(
+ r"""{
"title" : "JobStateFinished",
"description" : "The job completed successfully or with failure.",
"anyOf" : [ {
@@ -34,7 +41,9 @@
"$ref" : "#/components/schemas/JobStateFailed"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_finished_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_finished_faker = JSF(job_state_finished_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_result_stub.py b/test/types/job_state_result_stub.py
index 04a51236..46cd4482 100644
--- a/test/types/job_state_result_stub.py
+++ b/test/types/job_state_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_result import JobStateResult
@@ -22,10 +29,10 @@
JobStateResultAdapter = TypeAdapter(JobStateResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateResult not available: {exc}")
MODELS_AVAILABLE = False
-job_state_result_model_schema = json.loads(r"""{
+job_state_result_model_schema = json.loads(
+ r"""{
"title" : "JobStateResult",
"description" : "All reported job states",
"anyOf" : [ {
@@ -34,7 +41,9 @@
"$ref" : "#/components/schemas/JobStateUnknown"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_result_faker = JSF(job_state_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_stub.py b/test/types/job_state_stub.py
index 3db0d2a2..9abb2cba 100644
--- a/test/types/job_state_stub.py
+++ b/test/types/job_state_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state import JobState
@@ -22,10 +29,10 @@
JobStateAdapter = TypeAdapter(JobState)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobState not available: {exc}")
MODELS_AVAILABLE = False
-job_state_model_schema = json.loads(r"""{
+job_state_model_schema = json.loads(
+ r"""{
"title" : "JobState",
"description" : "Allowed job states",
"anyOf" : [ {
@@ -40,7 +47,9 @@
"$ref" : "#/components/schemas/JobStateWaitingChildren"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_faker = JSF(job_state_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_unknown_stub.py b/test/types/job_state_unknown_stub.py
index 12040cdf..9a9a8668 100644
--- a/test/types/job_state_unknown_stub.py
+++ b/test/types/job_state_unknown_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_unknown import JobStateUnknown
@@ -22,16 +29,18 @@
JobStateUnknownAdapter = TypeAdapter(JobStateUnknown)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateUnknown not available: {exc}")
MODELS_AVAILABLE = False
-job_state_unknown_model_schema = json.loads(r"""{
+job_state_unknown_model_schema = json.loads(
+ r"""{
"title" : "JobStateUnknown",
"type" : "string",
"description" : "The job state is unknown (undocument or inconsistent).",
"enum" : [ "unknown" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_unknown_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_unknown_faker = JSF(job_state_unknown_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_state_waiting_children_stub.py b/test/types/job_state_waiting_children_stub.py
index 9942534d..37362575 100644
--- a/test/types/job_state_waiting_children_stub.py
+++ b/test/types/job_state_waiting_children_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_waiting_children import (
@@ -24,16 +31,18 @@
JobStateWaitingChildrenAdapter = TypeAdapter(JobStateWaitingChildren)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateWaitingChildren not available: {exc}")
MODELS_AVAILABLE = False
-job_state_waiting_children_model_schema = json.loads(r"""{
+job_state_waiting_children_model_schema = json.loads(
+ r"""{
"title" : "JobStateWaitingChildren",
"type" : "string",
"description" : "The job is waiting for child jobs to be completed.",
"enum" : [ "waiting-children" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_waiting_children_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_waiting_children_faker = JSF(
diff --git a/test/types/job_state_waiting_stub.py b/test/types/job_state_waiting_stub.py
index 57faa9b4..7dc7d508 100644
--- a/test/types/job_state_waiting_stub.py
+++ b/test/types/job_state_waiting_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_state_waiting import JobStateWaiting
@@ -22,16 +29,18 @@
JobStateWaitingAdapter = TypeAdapter(JobStateWaiting)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStateWaiting not available: {exc}")
MODELS_AVAILABLE = False
-job_state_waiting_model_schema = json.loads(r"""{
+job_state_waiting_model_schema = json.loads(
+ r"""{
"title" : "JobStateWaiting",
"type" : "string",
"description" : "The job has been queued for execution, but might be waiting because of rate limiting.",
"enum" : [ "waiting" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_state_waiting_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_state_waiting_faker = JSF(job_state_waiting_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_status_and_entity_hal_links_stub.py b/test/types/job_status_and_entity_hal_links_stub.py
index bc0c0997..9ad4c102 100644
--- a/test/types/job_status_and_entity_hal_links_stub.py
+++ b/test/types/job_status_and_entity_hal_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_status_and_entity_hal_links import (
@@ -24,10 +31,10 @@
JobStatusAndEntityHALLinksAdapter = TypeAdapter(JobStatusAndEntityHALLinks)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStatusAndEntityHALLinks not available: {exc}")
MODELS_AVAILABLE = False
-job_status_and_entity_hal_links_model_schema = json.loads(r"""{
+job_status_and_entity_hal_links_model_schema = json.loads(
+ r"""{
"title" : "JobStatusAndEntityHALLinks",
"description" : "HAL links to related actions.",
"anyOf" : [ {
@@ -40,7 +47,9 @@
"$ref" : "#/components/schemas/JobStatusHALLink"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_status_and_entity_hal_links_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_status_and_entity_hal_links_faker = JSF(
diff --git a/test/types/job_status_hal_link_stub.py b/test/types/job_status_hal_link_stub.py
index ff4d6647..ff8c9f8d 100644
--- a/test/types/job_status_hal_link_stub.py
+++ b/test/types/job_status_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_status_hal_link import JobStatusHALLink
@@ -22,10 +29,10 @@
JobStatusHALLinkAdapter = TypeAdapter(JobStatusHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStatusHALLink not available: {exc}")
MODELS_AVAILABLE = False
-job_status_hal_link_model_schema = json.loads(r"""{
+job_status_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"job" : {
@@ -34,7 +41,9 @@
},
"description" : "HAL links to related actions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_status_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_status_hal_link_faker = JSF(
diff --git a/test/types/job_status_progress_stub.py b/test/types/job_status_progress_stub.py
index be9d3b55..d17c3ade 100644
--- a/test/types/job_status_progress_stub.py
+++ b/test/types/job_status_progress_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_status_progress import JobStatusProgress
@@ -22,10 +29,10 @@
JobStatusProgressAdapter = TypeAdapter(JobStatusProgress)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStatusProgress not available: {exc}")
MODELS_AVAILABLE = False
-job_status_progress_model_schema = json.loads(r"""{
+job_status_progress_model_schema = json.loads(
+ r"""{
"title" : "JobStatus_progress",
"anyOf" : [ {
"type" : "number"
@@ -33,7 +40,9 @@
"type" : "object"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_status_progress_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_status_progress_faker = JSF(
diff --git a/test/types/job_status_stub.py b/test/types/job_status_stub.py
index 917cf393..ae96049d 100644
--- a/test/types/job_status_stub.py
+++ b/test/types/job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_status import JobStatus
@@ -22,10 +29,10 @@
JobStatusAdapter = TypeAdapter(JobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobStatus not available: {exc}")
MODELS_AVAILABLE = False
-job_status_model_schema = json.loads(r"""{
+job_status_model_schema = json.loads(
+ r"""{
"title" : "JobStatus",
"required" : [ "attemptsMade", "id", "name", "progress" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_status_faker = JSF(job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_submitted_response_stub.py b/test/types/job_submitted_response_stub.py
index 5f7df7a7..290405d4 100644
--- a/test/types/job_submitted_response_stub.py
+++ b/test/types/job_submitted_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_submitted_response import (
@@ -24,10 +31,10 @@
JobSubmittedResponseAdapter = TypeAdapter(JobSubmittedResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobSubmittedResponse not available: {exc}")
MODELS_AVAILABLE = False
-job_submitted_response_model_schema = json.loads(r"""{
+job_submitted_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message" ],
"type" : "object",
"properties" : {
@@ -39,7 +46,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_submitted_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_submitted_response_faker = JSF(
diff --git a/test/types/job_type_batch_stub.py b/test/types/job_type_batch_stub.py
index 297e6dbe..052e2ccf 100644
--- a/test/types/job_type_batch_stub.py
+++ b/test/types/job_type_batch_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_batch import JobTypeBatch
@@ -22,16 +29,18 @@
JobTypeBatchAdapter = TypeAdapter(JobTypeBatch)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeBatch not available: {exc}")
MODELS_AVAILABLE = False
-job_type_batch_model_schema = json.loads(r"""{
+job_type_batch_model_schema = json.loads(
+ r"""{
"title" : "JobTypeBatch",
"type" : "string",
"description" : "A job that groups other jobs as a parent.",
"enum" : [ "batch" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_batch_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_batch_faker = JSF(job_type_batch_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_build_stub.py b/test/types/job_type_build_stub.py
index 1d7a8cf3..f8453548 100644
--- a/test/types/job_type_build_stub.py
+++ b/test/types/job_type_build_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_build import JobTypeBuild
@@ -22,16 +29,18 @@
JobTypeBuildAdapter = TypeAdapter(JobTypeBuild)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeBuild not available: {exc}")
MODELS_AVAILABLE = False
-job_type_build_model_schema = json.loads(r"""{
+job_type_build_model_schema = json.loads(
+ r"""{
"title" : "JobTypeBuild",
"type" : "string",
"description" : "Build",
"enum" : [ "build" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_build_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_build_faker = JSF(job_type_build_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_deploy_stub.py b/test/types/job_type_deploy_stub.py
index 9dd216b2..297e3734 100644
--- a/test/types/job_type_deploy_stub.py
+++ b/test/types/job_type_deploy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_deploy import JobTypeDeploy
@@ -22,16 +29,18 @@
JobTypeDeployAdapter = TypeAdapter(JobTypeDeploy)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeDeploy not available: {exc}")
MODELS_AVAILABLE = False
-job_type_deploy_model_schema = json.loads(r"""{
+job_type_deploy_model_schema = json.loads(
+ r"""{
"title" : "JobTypeDeploy",
"type" : "string",
"description" : "A job that deploys a function image to the openfaas runtime.",
"enum" : [ "deploy" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_deploy_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_deploy_faker = JSF(job_type_deploy_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_scale_stub.py b/test/types/job_type_scale_stub.py
index 72f79600..f6257438 100644
--- a/test/types/job_type_scale_stub.py
+++ b/test/types/job_type_scale_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_scale import JobTypeScale
@@ -22,16 +29,18 @@
JobTypeScaleAdapter = TypeAdapter(JobTypeScale)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeScale not available: {exc}")
MODELS_AVAILABLE = False
-job_type_scale_model_schema = json.loads(r"""{
+job_type_scale_model_schema = json.loads(
+ r"""{
"title" : "JobTypeScale",
"type" : "string",
"description" : "A job that scales a function to a target.",
"enum" : [ "scale" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_scale_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_scale_faker = JSF(job_type_scale_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_schema_stub.py b/test/types/job_type_schema_stub.py
index e09a813b..5f875709 100644
--- a/test/types/job_type_schema_stub.py
+++ b/test/types/job_type_schema_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_schema import JobTypeSchema
@@ -22,10 +29,10 @@
JobTypeSchemaAdapter = TypeAdapter(JobTypeSchema)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeSchema not available: {exc}")
MODELS_AVAILABLE = False
-job_type_schema_model_schema = json.loads(r"""{
+job_type_schema_model_schema = json.loads(
+ r"""{
"title" : "JobTypeSchema",
"anyOf" : [ {
"$ref" : "#/components/schemas/JobTypeBuild"
@@ -41,7 +48,9 @@
"$ref" : "#/components/schemas/JobTypeBatch"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_schema_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_schema_faker = JSF(job_type_schema_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_stub.py b/test/types/job_type_stub.py
index d6063c18..0433a5e0 100644
--- a/test/types/job_type_stub.py
+++ b/test/types/job_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type import JobType
@@ -22,15 +29,17 @@
JobTypeAdapter = TypeAdapter(JobType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobType not available: {exc}")
MODELS_AVAILABLE = False
-job_type_model_schema = json.loads(r"""{
+job_type_model_schema = json.loads(
+ r"""{
"title" : "JobType",
"type" : "string",
"enum" : [ "build", "deploy", "verify", "undeploy", "batch", "scale", "cleanup", "other" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_faker = JSF(job_type_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_undeploy_stub.py b/test/types/job_type_undeploy_stub.py
index afa0ef7d..d22f2246 100644
--- a/test/types/job_type_undeploy_stub.py
+++ b/test/types/job_type_undeploy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_undeploy import JobTypeUndeploy
@@ -22,16 +29,18 @@
JobTypeUndeployAdapter = TypeAdapter(JobTypeUndeploy)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeUndeploy not available: {exc}")
MODELS_AVAILABLE = False
-job_type_undeploy_model_schema = json.loads(r"""{
+job_type_undeploy_model_schema = json.loads(
+ r"""{
"title" : "JobTypeUndeploy",
"type" : "string",
"description" : "A job that undeploys a deployed function and removes it from the registry.",
"enum" : [ "undeploy" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_undeploy_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_undeploy_faker = JSF(job_type_undeploy_model_schema, allow_none_optionals=1)
diff --git a/test/types/job_type_verify_stub.py b/test/types/job_type_verify_stub.py
index 9fe7947b..0cda694b 100644
--- a/test/types/job_type_verify_stub.py
+++ b/test/types/job_type_verify_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.job_type_verify import JobTypeVerify
@@ -22,16 +29,18 @@
JobTypeVerifyAdapter = TypeAdapter(JobTypeVerify)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobTypeVerify not available: {exc}")
MODELS_AVAILABLE = False
-job_type_verify_model_schema = json.loads(r"""{
+job_type_verify_model_schema = json.loads(
+ r"""{
"title" : "JobTypeVerify",
"type" : "string",
"description" : "A job that checks the health of a deployed function.",
"enum" : [ "verify" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
job_type_verify_model_schema.update({"definitions": MODEL_DEFINITIONS})
job_type_verify_faker = JSF(job_type_verify_model_schema, allow_none_optionals=1)
diff --git a/test/types/jobs_for_model_response_v2_links_stub.py b/test/types/jobs_for_model_response_v2_links_stub.py
index aa578467..d89e9cda 100644
--- a/test/types/jobs_for_model_response_v2_links_stub.py
+++ b/test/types/jobs_for_model_response_v2_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_for_model_response_v2_links import (
@@ -24,10 +31,10 @@
JobsForModelResponseV2LinksAdapter = TypeAdapter(JobsForModelResponseV2Links)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsForModelResponseV2Links not available: {exc}")
MODELS_AVAILABLE = False
-jobs_for_model_response_v2__links_model_schema = json.loads(r"""{
+jobs_for_model_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "JobsForModelResponseV2__links",
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
"additionalProperties" : false,
"description" : "Link to the function entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_for_model_response_v2__links_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/jobs_for_model_response_v2_stub.py b/test/types/jobs_for_model_response_v2_stub.py
index 311c7287..e967448e 100644
--- a/test/types/jobs_for_model_response_v2_stub.py
+++ b/test/types/jobs_for_model_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_for_model_response_v2 import (
@@ -24,10 +31,10 @@
JobsForModelResponseV2Adapter = TypeAdapter(JobsForModelResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsForModelResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-jobs_for_model_response_v2_model_schema = json.loads(r"""{
+jobs_for_model_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "function", "jobs" ],
"type" : "object",
"properties" : {
@@ -47,7 +54,9 @@
},
"description" : "Model Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_for_model_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
jobs_for_model_response_v2_faker = JSF(
diff --git a/test/types/jobs_for_plug_response_v2_links_stub.py b/test/types/jobs_for_plug_response_v2_links_stub.py
index 94b11604..0fddfda5 100644
--- a/test/types/jobs_for_plug_response_v2_links_stub.py
+++ b/test/types/jobs_for_plug_response_v2_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_for_plug_response_v2_links import (
@@ -24,10 +31,10 @@
JobsForPlugResponseV2LinksAdapter = TypeAdapter(JobsForPlugResponseV2Links)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsForPlugResponseV2Links not available: {exc}")
MODELS_AVAILABLE = False
-jobs_for_plug_response_v2__links_model_schema = json.loads(r"""{
+jobs_for_plug_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "JobsForPlugResponseV2__links",
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
"additionalProperties" : false,
"description" : "Link to the function entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_for_plug_response_v2__links_model_schema.update({"definitions": MODEL_DEFINITIONS})
jobs_for_plug_response_v2__links_faker = JSF(
diff --git a/test/types/jobs_for_plug_response_v2_stub.py b/test/types/jobs_for_plug_response_v2_stub.py
index 38da43c8..9029c6a0 100644
--- a/test/types/jobs_for_plug_response_v2_stub.py
+++ b/test/types/jobs_for_plug_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_for_plug_response_v2 import (
@@ -24,10 +31,10 @@
JobsForPlugResponseV2Adapter = TypeAdapter(JobsForPlugResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsForPlugResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-jobs_for_plug_response_v2_model_schema = json.loads(r"""{
+jobs_for_plug_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "function", "jobs" ],
"type" : "object",
"properties" : {
@@ -47,7 +54,9 @@
},
"description" : "Plug Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_for_plug_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
jobs_for_plug_response_v2_faker = JSF(
diff --git a/test/types/jobs_for_webscript_response_v2_links_stub.py b/test/types/jobs_for_webscript_response_v2_links_stub.py
index fdc7a92c..cd58c058 100644
--- a/test/types/jobs_for_webscript_response_v2_links_stub.py
+++ b/test/types/jobs_for_webscript_response_v2_links_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_for_webscript_response_v2_links import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for JobsForWebscriptResponseV2Links not available: {exc}"
- )
MODELS_AVAILABLE = False
-jobs_for_webscript_response_v2__links_model_schema = json.loads(r"""{
+jobs_for_webscript_response_v2__links_model_schema = json.loads(
+ r"""{
"title" : "JobsForWebscriptResponseV2__links",
"type" : "object",
"properties" : {
@@ -42,7 +47,9 @@
"additionalProperties" : false,
"description" : "Link to the function entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_for_webscript_response_v2__links_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/jobs_for_webscript_response_v2_stub.py b/test/types/jobs_for_webscript_response_v2_stub.py
index 6ae14b64..41b2da74 100644
--- a/test/types/jobs_for_webscript_response_v2_stub.py
+++ b/test/types/jobs_for_webscript_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_for_webscript_response_v2 import (
@@ -24,10 +31,10 @@
JobsForWebscriptResponseV2Adapter = TypeAdapter(JobsForWebscriptResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsForWebscriptResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-jobs_for_webscript_response_v2_model_schema = json.loads(r"""{
+jobs_for_webscript_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "function", "jobs" ],
"type" : "object",
"properties" : {
@@ -47,7 +54,9 @@
},
"description" : "Webscript Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_for_webscript_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
jobs_for_webscript_response_v2_faker = JSF(
diff --git a/test/types/jobs_hal_link_stub.py b/test/types/jobs_hal_link_stub.py
index 3ecdb309..71455620 100644
--- a/test/types/jobs_hal_link_stub.py
+++ b/test/types/jobs_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_hal_link import JobsHALLink
@@ -22,10 +29,10 @@
JobsHALLinkAdapter = TypeAdapter(JobsHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsHALLink not available: {exc}")
MODELS_AVAILABLE = False
-jobs_hal_link_model_schema = json.loads(r"""{
+jobs_hal_link_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"jobs" : {
@@ -33,7 +40,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
jobs_hal_link_faker = JSF(jobs_hal_link_model_schema, allow_none_optionals=1)
diff --git a/test/types/jobs_response_stub.py b/test/types/jobs_response_stub.py
index 8113b519..9719c215 100644
--- a/test/types/jobs_response_stub.py
+++ b/test/types/jobs_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.jobs_response import JobsResponse
@@ -22,10 +29,10 @@
JobsResponseAdapter = TypeAdapter(JobsResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for JobsResponse not available: {exc}")
MODELS_AVAILABLE = False
-jobs_response_model_schema = json.loads(r"""{
+jobs_response_model_schema = json.loads(
+ r"""{
"required" : [ "jobs" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Jobs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
jobs_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
jobs_response_faker = JSF(jobs_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/keep_alive_event_sse_stub.py b/test/types/keep_alive_event_sse_stub.py
index 12553c4f..91e21141 100644
--- a/test/types/keep_alive_event_sse_stub.py
+++ b/test/types/keep_alive_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.keep_alive_event_sse import KeepAliveEventSSE
@@ -22,10 +29,10 @@
KeepAliveEventSSEAdapter = TypeAdapter(KeepAliveEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KeepAliveEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-keep_alive_event_sse_model_schema = json.loads(r"""{
+keep_alive_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "event" ],
"type" : "object",
"properties" : {
@@ -39,7 +46,9 @@
},
"description" : "A message that acknowledges that the stream is still alive."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
keep_alive_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
keep_alive_event_sse_faker = JSF(
diff --git a/test/types/kf_serving_delete_multiple_response_stub.py b/test/types/kf_serving_delete_multiple_response_stub.py
index 9fcfc42e..07904174 100644
--- a/test/types/kf_serving_delete_multiple_response_stub.py
+++ b/test/types/kf_serving_delete_multiple_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_delete_multiple_response import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for KFServingDeleteMultipleResponse not available: {exc}"
- )
MODELS_AVAILABLE = False
-kf_serving_delete_multiple_response_model_schema = json.loads(r"""{
+kf_serving_delete_multiple_response_model_schema = json.loads(
+ r"""{
"required" : [ "name", "versions" ],
"type" : "object",
"properties" : {
@@ -47,7 +52,9 @@
},
"description" : "Models Deleted"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_delete_multiple_response_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/kf_serving_delete_multiple_with_job_response_stub.py b/test/types/kf_serving_delete_multiple_with_job_response_stub.py
index 44441622..4aee5bf2 100644
--- a/test/types/kf_serving_delete_multiple_with_job_response_stub.py
+++ b/test/types/kf_serving_delete_multiple_with_job_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_delete_multiple_with_job_response import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for KFServingDeleteMultipleWithJobResponse not available: {exc}"
- )
MODELS_AVAILABLE = False
-kf_serving_delete_multiple_with_job_response_model_schema = json.loads(r"""{
+kf_serving_delete_multiple_with_job_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message", "name", "versions" ],
"type" : "object",
"properties" : {
@@ -53,7 +58,9 @@
},
"description" : "Model Deletions Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_delete_multiple_with_job_response_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/kf_serving_delete_query_v1_stub.py b/test/types/kf_serving_delete_query_v1_stub.py
index d2a83b3d..63570dfa 100644
--- a/test/types/kf_serving_delete_query_v1_stub.py
+++ b/test/types/kf_serving_delete_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_delete_query_v1 import (
@@ -24,10 +31,10 @@
KFServingDeleteQueryV1Adapter = TypeAdapter(KFServingDeleteQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingDeleteQueryV1 not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_delete_query_v1_model_schema = json.loads(r"""{
+kf_serving_delete_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -110,7 +117,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_delete_query_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_delete_query_v1_faker = JSF(
diff --git a/test/types/kf_serving_delete_query_v2_stub.py b/test/types/kf_serving_delete_query_v2_stub.py
index c5ce1bac..6016e8cf 100644
--- a/test/types/kf_serving_delete_query_v2_stub.py
+++ b/test/types/kf_serving_delete_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_delete_query_v2 import (
@@ -24,10 +31,10 @@
KFServingDeleteQueryV2Adapter = TypeAdapter(KFServingDeleteQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingDeleteQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_delete_query_v2_model_schema = json.loads(r"""{
+kf_serving_delete_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -50,7 +57,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_delete_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_delete_query_v2_faker = JSF(
diff --git a/test/types/kf_serving_delete_response_stub.py b/test/types/kf_serving_delete_response_stub.py
index 9d488248..923f483a 100644
--- a/test/types/kf_serving_delete_response_stub.py
+++ b/test/types/kf_serving_delete_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_delete_response import (
@@ -24,10 +31,10 @@
KFServingDeleteResponseAdapter = TypeAdapter(KFServingDeleteResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingDeleteResponse not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_delete_response_model_schema = json.loads(r"""{
+kf_serving_delete_response_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -41,7 +48,9 @@
},
"description" : "Model Deleted"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_delete_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_delete_response_faker = JSF(
diff --git a/test/types/kf_serving_delete_with_job_response_stub.py b/test/types/kf_serving_delete_with_job_response_stub.py
index 10747b82..717566ed 100644
--- a/test/types/kf_serving_delete_with_job_response_stub.py
+++ b/test/types/kf_serving_delete_with_job_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_delete_with_job_response import (
@@ -24,12 +31,10 @@
KFServingDeleteWithJobResponseAdapter = TypeAdapter(KFServingDeleteWithJobResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for KFServingDeleteWithJobResponse not available: {exc}"
- )
MODELS_AVAILABLE = False
-kf_serving_delete_with_job_response_model_schema = json.loads(r"""{
+kf_serving_delete_with_job_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message", "name", "version" ],
"type" : "object",
"properties" : {
@@ -49,7 +54,9 @@
},
"description" : "Model Delete Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_delete_with_job_response_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/kf_serving_latest_version_query_v2_stub.py b/test/types/kf_serving_latest_version_query_v2_stub.py
index 9ec5770a..c4a76008 100644
--- a/test/types/kf_serving_latest_version_query_v2_stub.py
+++ b/test/types/kf_serving_latest_version_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_latest_version_query_v2 import (
@@ -24,12 +31,10 @@
KFServingLatestVersionQueryV2Adapter = TypeAdapter(KFServingLatestVersionQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for KFServingLatestVersionQueryV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-kf_serving_latest_version_query_v2_model_schema = json.loads(r"""{
+kf_serving_latest_version_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -44,7 +49,9 @@
"additionalProperties" : false,
"description" : "Named Model latest version query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_latest_version_query_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/kf_serving_latest_versions_query_v1_stub.py b/test/types/kf_serving_latest_versions_query_v1_stub.py
index 0d781494..4cf2c79b 100644
--- a/test/types/kf_serving_latest_versions_query_v1_stub.py
+++ b/test/types/kf_serving_latest_versions_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_latest_versions_query_v1 import (
@@ -24,12 +31,10 @@
KFServingLatestVersionsQueryV1Adapter = TypeAdapter(KFServingLatestVersionsQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for KFServingLatestVersionsQueryV1 not available: {exc}"
- )
MODELS_AVAILABLE = False
-kf_serving_latest_versions_query_v1_model_schema = json.loads(r"""{
+kf_serving_latest_versions_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -108,7 +113,9 @@
"additionalProperties" : false,
"description" : "Model listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_latest_versions_query_v1_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/kf_serving_latest_versions_query_v2_stub.py b/test/types/kf_serving_latest_versions_query_v2_stub.py
index 3e604de8..78805e16 100644
--- a/test/types/kf_serving_latest_versions_query_v2_stub.py
+++ b/test/types/kf_serving_latest_versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_latest_versions_query_v2 import (
@@ -24,12 +31,10 @@
KFServingLatestVersionsQueryV2Adapter = TypeAdapter(KFServingLatestVersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for KFServingLatestVersionsQueryV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-kf_serving_latest_versions_query_v2_model_schema = json.loads(r"""{
+kf_serving_latest_versions_query_v2_model_schema = json.loads(
+ r"""{
"description" : "Latest model versions listing query.",
"anyOf" : [ {
"$ref" : "#/components/schemas/LatestFunctionVersionsQuery"
@@ -37,7 +42,9 @@
"$ref" : "#/components/schemas/LatestFunctionsQuery"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_latest_versions_query_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/kf_serving_manifest_stub.py b/test/types/kf_serving_manifest_stub.py
index ab45b9a8..1cd8b7c9 100644
--- a/test/types/kf_serving_manifest_stub.py
+++ b/test/types/kf_serving_manifest_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_manifest import KFServingManifest
@@ -22,10 +29,10 @@
KFServingManifestAdapter = TypeAdapter(KFServingManifest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingManifest not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_manifest_model_schema = json.loads(r"""{
+kf_serving_manifest_model_schema = json.loads(
+ r"""{
"title" : "KFServingManifest",
"required" : [ "metadata", "name", "runtime", "version" ],
"type" : "object",
@@ -52,7 +59,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_manifest_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_manifest_faker = JSF(
diff --git a/test/types/kf_serving_models_response_stub.py b/test/types/kf_serving_models_response_stub.py
index c9056e87..33895b85 100644
--- a/test/types/kf_serving_models_response_stub.py
+++ b/test/types/kf_serving_models_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_models_response import (
@@ -24,10 +31,10 @@
KFServingModelsResponseAdapter = TypeAdapter(KFServingModelsResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingModelsResponse not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_models_response_model_schema = json.loads(r"""{
+kf_serving_models_response_model_schema = json.loads(
+ r"""{
"required" : [ "models" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_models_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_models_response_faker = JSF(
diff --git a/test/types/kf_serving_response_stub.py b/test/types/kf_serving_response_stub.py
index 5b2e8b6c..247564c1 100644
--- a/test/types/kf_serving_response_stub.py
+++ b/test/types/kf_serving_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_response import KFServingResponse
@@ -22,10 +29,10 @@
KFServingResponseAdapter = TypeAdapter(KFServingResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingResponse not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_response_model_schema = json.loads(r"""{
+kf_serving_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "metadata", "name", "runtime", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -82,7 +89,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_response_faker = JSF(
diff --git a/test/types/kf_serving_versions_query_v1_stub.py b/test/types/kf_serving_versions_query_v1_stub.py
index c229828d..3cafecd1 100644
--- a/test/types/kf_serving_versions_query_v1_stub.py
+++ b/test/types/kf_serving_versions_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kf_serving_versions_query_v1 import (
@@ -24,10 +31,10 @@
KFServingVersionsQueryV1Adapter = TypeAdapter(KFServingVersionsQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KFServingVersionsQueryV1 not available: {exc}")
MODELS_AVAILABLE = False
-kf_serving_versions_query_v1_model_schema = json.loads(r"""{
+kf_serving_versions_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -98,7 +105,9 @@
"additionalProperties" : false,
"description" : "Named model versions query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kf_serving_versions_query_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
kf_serving_versions_query_v1_faker = JSF(
diff --git a/test/types/kfserving_response_v2_stub.py b/test/types/kfserving_response_v2_stub.py
index ce481a58..12b04e43 100644
--- a/test/types/kfserving_response_v2_stub.py
+++ b/test/types/kfserving_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.kfserving_response_v2 import (
@@ -24,10 +31,10 @@
KfservingResponseV2Adapter = TypeAdapter(KfservingResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for KfservingResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-kfserving_response_v2_model_schema = json.loads(r"""{
+kfserving_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "model", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
"properties" : {
@@ -78,7 +85,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
kfserving_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
kfserving_response_v2_faker = JSF(
diff --git a/test/types/language_release_stub.py b/test/types/language_release_stub.py
index f663538e..70fb15f9 100644
--- a/test/types/language_release_stub.py
+++ b/test/types/language_release_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.language_release import LanguageRelease
@@ -22,10 +29,10 @@
LanguageReleaseAdapter = TypeAdapter(LanguageRelease)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LanguageRelease not available: {exc}")
MODELS_AVAILABLE = False
-language_release_model_schema = json.loads(r"""{
+language_release_model_schema = json.loads(
+ r"""{
"title" : "LanguageRelease",
"required" : [ "name", "title", "version" ],
"type" : "object",
@@ -52,7 +59,9 @@
},
"description" : "Description of the language or framework release used by a runtime (version)."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
language_release_model_schema.update({"definitions": MODEL_DEFINITIONS})
language_release_faker = JSF(language_release_model_schema, allow_none_optionals=1)
diff --git a/test/types/latest_function_versions_query_stub.py b/test/types/latest_function_versions_query_stub.py
index e2449d05..3e92f04c 100644
--- a/test/types/latest_function_versions_query_stub.py
+++ b/test/types/latest_function_versions_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_function_versions_query import (
@@ -24,10 +31,10 @@
LatestFunctionVersionsQueryAdapter = TypeAdapter(LatestFunctionVersionsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestFunctionVersionsQuery not available: {exc}")
MODELS_AVAILABLE = False
-latest_function_versions_query_model_schema = json.loads(r"""{
+latest_function_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -125,7 +132,9 @@
"additionalProperties" : false,
"description" : "Latest function versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_function_versions_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_function_versions_query_faker = JSF(
diff --git a/test/types/latest_functions_query_stub.py b/test/types/latest_functions_query_stub.py
index f50b4fc1..79713c21 100644
--- a/test/types/latest_functions_query_stub.py
+++ b/test/types/latest_functions_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_functions_query import (
@@ -24,10 +31,10 @@
LatestFunctionsQueryAdapter = TypeAdapter(LatestFunctionsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestFunctionsQuery not available: {exc}")
MODELS_AVAILABLE = False
-latest_functions_query_model_schema = json.loads(r"""{
+latest_functions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -70,7 +77,9 @@
"additionalProperties" : false,
"description" : "Request to list latest function versions per named function. A request that only uses these query parameters will include links to the _latest_ draft/published versions."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_functions_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_functions_query_faker = JSF(
diff --git a/test/types/latest_models_response_v2_entities_inner_stub.py b/test/types/latest_models_response_v2_entities_inner_stub.py
index a837a1cb..df338628 100644
--- a/test/types/latest_models_response_v2_entities_inner_stub.py
+++ b/test/types/latest_models_response_v2_entities_inner_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_models_response_v2_entities_inner import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LatestModelsResponseV2EntitiesInner not available: {exc}"
- )
MODELS_AVAILABLE = False
-latest_models_response_v2_entities_inner_model_schema = json.loads(r"""{
+latest_models_response_v2_entities_inner_model_schema = json.loads(
+ r"""{
"title" : "LatestModelsResponseV2_entities_inner",
"required" : [ "_links", "createdAt", "createdBy", "deprecated", "draft", "model", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
@@ -93,7 +98,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_models_response_v2_entities_inner_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/latest_models_response_v2_stub.py b/test/types/latest_models_response_v2_stub.py
index 1c043265..22399821 100644
--- a/test/types/latest_models_response_v2_stub.py
+++ b/test/types/latest_models_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_models_response_v2 import (
@@ -24,10 +31,10 @@
LatestModelsResponseV2Adapter = TypeAdapter(LatestModelsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestModelsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-latest_models_response_v2_model_schema = json.loads(r"""{
+latest_models_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "Models Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_models_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_models_response_v2_faker = JSF(
diff --git a/test/types/latest_plug_query_stub.py b/test/types/latest_plug_query_stub.py
index 7cea2167..f021e5a5 100644
--- a/test/types/latest_plug_query_stub.py
+++ b/test/types/latest_plug_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plug_query import LatestPlugQuery
@@ -22,10 +29,10 @@
LatestPlugQueryAdapter = TypeAdapter(LatestPlugQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestPlugQuery not available: {exc}")
MODELS_AVAILABLE = False
-latest_plug_query_model_schema = json.loads(r"""{
+latest_plug_query_model_schema = json.loads(
+ r"""{
"required" : [ "type" ],
"type" : "object",
"properties" : {
@@ -110,7 +117,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plug_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_plug_query_faker = JSF(latest_plug_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/latest_plug_version_query_v2_stub.py b/test/types/latest_plug_version_query_v2_stub.py
index bcc0a820..c0119722 100644
--- a/test/types/latest_plug_version_query_v2_stub.py
+++ b/test/types/latest_plug_version_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plug_version_query_v2 import (
@@ -24,10 +31,10 @@
LatestPlugVersionQueryV2Adapter = TypeAdapter(LatestPlugVersionQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestPlugVersionQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-latest_plug_version_query_v2_model_schema = json.loads(r"""{
+latest_plug_version_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -45,7 +52,9 @@
"additionalProperties" : false,
"description" : "Latest named plug version listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plug_version_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_plug_version_query_v2_faker = JSF(
diff --git a/test/types/latest_plug_versions_query_stub.py b/test/types/latest_plug_versions_query_stub.py
index fa31e9a3..64546b47 100644
--- a/test/types/latest_plug_versions_query_stub.py
+++ b/test/types/latest_plug_versions_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plug_versions_query import (
@@ -24,10 +31,10 @@
LatestPlugVersionsQueryAdapter = TypeAdapter(LatestPlugVersionsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestPlugVersionsQuery not available: {exc}")
MODELS_AVAILABLE = False
-latest_plug_versions_query_model_schema = json.loads(r"""{
+latest_plug_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"tags" : {
@@ -131,7 +138,9 @@
"additionalProperties" : false,
"description" : "Plug versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plug_versions_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_plug_versions_query_faker = JSF(
diff --git a/test/types/latest_plug_versions_query_v2_stub.py b/test/types/latest_plug_versions_query_v2_stub.py
index 20d63245..0865059c 100644
--- a/test/types/latest_plug_versions_query_v2_stub.py
+++ b/test/types/latest_plug_versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plug_versions_query_v2 import (
@@ -24,10 +31,10 @@
LatestPlugVersionsQueryV2Adapter = TypeAdapter(LatestPlugVersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestPlugVersionsQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-latest_plug_versions_query_v2_model_schema = json.loads(r"""{
+latest_plug_versions_query_v2_model_schema = json.loads(
+ r"""{
"description" : "Latest plug versions listing query.",
"anyOf" : [ {
"$ref" : "#/components/schemas/LatestPlugVersionsQuery"
@@ -35,7 +42,9 @@
"$ref" : "#/components/schemas/LatestPlugsQuery"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plug_versions_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_plug_versions_query_v2_faker = JSF(
diff --git a/test/types/latest_plugs_query_stub.py b/test/types/latest_plugs_query_stub.py
index 68664668..bf4910c5 100644
--- a/test/types/latest_plugs_query_stub.py
+++ b/test/types/latest_plugs_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plugs_query import LatestPlugsQuery
@@ -22,10 +29,10 @@
LatestPlugsQueryAdapter = TypeAdapter(LatestPlugsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestPlugsQuery not available: {exc}")
MODELS_AVAILABLE = False
-latest_plugs_query_model_schema = json.loads(r"""{
+latest_plugs_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -71,7 +78,9 @@
"additionalProperties" : false,
"description" : "Latest plug versions listing query with latest links. A request that only uses these query parameters will include links to the _latest_ draft/published versions of the plug."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plugs_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_plugs_query_faker = JSF(latest_plugs_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/latest_plugs_response_v2_entities_inner_stub.py b/test/types/latest_plugs_response_v2_entities_inner_stub.py
index cadeab91..34620e3c 100644
--- a/test/types/latest_plugs_response_v2_entities_inner_stub.py
+++ b/test/types/latest_plugs_response_v2_entities_inner_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plugs_response_v2_entities_inner import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LatestPlugsResponseV2EntitiesInner not available: {exc}"
- )
MODELS_AVAILABLE = False
-latest_plugs_response_v2_entities_inner_model_schema = json.loads(r"""{
+latest_plugs_response_v2_entities_inner_model_schema = json.loads(
+ r"""{
"title" : "LatestPlugsResponseV2_entities_inner",
"required" : [ "_links", "createdAt", "createdBy", "deprecated", "draft", "plug", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
@@ -93,7 +98,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plugs_response_v2_entities_inner_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/latest_plugs_response_v2_stub.py b/test/types/latest_plugs_response_v2_stub.py
index 59f8174d..1773ab82 100644
--- a/test/types/latest_plugs_response_v2_stub.py
+++ b/test/types/latest_plugs_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_plugs_response_v2 import (
@@ -24,10 +31,10 @@
LatestPlugsResponseV2Adapter = TypeAdapter(LatestPlugsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestPlugsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-latest_plugs_response_v2_model_schema = json.loads(r"""{
+latest_plugs_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "Plugs Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_plugs_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_plugs_response_v2_faker = JSF(
diff --git a/test/types/latest_version_level_stub.py b/test/types/latest_version_level_stub.py
index f2d4678b..315b0171 100644
--- a/test/types/latest_version_level_stub.py
+++ b/test/types/latest_version_level_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_version_level import LatestVersionLevel
@@ -22,16 +29,18 @@
LatestVersionLevelAdapter = TypeAdapter(LatestVersionLevel)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestVersionLevel not available: {exc}")
MODELS_AVAILABLE = False
-latest_version_level_model_schema = json.loads(r"""{
+latest_version_level_model_schema = json.loads(
+ r"""{
"title" : "LatestVersionLevel",
"type" : "string",
"description" : "Level of latest versions that should be included.",
"enum" : [ "major", "minor", "patch", "true", "false" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_version_level_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_version_level_faker = JSF(
diff --git a/test/types/latest_webscripts_response_v2_entities_inner_stub.py b/test/types/latest_webscripts_response_v2_entities_inner_stub.py
index 34307d66..ba2655f2 100644
--- a/test/types/latest_webscripts_response_v2_entities_inner_stub.py
+++ b/test/types/latest_webscripts_response_v2_entities_inner_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_webscripts_response_v2_entities_inner import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LatestWebscriptsResponseV2EntitiesInner not available: {exc}"
- )
MODELS_AVAILABLE = False
-latest_webscripts_response_v2_entities_inner_model_schema = json.loads(r"""{
+latest_webscripts_response_v2_entities_inner_model_schema = json.loads(
+ r"""{
"title" : "LatestWebscriptsResponseV2_entities_inner",
"required" : [ "_links", "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates", "webscript" ],
"type" : "object",
@@ -98,7 +103,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_webscripts_response_v2_entities_inner_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/latest_webscripts_response_v2_stub.py b/test/types/latest_webscripts_response_v2_stub.py
index 3919c176..93548ead 100644
--- a/test/types/latest_webscripts_response_v2_stub.py
+++ b/test/types/latest_webscripts_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.latest_webscripts_response_v2 import (
@@ -24,10 +31,10 @@
LatestWebscriptsResponseV2Adapter = TypeAdapter(LatestWebscriptsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LatestWebscriptsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-latest_webscripts_response_v2_model_schema = json.loads(r"""{
+latest_webscripts_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "Webscripts Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
latest_webscripts_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
latest_webscripts_response_v2_faker = JSF(
diff --git a/test/types/legacy_configuration_object_format_stub.py b/test/types/legacy_configuration_object_format_stub.py
index 5814d0b8..550403ae 100644
--- a/test/types/legacy_configuration_object_format_stub.py
+++ b/test/types/legacy_configuration_object_format_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_configuration_object_format import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyConfigurationObjectFormat not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_configuration_object_format_model_schema = json.loads(r"""{
+legacy_configuration_object_format_model_schema = json.loads(
+ r"""{
"title" : "LegacyConfigurationObject_format",
"type" : "object",
"properties" : {
@@ -47,7 +52,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_configuration_object_format_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/legacy_configuration_object_stub.py b/test/types/legacy_configuration_object_stub.py
index a3441c1d..227aff39 100644
--- a/test/types/legacy_configuration_object_stub.py
+++ b/test/types/legacy_configuration_object_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_configuration_object import (
@@ -24,10 +31,10 @@
LegacyConfigurationObjectAdapter = TypeAdapter(LegacyConfigurationObject)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyConfigurationObject not available: {exc}")
MODELS_AVAILABLE = False
-legacy_configuration_object_model_schema = json.loads(r"""{
+legacy_configuration_object_model_schema = json.loads(
+ r"""{
"title" : "LegacyConfigurationObject",
"required" : [ "name", "type" ],
"type" : "object",
@@ -51,7 +58,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_configuration_object_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_configuration_object_faker = JSF(
diff --git a/test/types/legacy_configuration_response_object_stub.py b/test/types/legacy_configuration_response_object_stub.py
index 0807f0b6..c246a2ba 100644
--- a/test/types/legacy_configuration_response_object_stub.py
+++ b/test/types/legacy_configuration_response_object_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_configuration_response_object import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyConfigurationResponseObject not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_configuration_response_object_model_schema = json.loads(r"""{
+legacy_configuration_response_object_model_schema = json.loads(
+ r"""{
"title" : "LegacyConfigurationResponseObject",
"required" : [ "name", "type" ],
"type" : "object",
@@ -59,7 +64,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_configuration_response_object_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/legacy_create_debug_response_stub.py b/test/types/legacy_create_debug_response_stub.py
index 1b42ca2f..1483b2e0 100644
--- a/test/types/legacy_create_debug_response_stub.py
+++ b/test/types/legacy_create_debug_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_create_debug_response import (
@@ -24,10 +31,10 @@
LegacyCreateDebugResponseAdapter = TypeAdapter(LegacyCreateDebugResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyCreateDebugResponse not available: {exc}")
MODELS_AVAILABLE = False
-legacy_create_debug_response_model_schema = json.loads(r"""{
+legacy_create_debug_response_model_schema = json.loads(
+ r"""{
"required" : [ "functionName" ],
"type" : "object",
"properties" : {
@@ -36,7 +43,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_create_debug_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_create_debug_response_faker = JSF(
diff --git a/test/types/legacy_debug_plug_manifest_stub.py b/test/types/legacy_debug_plug_manifest_stub.py
index 3cb4d9a7..a6ac5cd9 100644
--- a/test/types/legacy_debug_plug_manifest_stub.py
+++ b/test/types/legacy_debug_plug_manifest_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_debug_plug_manifest import (
@@ -24,10 +31,10 @@
LegacyDebugPlugManifestAdapter = TypeAdapter(LegacyDebugPlugManifest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyDebugPlugManifest not available: {exc}")
MODELS_AVAILABLE = False
-legacy_debug_plug_manifest_model_schema = json.loads(r"""{
+legacy_debug_plug_manifest_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "runtime", "script", "tenant", "version" ],
"type" : "object",
"properties" : {
@@ -62,7 +69,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_debug_plug_manifest_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_debug_plug_manifest_faker = JSF(
diff --git a/test/types/legacy_debug_plug_request_stub.py b/test/types/legacy_debug_plug_request_stub.py
index 8e1f71aa..9a77370a 100644
--- a/test/types/legacy_debug_plug_request_stub.py
+++ b/test/types/legacy_debug_plug_request_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_debug_plug_request import (
@@ -24,10 +31,10 @@
LegacyDebugPlugRequestAdapter = TypeAdapter(LegacyDebugPlugRequest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyDebugPlugRequest not available: {exc}")
MODELS_AVAILABLE = False
-legacy_debug_plug_request_model_schema = json.loads(r"""{
+legacy_debug_plug_request_model_schema = json.loads(
+ r"""{
"required" : [ "script" ],
"type" : "object",
"properties" : {
@@ -46,7 +53,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_debug_plug_request_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_debug_plug_request_faker = JSF(
diff --git a/test/types/legacy_documentation_request_stub.py b/test/types/legacy_documentation_request_stub.py
index 0938d797..022a81f9 100644
--- a/test/types/legacy_documentation_request_stub.py
+++ b/test/types/legacy_documentation_request_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_documentation_request import (
@@ -24,10 +31,10 @@
LegacyDocumentationRequestAdapter = TypeAdapter(LegacyDocumentationRequest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyDocumentationRequest not available: {exc}")
MODELS_AVAILABLE = False
-legacy_documentation_request_model_schema = json.loads(r"""{
+legacy_documentation_request_model_schema = json.loads(
+ r"""{
"required" : [ "configuration", "rawData", "supportedStates" ],
"type" : "object",
"properties" : {
@@ -55,7 +62,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_documentation_request_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_documentation_request_faker = JSF(
diff --git a/test/types/legacy_documentation_stub.py b/test/types/legacy_documentation_stub.py
index f510ffe8..73aa4da7 100644
--- a/test/types/legacy_documentation_stub.py
+++ b/test/types/legacy_documentation_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_documentation import LegacyDocumentation
@@ -22,10 +29,10 @@
LegacyDocumentationAdapter = TypeAdapter(LegacyDocumentation)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyDocumentation not available: {exc}")
MODELS_AVAILABLE = False
-legacy_documentation_model_schema = json.loads(r"""{
+legacy_documentation_model_schema = json.loads(
+ r"""{
"required" : [ "configuration", "rawData", "supportedStates" ],
"type" : "object",
"properties" : {
@@ -49,7 +56,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_documentation_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_documentation_faker = JSF(
diff --git a/test/types/legacy_function_meta_stub.py b/test/types/legacy_function_meta_stub.py
index 34e9e20b..71bd86e9 100644
--- a/test/types/legacy_function_meta_stub.py
+++ b/test/types/legacy_function_meta_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_function_meta import LegacyFunctionMeta
@@ -22,10 +29,10 @@
LegacyFunctionMetaAdapter = TypeAdapter(LegacyFunctionMeta)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyFunctionMeta not available: {exc}")
MODELS_AVAILABLE = False
-legacy_function_meta_model_schema = json.loads(r"""{
+legacy_function_meta_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -51,7 +58,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_function_meta_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_function_meta_faker = JSF(
diff --git a/test/types/legacy_plug_create_query_stub.py b/test/types/legacy_plug_create_query_stub.py
index 422a9c83..1424a754 100644
--- a/test/types/legacy_plug_create_query_stub.py
+++ b/test/types/legacy_plug_create_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_create_query import (
@@ -24,10 +31,10 @@
LegacyPlugCreateQueryAdapter = TypeAdapter(LegacyPlugCreateQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugCreateQuery not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_create_query_model_schema = json.loads(r"""{
+legacy_plug_create_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"async" : {
@@ -46,7 +53,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_create_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_create_query_faker = JSF(
diff --git a/test/types/legacy_plug_create_request_stub.py b/test/types/legacy_plug_create_request_stub.py
index eadd3d83..c4be0a28 100644
--- a/test/types/legacy_plug_create_request_stub.py
+++ b/test/types/legacy_plug_create_request_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_create_request import (
@@ -24,10 +31,10 @@
LegacyPlugCreateRequestAdapter = TypeAdapter(LegacyPlugCreateRequest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugCreateRequest not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_create_request_model_schema = json.loads(r"""{
+legacy_plug_create_request_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "script", "version" ],
"type" : "object",
"properties" : {
@@ -52,7 +59,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_create_request_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_create_request_faker = JSF(
diff --git a/test/types/legacy_plug_create_response_stub.py b/test/types/legacy_plug_create_response_stub.py
index e164cd2d..639470f6 100644
--- a/test/types/legacy_plug_create_response_stub.py
+++ b/test/types/legacy_plug_create_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_create_response import (
@@ -24,10 +31,10 @@
LegacyPlugCreateResponseAdapter = TypeAdapter(LegacyPlugCreateResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugCreateResponse not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_create_response_model_schema = json.loads(r"""{
+legacy_plug_create_response_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "statusCode", "uri" ],
"type" : "object",
"properties" : {
@@ -42,7 +49,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_create_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_create_response_faker = JSF(
diff --git a/test/types/legacy_plug_meta_request_stub.py b/test/types/legacy_plug_meta_request_stub.py
index 771a1b37..357c728b 100644
--- a/test/types/legacy_plug_meta_request_stub.py
+++ b/test/types/legacy_plug_meta_request_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_meta_request import (
@@ -24,10 +31,10 @@
LegacyPlugMetaRequestAdapter = TypeAdapter(LegacyPlugMetaRequest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugMetaRequest not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_meta_request_model_schema = json.loads(r"""{
+legacy_plug_meta_request_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -60,7 +67,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_meta_request_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_meta_request_faker = JSF(
diff --git a/test/types/legacy_plug_query_stub.py b/test/types/legacy_plug_query_stub.py
index 99f9598e..ddfd4383 100644
--- a/test/types/legacy_plug_query_stub.py
+++ b/test/types/legacy_plug_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_query import LegacyPlugQuery
@@ -22,10 +29,10 @@
LegacyPlugQueryAdapter = TypeAdapter(LegacyPlugQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugQuery not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_query_model_schema = json.loads(r"""{
+legacy_plug_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -106,7 +113,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_query_faker = JSF(legacy_plug_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/legacy_plug_request_metadata_documentation_any_of_stub.py b/test/types/legacy_plug_request_metadata_documentation_any_of_stub.py
index 03e3ad77..1192bd3f 100644
--- a/test/types/legacy_plug_request_metadata_documentation_any_of_stub.py
+++ b/test/types/legacy_plug_request_metadata_documentation_any_of_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_request_metadata_documentation_any_of import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyPlugRequestMetadataDocumentationAnyOf not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_plug_request_metadata_documentation_any_of_model_schema = json.loads(r"""{
+legacy_plug_request_metadata_documentation_any_of_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"supportedStates" : {
@@ -55,7 +60,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_request_metadata_documentation_any_of_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/legacy_plug_request_metadata_documentation_stub.py b/test/types/legacy_plug_request_metadata_documentation_stub.py
index c0718746..a711dedb 100644
--- a/test/types/legacy_plug_request_metadata_documentation_stub.py
+++ b/test/types/legacy_plug_request_metadata_documentation_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_request_metadata_documentation import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyPlugRequestMetadataDocumentation not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_plug_request_metadata_documentation_model_schema = json.loads(r"""{
+legacy_plug_request_metadata_documentation_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugRequest_metadata_documentation",
"anyOf" : [ {
"$ref" : "#/components/schemas/LegacyPlugRequest_metadata_documentation_anyOf"
@@ -39,7 +44,9 @@
"$ref" : "#/components/schemas/Documentation"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_request_metadata_documentation_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/legacy_plug_request_metadata_raw_data_inner_stub.py b/test/types/legacy_plug_request_metadata_raw_data_inner_stub.py
index ffb28a1b..2ff6bd62 100644
--- a/test/types/legacy_plug_request_metadata_raw_data_inner_stub.py
+++ b/test/types/legacy_plug_request_metadata_raw_data_inner_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_request_metadata_raw_data_inner import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyPlugRequestMetadataRawDataInner not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_plug_request_metadata_raw_data_inner_model_schema = json.loads(r"""{
+legacy_plug_request_metadata_raw_data_inner_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugRequest_metadata_rawData_inner",
"required" : [ "parameter" ],
"type" : "object",
@@ -46,7 +51,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_request_metadata_raw_data_inner_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/legacy_plug_request_metadata_stub.py b/test/types/legacy_plug_request_metadata_stub.py
index 2ec14ed5..d66f2e5a 100644
--- a/test/types/legacy_plug_request_metadata_stub.py
+++ b/test/types/legacy_plug_request_metadata_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_request_metadata import (
@@ -24,10 +31,10 @@
LegacyPlugRequestMetadataAdapter = TypeAdapter(LegacyPlugRequestMetadata)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugRequestMetadata not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_request_metadata_model_schema = json.loads(r"""{
+legacy_plug_request_metadata_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugRequest_metadata",
"type" : "object",
"properties" : {
@@ -88,7 +95,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_request_metadata_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_request_metadata_faker = JSF(
diff --git a/test/types/legacy_plug_request_stub.py b/test/types/legacy_plug_request_stub.py
index cf0a7ad8..40fef334 100644
--- a/test/types/legacy_plug_request_stub.py
+++ b/test/types/legacy_plug_request_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_request import LegacyPlugRequest
@@ -22,10 +29,10 @@
LegacyPlugRequestAdapter = TypeAdapter(LegacyPlugRequest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugRequest not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_request_model_schema = json.loads(r"""{
+legacy_plug_request_model_schema = json.loads(
+ r"""{
"required" : [ "metadata", "name", "script", "type", "version" ],
"type" : "object",
"properties" : {
@@ -50,7 +57,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_request_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_request_faker = JSF(
diff --git a/test/types/legacy_plug_response_metadata_stub.py b/test/types/legacy_plug_response_metadata_stub.py
index 0a4b0677..bbf0b488 100644
--- a/test/types/legacy_plug_response_metadata_stub.py
+++ b/test/types/legacy_plug_response_metadata_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_response_metadata import (
@@ -24,10 +31,10 @@
LegacyPlugResponseMetadataAdapter = TypeAdapter(LegacyPlugResponseMetadata)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugResponseMetadata not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_response_metadata_model_schema = json.loads(r"""{
+legacy_plug_response_metadata_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugResponse_metadata",
"type" : "object",
"properties" : {
@@ -63,7 +70,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_response_metadata_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_response_metadata_faker = JSF(
diff --git a/test/types/legacy_plug_response_stub.py b/test/types/legacy_plug_response_stub.py
index fecb9f25..f41a2ed2 100644
--- a/test/types/legacy_plug_response_stub.py
+++ b/test/types/legacy_plug_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_response import LegacyPlugResponse
@@ -22,10 +29,10 @@
LegacyPlugResponseAdapter = TypeAdapter(LegacyPlugResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugResponse not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_response_model_schema = json.loads(r"""{
+legacy_plug_response_model_schema = json.loads(
+ r"""{
"required" : [ "commands", "isDeprecated", "mediaType", "metadata", "name", "status", "version" ],
"type" : "object",
"properties" : {
@@ -91,7 +98,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_response_faker = JSF(
diff --git a/test/types/legacy_plug_script_meta_raw_data_inner_stub.py b/test/types/legacy_plug_script_meta_raw_data_inner_stub.py
index c1f85e3a..55bff77e 100644
--- a/test/types/legacy_plug_script_meta_raw_data_inner_stub.py
+++ b/test/types/legacy_plug_script_meta_raw_data_inner_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_script_meta_raw_data_inner import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyPlugScriptMetaRawDataInner not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_plug_script_meta_raw_data_inner_model_schema = json.loads(r"""{
+legacy_plug_script_meta_raw_data_inner_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugScriptMeta_rawData_inner",
"required" : [ "parameter" ],
"type" : "object",
@@ -46,7 +51,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_script_meta_raw_data_inner_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/legacy_plug_script_meta_stub.py b/test/types/legacy_plug_script_meta_stub.py
index c877428f..04738640 100644
--- a/test/types/legacy_plug_script_meta_stub.py
+++ b/test/types/legacy_plug_script_meta_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_script_meta import (
@@ -24,10 +31,10 @@
LegacyPlugScriptMetaAdapter = TypeAdapter(LegacyPlugScriptMeta)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugScriptMeta not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_script_meta_model_schema = json.loads(r"""{
+legacy_plug_script_meta_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugScriptMeta",
"required" : [ "rawData", "supportedStates" ],
"type" : "object",
@@ -78,7 +85,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_script_meta_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_script_meta_faker = JSF(
diff --git a/test/types/legacy_plug_script_response_stub.py b/test/types/legacy_plug_script_response_stub.py
index ea99d6e7..b14f6374 100644
--- a/test/types/legacy_plug_script_response_stub.py
+++ b/test/types/legacy_plug_script_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_plug_script_response import (
@@ -24,10 +31,10 @@
LegacyPlugScriptResponseAdapter = TypeAdapter(LegacyPlugScriptResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyPlugScriptResponse not available: {exc}")
MODELS_AVAILABLE = False
-legacy_plug_script_response_model_schema = json.loads(r"""{
+legacy_plug_script_response_model_schema = json.loads(
+ r"""{
"title" : "LegacyPlugScriptResponse",
"required" : [ "dependencies", "metadata", "name", "script", "type", "version" ],
"type" : "object",
@@ -55,7 +62,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_plug_script_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_plug_script_response_faker = JSF(
diff --git a/test/types/legacy_required_properties_inner_stub.py b/test/types/legacy_required_properties_inner_stub.py
index adca0cba..16247b13 100644
--- a/test/types/legacy_required_properties_inner_stub.py
+++ b/test/types/legacy_required_properties_inner_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_required_properties_inner import (
@@ -24,12 +31,10 @@
LegacyRequiredPropertiesInnerAdapter = TypeAdapter(LegacyRequiredPropertiesInner)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for LegacyRequiredPropertiesInner not available: {exc}"
- )
MODELS_AVAILABLE = False
-legacy_required_properties_inner_model_schema = json.loads(r"""{
+legacy_required_properties_inner_model_schema = json.loads(
+ r"""{
"title" : "LegacyRequiredProperties_inner",
"anyOf" : [ {
"type" : "string"
@@ -37,7 +42,9 @@
"$ref" : "#/components/schemas/LegacyRequiredPropertyObject"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_required_properties_inner_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_required_properties_inner_faker = JSF(
diff --git a/test/types/legacy_required_property_object_stub.py b/test/types/legacy_required_property_object_stub.py
index e03e8397..4f001cdf 100644
--- a/test/types/legacy_required_property_object_stub.py
+++ b/test/types/legacy_required_property_object_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.legacy_required_property_object import (
@@ -24,10 +31,10 @@
LegacyRequiredPropertyObjectAdapter = TypeAdapter(LegacyRequiredPropertyObject)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LegacyRequiredPropertyObject not available: {exc}")
MODELS_AVAILABLE = False
-legacy_required_property_object_model_schema = json.loads(r"""{
+legacy_required_property_object_model_schema = json.loads(
+ r"""{
"required" : [ "mandatory", "name", "sensitive", "type" ],
"type" : "object",
"properties" : {
@@ -45,7 +52,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
legacy_required_property_object_model_schema.update({"definitions": MODEL_DEFINITIONS})
legacy_required_property_object_faker = JSF(
diff --git a/test/types/limit_query_stub.py b/test/types/limit_query_stub.py
index 65d39b9d..fe7a9c69 100644
--- a/test/types/limit_query_stub.py
+++ b/test/types/limit_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.limit_query import LimitQuery
@@ -22,10 +29,10 @@
LimitQueryAdapter = TypeAdapter(LimitQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for LimitQuery not available: {exc}")
MODELS_AVAILABLE = False
-limit_query_model_schema = json.loads(r"""{
+limit_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -36,7 +43,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
limit_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
limit_query_faker = JSF(limit_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/media_type_stub.py b/test/types/media_type_stub.py
index c5bdf757..711749ea 100644
--- a/test/types/media_type_stub.py
+++ b/test/types/media_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.media_type import MediaType
@@ -22,15 +29,17 @@
MediaTypeAdapter = TypeAdapter(MediaType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for MediaType not available: {exc}")
MODELS_AVAILABLE = False
-media_type_model_schema = json.loads(r"""{
+media_type_model_schema = json.loads(
+ r"""{
"title" : "MediaType",
"type" : "string",
"enum" : [ "application/javascript", "application/java-vm", "text/x-python", "text/x-golang" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
media_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
media_type_faker = JSF(media_type_model_schema, allow_none_optionals=1)
diff --git a/test/types/message_and_status_response_stub.py b/test/types/message_and_status_response_stub.py
index 74597b4b..07de02bc 100644
--- a/test/types/message_and_status_response_stub.py
+++ b/test/types/message_and_status_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.message_and_status_response import (
@@ -24,10 +31,10 @@
MessageAndStatusResponseAdapter = TypeAdapter(MessageAndStatusResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for MessageAndStatusResponse not available: {exc}")
MODELS_AVAILABLE = False
-message_and_status_response_model_schema = json.loads(r"""{
+message_and_status_response_model_schema = json.loads(
+ r"""{
"required" : [ "message", "statusCode" ],
"type" : "object",
"properties" : {
@@ -39,7 +46,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
message_and_status_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
message_and_status_response_faker = JSF(
diff --git a/test/types/message_response_stub.py b/test/types/message_response_stub.py
index fdc768b6..afb3e1cf 100644
--- a/test/types/message_response_stub.py
+++ b/test/types/message_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.message_response import MessageResponse
@@ -22,10 +29,10 @@
MessageResponseAdapter = TypeAdapter(MessageResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for MessageResponse not available: {exc}")
MODELS_AVAILABLE = False
-message_response_model_schema = json.loads(r"""{
+message_response_model_schema = json.loads(
+ r"""{
"required" : [ "message" ],
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
message_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
message_response_faker = JSF(message_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/model1_stub.py b/test/types/model1_stub.py
index 4d22520d..25b1b85e 100644
--- a/test/types/model1_stub.py
+++ b/test/types/model1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.model1 import Model1
@@ -22,10 +29,10 @@
Model1Adapter = TypeAdapter(Model1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Model1 not available: {exc}")
MODELS_AVAILABLE = False
-model_1_model_schema = json.loads(r"""{
+model_1_model_schema = json.loads(
+ r"""{
"title" : "Model",
"required" : [ "model" ],
"type" : "object",
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
model_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
model_1_faker = JSF(model_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/model2_stub.py b/test/types/model2_stub.py
index 343812de..0f948c4e 100644
--- a/test/types/model2_stub.py
+++ b/test/types/model2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.model2 import Model2
@@ -22,10 +29,10 @@
Model2Adapter = TypeAdapter(Model2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Model2 not available: {exc}")
MODELS_AVAILABLE = False
-model_2_model_schema = json.loads(r"""{
+model_2_model_schema = json.loads(
+ r"""{
"title" : "Model",
"required" : [ "model" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
model_2_model_schema.update({"definitions": MODEL_DEFINITIONS})
model_2_faker = JSF(model_2_model_schema, allow_none_optionals=1)
diff --git a/test/types/model_stub.py b/test/types/model_stub.py
index de8c086d..90a72adc 100644
--- a/test/types/model_stub.py
+++ b/test/types/model_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.model import Model
@@ -22,10 +29,10 @@
ModelAdapter = TypeAdapter(Model)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Model not available: {exc}")
MODELS_AVAILABLE = False
-model_model_schema = json.loads(r"""{
+model_model_schema = json.loads(
+ r"""{
"title" : "Model",
"required" : [ "model" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
model_model_schema.update({"definitions": MODEL_DEFINITIONS})
model_faker = JSF(model_model_schema, allow_none_optionals=1)
diff --git a/test/types/model_versions_response_v2_stub.py b/test/types/model_versions_response_v2_stub.py
index 942bbf61..8d561b4a 100644
--- a/test/types/model_versions_response_v2_stub.py
+++ b/test/types/model_versions_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.model_versions_response_v2 import (
@@ -24,10 +31,10 @@
ModelVersionsResponseV2Adapter = TypeAdapter(ModelVersionsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ModelVersionsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-model_versions_response_v2_model_schema = json.loads(r"""{
+model_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "Model Versions Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
model_versions_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
model_versions_response_v2_faker = JSF(
diff --git a/test/types/multipart_file_upload_stub.py b/test/types/multipart_file_upload_stub.py
index 3aaeed46..4ad8589b 100644
--- a/test/types/multipart_file_upload_stub.py
+++ b/test/types/multipart_file_upload_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.multipart_file_upload import (
@@ -24,10 +31,10 @@
MultipartFileUploadAdapter = TypeAdapter(MultipartFileUpload)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for MultipartFileUpload not available: {exc}")
MODELS_AVAILABLE = False
-multipart_file_upload__model_schema = json.loads(r"""{
+multipart_file_upload__model_schema = json.loads(
+ r"""{
"title" : "Multipart file upload.",
"type" : "object",
"properties" : {
@@ -42,7 +49,9 @@
"description" : "A multi-part upload containing one or more file assets.",
"nullable" : true
}
-""")
+""",
+ object_hook=with_example_provider,
+)
multipart_file_upload__model_schema.update({"definitions": MODEL_DEFINITIONS})
multipart_file_upload__faker = JSF(
diff --git a/test/types/name_and_version_stub.py b/test/types/name_and_version_stub.py
index fb15aae4..bd455ed7 100644
--- a/test/types/name_and_version_stub.py
+++ b/test/types/name_and_version_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.name_and_version import NameAndVersion
@@ -22,10 +29,10 @@
NameAndVersionAdapter = TypeAdapter(NameAndVersion)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for NameAndVersion not available: {exc}")
MODELS_AVAILABLE = False
-name_and_version_model_schema = json.loads(r"""{
+name_and_version_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
name_and_version_model_schema.update({"definitions": MODEL_DEFINITIONS})
name_and_version_faker = JSF(name_and_version_model_schema, allow_none_optionals=1)
diff --git a/test/types/name_stub.py b/test/types/name_stub.py
index 78e09f85..9fa6e33b 100644
--- a/test/types/name_stub.py
+++ b/test/types/name_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.name import Name
@@ -22,10 +29,10 @@
NameAdapter = TypeAdapter(Name)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Name not available: {exc}")
MODELS_AVAILABLE = False
-name_model_schema = json.loads(r"""{
+name_model_schema = json.loads(
+ r"""{
"required" : [ "name" ],
"type" : "object",
"properties" : {
@@ -35,7 +42,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
name_model_schema.update({"definitions": MODEL_DEFINITIONS})
name_faker = JSF(name_model_schema, allow_none_optionals=1)
diff --git a/test/types/named_function_versions_query_stub.py b/test/types/named_function_versions_query_stub.py
index 2020260d..ee50a23e 100644
--- a/test/types/named_function_versions_query_stub.py
+++ b/test/types/named_function_versions_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_function_versions_query import (
@@ -24,10 +31,10 @@
NamedFunctionVersionsQueryAdapter = TypeAdapter(NamedFunctionVersionsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for NamedFunctionVersionsQuery not available: {exc}")
MODELS_AVAILABLE = False
-named_function_versions_query_model_schema = json.loads(r"""{
+named_function_versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -102,7 +109,9 @@
"additionalProperties" : false,
"description" : "Named function versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_function_versions_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
named_function_versions_query_faker = JSF(
diff --git a/test/types/named_kf_serving_versions_query_v2_stub.py b/test/types/named_kf_serving_versions_query_v2_stub.py
index 28e41162..b177ba57 100644
--- a/test/types/named_kf_serving_versions_query_v2_stub.py
+++ b/test/types/named_kf_serving_versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_kf_serving_versions_query_v2 import (
@@ -24,12 +31,10 @@
NamedKFServingVersionsQueryV2Adapter = TypeAdapter(NamedKFServingVersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedKFServingVersionsQueryV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_kf_serving_versions_query_v2_model_schema = json.loads(r"""{
+named_kf_serving_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -104,7 +109,9 @@
"additionalProperties" : false,
"description" : "Named Model versions query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_kf_serving_versions_query_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/named_parameters_typeof_as_job_reference_job_status_stub.py b/test/types/named_parameters_typeof_as_job_reference_job_status_stub.py
index 13d2027c..a4bcf338 100644
--- a/test/types/named_parameters_typeof_as_job_reference_job_status_stub.py
+++ b/test/types/named_parameters_typeof_as_job_reference_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_parameters_typeof_as_job_reference_job_status import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedParametersTypeofAsJobReferenceJobStatus not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_parameters_typeof_as_job_reference__job_status_model_schema = json.loads(r"""{
+named_parameters_typeof_as_job_reference__job_status_model_schema = json.loads(
+ r"""{
"title" : "NamedParameters_typeof_asJobReference__jobStatus",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -81,7 +86,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_parameters_typeof_as_job_reference__job_status_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/named_parameters_typeof_as_job_reference_stub.py b/test/types/named_parameters_typeof_as_job_reference_stub.py
index a99d50a3..948bc223 100644
--- a/test/types/named_parameters_typeof_as_job_reference_stub.py
+++ b/test/types/named_parameters_typeof_as_job_reference_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_parameters_typeof_as_job_reference import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedParametersTypeofAsJobReference not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_parameters_typeof_as_job_reference__model_schema = json.loads(r"""{
+named_parameters_typeof_as_job_reference__model_schema = json.loads(
+ r"""{
"required" : [ "jobStatus" ],
"type" : "object",
"properties" : {
@@ -41,7 +46,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_parameters_typeof_as_job_reference__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/named_parameters_typeof_from_legacy_documentation_stub.py b/test/types/named_parameters_typeof_from_legacy_documentation_stub.py
index ab7e423d..6e6d56ed 100644
--- a/test/types/named_parameters_typeof_from_legacy_documentation_stub.py
+++ b/test/types/named_parameters_typeof_from_legacy_documentation_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_parameters_typeof_from_legacy_documentation import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedParametersTypeofFromLegacyDocumentation not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_parameters_typeof_from_legacy_documentation__model_schema = json.loads(r"""{
+named_parameters_typeof_from_legacy_documentation__model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"legacyDocumentation" : {
@@ -43,7 +48,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_parameters_typeof_from_legacy_documentation__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/named_parameters_typeof_from_legacy_stub.py b/test/types/named_parameters_typeof_from_legacy_stub.py
index 38b3f1c1..a36974f3 100644
--- a/test/types/named_parameters_typeof_from_legacy_stub.py
+++ b/test/types/named_parameters_typeof_from_legacy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_parameters_typeof_from_legacy import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedParametersTypeofFromLegacy not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_parameters_typeof_from_legacy__model_schema = json.loads(r"""{
+named_parameters_typeof_from_legacy__model_schema = json.loads(
+ r"""{
"required" : [ "metadata" ],
"type" : "object",
"properties" : {
@@ -44,7 +49,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_parameters_typeof_from_legacy__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/named_parameters_typeof_is_not_legacy_stub.py b/test/types/named_parameters_typeof_is_not_legacy_stub.py
index f0ae4ca8..bbba5a45 100644
--- a/test/types/named_parameters_typeof_is_not_legacy_stub.py
+++ b/test/types/named_parameters_typeof_is_not_legacy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_parameters_typeof_is_not_legacy import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedParametersTypeofIsNotLegacy not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_parameters_typeof_is_not_legacy__model_schema = json.loads(r"""{
+named_parameters_typeof_is_not_legacy__model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"documentation" : {
@@ -40,7 +45,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_parameters_typeof_is_not_legacy__model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/named_plug_versions_query_v2_stub.py b/test/types/named_plug_versions_query_v2_stub.py
index 845c3573..349f2af8 100644
--- a/test/types/named_plug_versions_query_v2_stub.py
+++ b/test/types/named_plug_versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_plug_versions_query_v2 import (
@@ -24,10 +31,10 @@
NamedPlugVersionsQueryV2Adapter = TypeAdapter(NamedPlugVersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for NamedPlugVersionsQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-named_plug_versions_query_v2_model_schema = json.loads(r"""{
+named_plug_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"tags" : {
@@ -105,7 +112,9 @@
"additionalProperties" : false,
"description" : "Named plug version listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_plug_versions_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
named_plug_versions_query_v2_faker = JSF(
diff --git a/test/types/named_versions_filter_stub.py b/test/types/named_versions_filter_stub.py
index fffbb3fe..36138d44 100644
--- a/test/types/named_versions_filter_stub.py
+++ b/test/types/named_versions_filter_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_versions_filter import (
@@ -24,10 +31,10 @@
NamedVersionsFilterAdapter = TypeAdapter(NamedVersionsFilter)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for NamedVersionsFilter not available: {exc}")
MODELS_AVAILABLE = False
-named_versions_filter_model_schema = json.loads(r"""{
+named_versions_filter_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"nameVersion" : {
@@ -40,7 +47,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_versions_filter_model_schema.update({"definitions": MODEL_DEFINITIONS})
named_versions_filter_faker = JSF(
diff --git a/test/types/named_webscript_versions_query_v2_stub.py b/test/types/named_webscript_versions_query_v2_stub.py
index b2f1a2aa..c0caf136 100644
--- a/test/types/named_webscript_versions_query_v2_stub.py
+++ b/test/types/named_webscript_versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.named_webscript_versions_query_v2 import (
@@ -24,12 +31,10 @@
NamedWebscriptVersionsQueryV2Adapter = TypeAdapter(NamedWebscriptVersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for NamedWebscriptVersionsQueryV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-named_webscript_versions_query_v2_model_schema = json.loads(r"""{
+named_webscript_versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -104,7 +109,9 @@
"additionalProperties" : false,
"description" : "Webscript named versions listing query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
named_webscript_versions_query_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/openfaas_deploy_args_stub.py b/test/types/openfaas_deploy_args_stub.py
index 9fe1b7b4..074eca47 100644
--- a/test/types/openfaas_deploy_args_stub.py
+++ b/test/types/openfaas_deploy_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.openfaas_deploy_args import OpenfaasDeployArgs
@@ -22,10 +29,10 @@
OpenfaasDeployArgsAdapter = TypeAdapter(OpenfaasDeployArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for OpenfaasDeployArgs not available: {exc}")
MODELS_AVAILABLE = False
-openfaas_deploy_args_model_schema = json.loads(r"""{
+openfaas_deploy_args_model_schema = json.loads(
+ r"""{
"required" : [ "endpoint", "imageName", "namespace" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
openfaas_deploy_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
openfaas_deploy_args_faker = JSF(
diff --git a/test/types/openfaas_function_ref_stub.py b/test/types/openfaas_function_ref_stub.py
index 5cbb25d5..fdbf33a5 100644
--- a/test/types/openfaas_function_ref_stub.py
+++ b/test/types/openfaas_function_ref_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.openfaas_function_ref import (
@@ -24,10 +31,10 @@
OpenfaasFunctionRefAdapter = TypeAdapter(OpenfaasFunctionRef)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for OpenfaasFunctionRef not available: {exc}")
MODELS_AVAILABLE = False
-openfaas_function_ref_model_schema = json.loads(r"""{
+openfaas_function_ref_model_schema = json.loads(
+ r"""{
"required" : [ "endpoint", "namespace" ],
"type" : "object",
"properties" : {
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
openfaas_function_ref_model_schema.update({"definitions": MODEL_DEFINITIONS})
openfaas_function_ref_faker = JSF(
diff --git a/test/types/operation_status_error_stub.py b/test/types/operation_status_error_stub.py
index 04fda0f9..27d350dd 100644
--- a/test/types/operation_status_error_stub.py
+++ b/test/types/operation_status_error_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.operation_status_error import (
@@ -24,10 +31,10 @@
OperationStatusErrorAdapter = TypeAdapter(OperationStatusError)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for OperationStatusError not available: {exc}")
MODELS_AVAILABLE = False
-operation_status_error_model_schema = json.loads(r"""{
+operation_status_error_model_schema = json.loads(
+ r"""{
"title" : "OperationStatus_error",
"required" : [ "code", "message", "name" ],
"type" : "object",
@@ -50,7 +57,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
operation_status_error_model_schema.update({"definitions": MODEL_DEFINITIONS})
operation_status_error_faker = JSF(
diff --git a/test/types/operation_status_stub.py b/test/types/operation_status_stub.py
index cf7d1287..91a992a3 100644
--- a/test/types/operation_status_stub.py
+++ b/test/types/operation_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.operation_status import OperationStatus
@@ -22,10 +29,10 @@
OperationStatusAdapter = TypeAdapter(OperationStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for OperationStatus not available: {exc}")
MODELS_AVAILABLE = False
-operation_status_model_schema = json.loads(r"""{
+operation_status_model_schema = json.loads(
+ r"""{
"required" : [ "description", "done", "id", "name", "type" ],
"type" : "object",
"properties" : {
@@ -50,7 +57,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
operation_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
operation_status_faker = JSF(operation_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/operation_stub.py b/test/types/operation_stub.py
index b3ee308d..eb5b8839 100644
--- a/test/types/operation_stub.py
+++ b/test/types/operation_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.operation import Operation
@@ -22,10 +29,10 @@
OperationAdapter = TypeAdapter(Operation)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Operation not available: {exc}")
MODELS_AVAILABLE = False
-operation_model_schema = json.loads(r"""{
+operation_model_schema = json.loads(
+ r"""{
"required" : [ "description", "id", "name", "type" ],
"type" : "object",
"properties" : {
@@ -44,7 +51,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
operation_model_schema.update({"definitions": MODEL_DEFINITIONS})
operation_faker = JSF(operation_model_schema, allow_none_optionals=1)
diff --git a/test/types/paging_query_stub.py b/test/types/paging_query_stub.py
index 466099d7..d073b394 100644
--- a/test/types/paging_query_stub.py
+++ b/test/types/paging_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.paging_query import PagingQuery
@@ -22,10 +29,10 @@
PagingQueryAdapter = TypeAdapter(PagingQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PagingQuery not available: {exc}")
MODELS_AVAILABLE = False
-paging_query_model_schema = json.loads(r"""{
+paging_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -41,7 +48,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
paging_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
paging_query_faker = JSF(paging_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/paging_response_stub.py b/test/types/paging_response_stub.py
index 4b8545a6..163b3f18 100644
--- a/test/types/paging_response_stub.py
+++ b/test/types/paging_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.paging_response import PagingResponse
@@ -22,10 +29,10 @@
PagingResponseAdapter = TypeAdapter(PagingResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PagingResponse not available: {exc}")
MODELS_AVAILABLE = False
-paging_response_model_schema = json.loads(r"""{
+paging_response_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"count" : {
@@ -42,7 +49,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
paging_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
paging_response_faker = JSF(paging_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/parent_keys_stub.py b/test/types/parent_keys_stub.py
index 87624730..78eb83db 100644
--- a/test/types/parent_keys_stub.py
+++ b/test/types/parent_keys_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.parent_keys import ParentKeys
@@ -22,10 +29,10 @@
ParentKeysAdapter = TypeAdapter(ParentKeys)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ParentKeys not available: {exc}")
MODELS_AVAILABLE = False
-parent_keys_model_schema = json.loads(r"""{
+parent_keys_model_schema = json.loads(
+ r"""{
"title" : "ParentKeys",
"required" : [ "id" ],
"type" : "object",
@@ -36,7 +43,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
parent_keys_model_schema.update({"definitions": MODEL_DEFINITIONS})
parent_keys_faker = JSF(parent_keys_model_schema, allow_none_optionals=1)
diff --git a/test/types/patch_interface_query_stub.py b/test/types/patch_interface_query_stub.py
index 06fcb981..3915d05b 100644
--- a/test/types/patch_interface_query_stub.py
+++ b/test/types/patch_interface_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.patch_interface_query import (
@@ -24,10 +31,10 @@
PatchInterfaceQueryAdapter = TypeAdapter(PatchInterfaceQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PatchInterfaceQuery not available: {exc}")
MODELS_AVAILABLE = False
-patch_interface_query_model_schema = json.loads(r"""{
+patch_interface_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -37,7 +44,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
patch_interface_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
patch_interface_query_faker = JSF(
diff --git a/test/types/patch_metadata_query_stub.py b/test/types/patch_metadata_query_stub.py
index 2908ef5b..b591cc02 100644
--- a/test/types/patch_metadata_query_stub.py
+++ b/test/types/patch_metadata_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.patch_metadata_query import PatchMetadataQuery
@@ -22,10 +29,10 @@
PatchMetadataQueryAdapter = TypeAdapter(PatchMetadataQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PatchMetadataQuery not available: {exc}")
MODELS_AVAILABLE = False
-patch_metadata_query_model_schema = json.loads(r"""{
+patch_metadata_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -35,7 +42,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
patch_metadata_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
patch_metadata_query_faker = JSF(
diff --git a/test/types/patch_plug_request_v1_stub.py b/test/types/patch_plug_request_v1_stub.py
index 0581b63f..26f792d6 100644
--- a/test/types/patch_plug_request_v1_stub.py
+++ b/test/types/patch_plug_request_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.patch_plug_request_v1 import PatchPlugRequestV1
@@ -22,10 +29,10 @@
PatchPlugRequestV1Adapter = TypeAdapter(PatchPlugRequestV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PatchPlugRequestV1 not available: {exc}")
MODELS_AVAILABLE = False
-patch_plug_request_v1_model_schema = json.loads(r"""{
+patch_plug_request_v1_model_schema = json.loads(
+ r"""{
"required" : [ "metadata" ],
"type" : "object",
"properties" : {
@@ -35,7 +42,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
patch_plug_request_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
patch_plug_request_v1_faker = JSF(
diff --git a/test/types/plug1_stub.py b/test/types/plug1_stub.py
index d2b9f8b8..d0222f7d 100644
--- a/test/types/plug1_stub.py
+++ b/test/types/plug1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug1 import Plug1
@@ -22,10 +29,10 @@
Plug1Adapter = TypeAdapter(Plug1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Plug1 not available: {exc}")
MODELS_AVAILABLE = False
-plug_1_model_schema = json.loads(r"""{
+plug_1_model_schema = json.loads(
+ r"""{
"title" : "Plug",
"required" : [ "plug" ],
"type" : "object",
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_1_faker = JSF(plug_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug2_stub.py b/test/types/plug2_stub.py
index e07176c8..b2c0ebb4 100644
--- a/test/types/plug2_stub.py
+++ b/test/types/plug2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug2 import Plug2
@@ -22,10 +29,10 @@
Plug2Adapter = TypeAdapter(Plug2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Plug2 not available: {exc}")
MODELS_AVAILABLE = False
-plug_2_model_schema = json.loads(r"""{
+plug_2_model_schema = json.loads(
+ r"""{
"title" : "Plug",
"required" : [ "plug" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_2_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_2_faker = JSF(plug_2_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_delete_force_query_stub.py b/test/types/plug_delete_force_query_stub.py
index c12a69fd..6fd3d5d4 100644
--- a/test/types/plug_delete_force_query_stub.py
+++ b/test/types/plug_delete_force_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_delete_force_query import (
@@ -24,10 +31,10 @@
PlugDeleteForceQueryAdapter = TypeAdapter(PlugDeleteForceQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugDeleteForceQuery not available: {exc}")
MODELS_AVAILABLE = False
-plug_delete_force_query_model_schema = json.loads(r"""{
+plug_delete_force_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"force" : {
@@ -37,7 +44,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_delete_force_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_delete_force_query_faker = JSF(
diff --git a/test/types/plug_delete_query_stub.py b/test/types/plug_delete_query_stub.py
index a18f64ba..ce091bb9 100644
--- a/test/types/plug_delete_query_stub.py
+++ b/test/types/plug_delete_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_delete_query import PlugDeleteQuery
@@ -22,10 +29,10 @@
PlugDeleteQueryAdapter = TypeAdapter(PlugDeleteQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugDeleteQuery not available: {exc}")
MODELS_AVAILABLE = False
-plug_delete_query_model_schema = json.loads(r"""{
+plug_delete_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"force" : {
@@ -39,7 +46,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_delete_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_delete_query_faker = JSF(plug_delete_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_interface_stub.py b/test/types/plug_interface_stub.py
index da1c1a1f..2919f739 100644
--- a/test/types/plug_interface_stub.py
+++ b/test/types/plug_interface_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_interface import PlugInterface
@@ -22,10 +29,10 @@
PlugInterfaceAdapter = TypeAdapter(PlugInterface)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugInterface not available: {exc}")
MODELS_AVAILABLE = False
-plug_interface_model_schema = json.loads(r"""{
+plug_interface_model_schema = json.loads(
+ r"""{
"title" : "PlugInterface",
"type" : "object",
"properties" : {
@@ -55,7 +62,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_interface_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_interface_faker = JSF(plug_interface_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_listing_and_query_response_stub.py b/test/types/plug_listing_and_query_response_stub.py
index c26f800a..c2068028 100644
--- a/test/types/plug_listing_and_query_response_stub.py
+++ b/test/types/plug_listing_and_query_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_listing_and_query_response import (
@@ -24,10 +31,10 @@
PlugListingAndQueryResponseAdapter = TypeAdapter(PlugListingAndQueryResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugListingAndQueryResponse not available: {exc}")
MODELS_AVAILABLE = False
-plug_listing_and_query_response_model_schema = json.loads(r"""{
+plug_listing_and_query_response_model_schema = json.loads(
+ r"""{
"required" : [ "plugs" ],
"type" : "object",
"properties" : {
@@ -52,7 +59,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_listing_and_query_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_listing_and_query_response_faker = JSF(
diff --git a/test/types/plug_listing_response_stub.py b/test/types/plug_listing_response_stub.py
index 43296673..ede707b2 100644
--- a/test/types/plug_listing_response_stub.py
+++ b/test/types/plug_listing_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_listing_response import (
@@ -24,10 +31,10 @@
PlugListingResponseAdapter = TypeAdapter(PlugListingResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugListingResponse not available: {exc}")
MODELS_AVAILABLE = False
-plug_listing_response_model_schema = json.loads(r"""{
+plug_listing_response_model_schema = json.loads(
+ r"""{
"required" : [ "plugs" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_listing_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_listing_response_faker = JSF(
diff --git a/test/types/plug_manifest_stub.py b/test/types/plug_manifest_stub.py
index c008252f..ded2aae1 100644
--- a/test/types/plug_manifest_stub.py
+++ b/test/types/plug_manifest_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_manifest import PlugManifest
@@ -22,10 +29,10 @@
PlugManifestAdapter = TypeAdapter(PlugManifest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugManifest not available: {exc}")
MODELS_AVAILABLE = False
-plug_manifest_model_schema = json.loads(r"""{
+plug_manifest_model_schema = json.loads(
+ r"""{
"title" : "PlugManifest",
"required" : [ "interface", "metadata", "name", "runtime", "type", "version" ],
"type" : "object",
@@ -58,7 +65,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_manifest_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_manifest_faker = JSF(plug_manifest_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_meta_stub.py b/test/types/plug_meta_stub.py
index e4e127cf..082d7be8 100644
--- a/test/types/plug_meta_stub.py
+++ b/test/types/plug_meta_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_meta import PlugMeta
@@ -22,10 +29,10 @@
PlugMetaAdapter = TypeAdapter(PlugMeta)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugMeta not available: {exc}")
MODELS_AVAILABLE = False
-plug_meta_model_schema = json.loads(r"""{
+plug_meta_model_schema = json.loads(
+ r"""{
"title" : "PlugMeta",
"type" : "object",
"properties" : {
@@ -80,7 +87,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_meta_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_meta_faker = JSF(plug_meta_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_property_data_type_stub.py b/test/types/plug_property_data_type_stub.py
index 807889bb..de7fee73 100644
--- a/test/types/plug_property_data_type_stub.py
+++ b/test/types/plug_property_data_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_property_data_type import (
@@ -24,16 +31,18 @@
PlugPropertyDataTypeAdapter = TypeAdapter(PlugPropertyDataType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugPropertyDataType not available: {exc}")
MODELS_AVAILABLE = False
-plug_property_data_type_model_schema = json.loads(r"""{
+plug_property_data_type_model_schema = json.loads(
+ r"""{
"title" : "PlugPropertyDataType",
"type" : "string",
"description" : "Datatype supported in plug input or output properties.",
"enum" : [ "string", "integer", "long", "float", "double", "boolean", "object" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_property_data_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_property_data_type_faker = JSF(
diff --git a/test/types/plug_property_format_stub.py b/test/types/plug_property_format_stub.py
index a8b43e1d..38a8491c 100644
--- a/test/types/plug_property_format_stub.py
+++ b/test/types/plug_property_format_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_property_format import PlugPropertyFormat
@@ -22,10 +29,10 @@
PlugPropertyFormatAdapter = TypeAdapter(PlugPropertyFormat)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugPropertyFormat not available: {exc}")
MODELS_AVAILABLE = False
-plug_property_format_model_schema = json.loads(r"""{
+plug_property_format_model_schema = json.loads(
+ r"""{
"title" : "PlugPropertyFormat",
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_property_format_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_property_format_faker = JSF(
diff --git a/test/types/plug_property_format_type_stub.py b/test/types/plug_property_format_type_stub.py
index 72f272bf..a47ed404 100644
--- a/test/types/plug_property_format_type_stub.py
+++ b/test/types/plug_property_format_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_property_format_type import (
@@ -24,16 +31,18 @@
PlugPropertyFormatTypeAdapter = TypeAdapter(PlugPropertyFormatType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugPropertyFormatType not available: {exc}")
MODELS_AVAILABLE = False
-plug_property_format_type_model_schema = json.loads(r"""{
+plug_property_format_type_model_schema = json.loads(
+ r"""{
"title" : "PlugPropertyFormatType",
"type" : "string",
"description" : "Value domain for a plug input or output property.",
"enum" : [ "enum", "resource", "vault", "duration", "code", "url", "date", "template" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_property_format_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_property_format_type_faker = JSF(
diff --git a/test/types/plug_property_stub.py b/test/types/plug_property_stub.py
index 7e59a7db..18d5e86a 100644
--- a/test/types/plug_property_stub.py
+++ b/test/types/plug_property_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_property import PlugProperty
@@ -22,10 +29,10 @@
PlugPropertyAdapter = TypeAdapter(PlugProperty)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugProperty not available: {exc}")
MODELS_AVAILABLE = False
-plug_property_model_schema = json.loads(r"""{
+plug_property_model_schema = json.loads(
+ r"""{
"title" : "PlugProperty",
"required" : [ "name" ],
"type" : "object",
@@ -53,7 +60,9 @@
},
"description" : "Interface specification of a plug property."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_property_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_property_faker = JSF(plug_property_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_response_stub.py b/test/types/plug_response_stub.py
index d3c3084f..1abd233d 100644
--- a/test/types/plug_response_stub.py
+++ b/test/types/plug_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_response import PlugResponse
@@ -22,10 +29,10 @@
PlugResponseAdapter = TypeAdapter(PlugResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugResponse not available: {exc}")
MODELS_AVAILABLE = False
-plug_response_model_schema = json.loads(r"""{
+plug_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "isDeprecated", "metadata", "name", "runtime", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -84,7 +91,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_response_faker = JSF(plug_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_response_v2_stub.py b/test/types/plug_response_v2_stub.py
index 3dd48994..5401792b 100644
--- a/test/types/plug_response_v2_stub.py
+++ b/test/types/plug_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_response_v2 import PlugResponseV2
@@ -22,10 +29,10 @@
PlugResponseV2Adapter = TypeAdapter(PlugResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-plug_response_v2_model_schema = json.loads(r"""{
+plug_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "plug", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
"properties" : {
@@ -76,7 +83,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_response_v2_faker = JSF(plug_response_v2_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_stub.py b/test/types/plug_stub.py
index 2d394261..40760fe5 100644
--- a/test/types/plug_stub.py
+++ b/test/types/plug_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug import Plug
@@ -22,10 +29,10 @@
PlugAdapter = TypeAdapter(Plug)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Plug not available: {exc}")
MODELS_AVAILABLE = False
-plug_model_schema = json.loads(r"""{
+plug_model_schema = json.loads(
+ r"""{
"title" : "Plug",
"required" : [ "plug" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_faker = JSF(plug_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_type_query_stub.py b/test/types/plug_type_query_stub.py
index 6c51d948..d3c9a59b 100644
--- a/test/types/plug_type_query_stub.py
+++ b/test/types/plug_type_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_type_query import PlugTypeQuery
@@ -22,10 +29,10 @@
PlugTypeQueryAdapter = TypeAdapter(PlugTypeQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugTypeQuery not available: {exc}")
MODELS_AVAILABLE = False
-plug_type_query_model_schema = json.loads(r"""{
+plug_type_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"type" : {
@@ -34,7 +41,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_type_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_type_query_faker = JSF(plug_type_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_type_stub.py b/test/types/plug_type_stub.py
index 25028554..2afa2b2e 100644
--- a/test/types/plug_type_stub.py
+++ b/test/types/plug_type_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_type import PlugType
@@ -22,15 +29,17 @@
PlugTypeAdapter = TypeAdapter(PlugType)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugType not available: {exc}")
MODELS_AVAILABLE = False
-plug_type_model_schema = json.loads(r"""{
+plug_type_model_schema = json.loads(
+ r"""{
"title" : "PlugType",
"type" : "string",
"enum" : [ "sensor", "actuator", "transformer" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_type_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_type_faker = JSF(plug_type_model_schema, allow_none_optionals=1)
diff --git a/test/types/plug_versions_response_v2_stub.py b/test/types/plug_versions_response_v2_stub.py
index faf0bce0..6e0513b1 100644
--- a/test/types/plug_versions_response_v2_stub.py
+++ b/test/types/plug_versions_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.plug_versions_response_v2 import (
@@ -24,10 +31,10 @@
PlugVersionsResponseV2Adapter = TypeAdapter(PlugVersionsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PlugVersionsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-plug_versions_response_v2_model_schema = json.loads(r"""{
+plug_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "Plugs Versions Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
plug_versions_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
plug_versions_response_v2_faker = JSF(
diff --git a/test/types/post_model_job_async_response_v2_stub.py b/test/types/post_model_job_async_response_v2_stub.py
index aca801e7..98c9d31d 100644
--- a/test/types/post_model_job_async_response_v2_stub.py
+++ b/test/types/post_model_job_async_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.post_model_job_async_response_v2 import (
@@ -24,10 +31,10 @@
PostModelJobAsyncResponseV2Adapter = TypeAdapter(PostModelJobAsyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PostModelJobAsyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-post_model_job_async_response_v2_model_schema = json.loads(r"""{
+post_model_job_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Model Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
post_model_job_async_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
post_model_job_async_response_v2_faker = JSF(
diff --git a/test/types/post_model_job_sync_response_v2_stub.py b/test/types/post_model_job_sync_response_v2_stub.py
index 408d0701..3f197d07 100644
--- a/test/types/post_model_job_sync_response_v2_stub.py
+++ b/test/types/post_model_job_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.post_model_job_sync_response_v2 import (
@@ -24,10 +31,10 @@
PostModelJobSyncResponseV2Adapter = TypeAdapter(PostModelJobSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PostModelJobSyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-post_model_job_sync_response_v2_model_schema = json.loads(r"""{
+post_model_job_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Model Deployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
post_model_job_sync_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
post_model_job_sync_response_v2_faker = JSF(
diff --git a/test/types/post_plug_job_async_response_v2_stub.py b/test/types/post_plug_job_async_response_v2_stub.py
index 44a5a030..7a2a5f79 100644
--- a/test/types/post_plug_job_async_response_v2_stub.py
+++ b/test/types/post_plug_job_async_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.post_plug_job_async_response_v2 import (
@@ -24,10 +31,10 @@
PostPlugJobAsyncResponseV2Adapter = TypeAdapter(PostPlugJobAsyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PostPlugJobAsyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-post_plug_job_async_response_v2_model_schema = json.loads(r"""{
+post_plug_job_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Plug Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
post_plug_job_async_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
post_plug_job_async_response_v2_faker = JSF(
diff --git a/test/types/post_plug_job_sync_response_v2_stub.py b/test/types/post_plug_job_sync_response_v2_stub.py
index 27514dfd..ee60b144 100644
--- a/test/types/post_plug_job_sync_response_v2_stub.py
+++ b/test/types/post_plug_job_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.post_plug_job_sync_response_v2 import (
@@ -24,10 +31,10 @@
PostPlugJobSyncResponseV2Adapter = TypeAdapter(PostPlugJobSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PostPlugJobSyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-post_plug_job_sync_response_v2_model_schema = json.loads(r"""{
+post_plug_job_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Plug Deployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
post_plug_job_sync_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
post_plug_job_sync_response_v2_faker = JSF(
diff --git a/test/types/post_webscript_job_async_response_v2_stub.py b/test/types/post_webscript_job_async_response_v2_stub.py
index 434490e5..d58418ac 100644
--- a/test/types/post_webscript_job_async_response_v2_stub.py
+++ b/test/types/post_webscript_job_async_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.post_webscript_job_async_response_v2 import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for PostWebscriptJobAsyncResponseV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-post_webscript_job_async_response_v2_model_schema = json.loads(r"""{
+post_webscript_job_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -47,7 +52,9 @@
},
"description" : "Webscript Deployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
post_webscript_job_async_response_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/post_webscript_job_sync_response_v2_stub.py b/test/types/post_webscript_job_sync_response_v2_stub.py
index 72034034..2a890dc0 100644
--- a/test/types/post_webscript_job_sync_response_v2_stub.py
+++ b/test/types/post_webscript_job_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.post_webscript_job_sync_response_v2 import (
@@ -24,12 +31,10 @@
PostWebscriptJobSyncResponseV2Adapter = TypeAdapter(PostWebscriptJobSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for PostWebscriptJobSyncResponseV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-post_webscript_job_sync_response_v2_model_schema = json.loads(r"""{
+post_webscript_job_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message" ],
"type" : "object",
"properties" : {
@@ -42,7 +47,9 @@
},
"description" : "Webscript Deployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
post_webscript_job_sync_response_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/provided_dependency_stub.py b/test/types/provided_dependency_stub.py
index c9f2187a..1a55b839 100644
--- a/test/types/provided_dependency_stub.py
+++ b/test/types/provided_dependency_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.provided_dependency import ProvidedDependency
@@ -22,10 +29,10 @@
ProvidedDependencyAdapter = TypeAdapter(ProvidedDependency)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ProvidedDependency not available: {exc}")
MODELS_AVAILABLE = False
-provided_dependency_model_schema = json.loads(r"""{
+provided_dependency_model_schema = json.loads(
+ r"""{
"title" : "ProvidedDependency",
"required" : [ "name" ],
"type" : "object",
@@ -78,7 +85,9 @@
},
"description" : "Library dependency that is provided by this runtime."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
provided_dependency_model_schema.update({"definitions": MODEL_DEFINITIONS})
provided_dependency_faker = JSF(
diff --git a/test/types/publish_function_query_stub.py b/test/types/publish_function_query_stub.py
index a101d3f7..6fa84c7f 100644
--- a/test/types/publish_function_query_stub.py
+++ b/test/types/publish_function_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.publish_function_query import (
@@ -24,10 +31,10 @@
PublishFunctionQueryAdapter = TypeAdapter(PublishFunctionQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for PublishFunctionQuery not available: {exc}")
MODELS_AVAILABLE = False
-publish_function_query_model_schema = json.loads(r"""{
+publish_function_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -45,7 +52,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
publish_function_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
publish_function_query_faker = JSF(
diff --git a/test/types/queue_events_stub.py b/test/types/queue_events_stub.py
index 1b2fe6c2..efe1ab61 100644
--- a/test/types/queue_events_stub.py
+++ b/test/types/queue_events_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.queue_events import QueueEvents
@@ -22,15 +29,17 @@
QueueEventsAdapter = TypeAdapter(QueueEvents)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for QueueEvents not available: {exc}")
MODELS_AVAILABLE = False
-queue_events_model_schema = json.loads(r"""{
+queue_events_model_schema = json.loads(
+ r"""{
"title" : "QueueEvents",
"type" : "string",
"enum" : [ "completed", "failed", "active", "delayed", "waiting", "waiting-children", "added", "cleaned", "drained", "error", "paused", "progress", "removed", "resumed", "retries-exhausted", "stalled" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
queue_events_model_schema.update({"definitions": MODEL_DEFINITIONS})
queue_events_faker = JSF(queue_events_model_schema, allow_none_optionals=1)
diff --git a/test/types/rebuild_computed_response_stub.py b/test/types/rebuild_computed_response_stub.py
index 82a42441..6e8cfef5 100644
--- a/test/types/rebuild_computed_response_stub.py
+++ b/test/types/rebuild_computed_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_computed_response import (
@@ -24,10 +31,10 @@
RebuildComputedResponseAdapter = TypeAdapter(RebuildComputedResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildComputedResponse not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_computed_response_model_schema = json.loads(r"""{
+rebuild_computed_response_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "message" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_computed_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_computed_response_faker = JSF(
diff --git a/test/types/rebuild_model_async_response_v2_stub.py b/test/types/rebuild_model_async_response_v2_stub.py
index 8806c986..36951ca3 100644
--- a/test/types/rebuild_model_async_response_v2_stub.py
+++ b/test/types/rebuild_model_async_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_model_async_response_v2 import (
@@ -24,10 +31,10 @@
RebuildModelAsyncResponseV2Adapter = TypeAdapter(RebuildModelAsyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildModelAsyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_model_async_response_v2_model_schema = json.loads(r"""{
+rebuild_model_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -46,7 +53,9 @@
},
"description" : "Model Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_model_async_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_model_async_response_v2_faker = JSF(
diff --git a/test/types/rebuild_model_sync_response_v2_stub.py b/test/types/rebuild_model_sync_response_v2_stub.py
index a1290c88..28fc6a1b 100644
--- a/test/types/rebuild_model_sync_response_v2_stub.py
+++ b/test/types/rebuild_model_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_model_sync_response_v2 import (
@@ -24,10 +31,10 @@
RebuildModelSyncResponseV2Adapter = TypeAdapter(RebuildModelSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildModelSyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_model_sync_response_v2_model_schema = json.loads(r"""{
+rebuild_model_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Model Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_model_sync_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_model_sync_response_v2_faker = JSF(
diff --git a/test/types/rebuild_plug_async_response_v2_stub.py b/test/types/rebuild_plug_async_response_v2_stub.py
index 5bdd6b2f..7f81f448 100644
--- a/test/types/rebuild_plug_async_response_v2_stub.py
+++ b/test/types/rebuild_plug_async_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_plug_async_response_v2 import (
@@ -24,10 +31,10 @@
RebuildPlugAsyncResponseV2Adapter = TypeAdapter(RebuildPlugAsyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildPlugAsyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_plug_async_response_v2_model_schema = json.loads(r"""{
+rebuild_plug_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -46,7 +53,9 @@
},
"description" : "Plug Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_plug_async_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_plug_async_response_v2_faker = JSF(
diff --git a/test/types/rebuild_plug_sync_response_v2_stub.py b/test/types/rebuild_plug_sync_response_v2_stub.py
index 19f0235b..2a777a90 100644
--- a/test/types/rebuild_plug_sync_response_v2_stub.py
+++ b/test/types/rebuild_plug_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_plug_sync_response_v2 import (
@@ -24,10 +31,10 @@
RebuildPlugSyncResponseV2Adapter = TypeAdapter(RebuildPlugSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildPlugSyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_plug_sync_response_v2_model_schema = json.loads(r"""{
+rebuild_plug_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Plug Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_plug_sync_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_plug_sync_response_v2_faker = JSF(
diff --git a/test/types/rebuild_policy_stub.py b/test/types/rebuild_policy_stub.py
index f8f601db..0fd953cf 100644
--- a/test/types/rebuild_policy_stub.py
+++ b/test/types/rebuild_policy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_policy import RebuildPolicy
@@ -22,15 +29,17 @@
RebuildPolicyAdapter = TypeAdapter(RebuildPolicy)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildPolicy not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_policy_model_schema = json.loads(r"""{
+rebuild_policy_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "The policy to select a new runtime version when a rebuild is issued.",
"enum" : [ "patch", "minor", "major", "same" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_policy_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_policy_faker = JSF(rebuild_policy_model_schema, allow_none_optionals=1)
diff --git a/test/types/rebuild_query_params_stub.py b/test/types/rebuild_query_params_stub.py
index 72fce8bb..61fca899 100644
--- a/test/types/rebuild_query_params_stub.py
+++ b/test/types/rebuild_query_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_query_params import RebuildQueryParams
@@ -22,10 +29,10 @@
RebuildQueryParamsAdapter = TypeAdapter(RebuildQueryParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildQueryParams not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_query_params_model_schema = json.loads(r"""{
+rebuild_query_params_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"upgrade" : {
@@ -53,7 +60,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_query_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_query_params_faker = JSF(
diff --git a/test/types/rebuild_query_v2_stub.py b/test/types/rebuild_query_v2_stub.py
index f8326ac6..1a8e4b9b 100644
--- a/test/types/rebuild_query_v2_stub.py
+++ b/test/types/rebuild_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_query_v2 import RebuildQueryV2
@@ -22,10 +29,10 @@
RebuildQueryV2Adapter = TypeAdapter(RebuildQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_query_v2_model_schema = json.loads(r"""{
+rebuild_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -62,7 +69,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_query_v2_faker = JSF(rebuild_query_v2_model_schema, allow_none_optionals=1)
diff --git a/test/types/rebuild_submitted_response_stub.py b/test/types/rebuild_submitted_response_stub.py
index 218a70c8..90207700 100644
--- a/test/types/rebuild_submitted_response_stub.py
+++ b/test/types/rebuild_submitted_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_submitted_response import (
@@ -24,10 +31,10 @@
RebuildSubmittedResponseAdapter = TypeAdapter(RebuildSubmittedResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RebuildSubmittedResponse not available: {exc}")
MODELS_AVAILABLE = False
-rebuild_submitted_response_model_schema = json.loads(r"""{
+rebuild_submitted_response_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "message" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_submitted_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
rebuild_submitted_response_faker = JSF(
diff --git a/test/types/rebuild_webscript_async_response_v2_stub.py b/test/types/rebuild_webscript_async_response_v2_stub.py
index f5b18698..3843d61a 100644
--- a/test/types/rebuild_webscript_async_response_v2_stub.py
+++ b/test/types/rebuild_webscript_async_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_webscript_async_response_v2 import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for RebuildWebscriptAsyncResponseV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-rebuild_webscript_async_response_v2_model_schema = json.loads(r"""{
+rebuild_webscript_async_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -50,7 +55,9 @@
},
"description" : "Webscript Rebuild Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_webscript_async_response_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/rebuild_webscript_sync_response_v2_stub.py b/test/types/rebuild_webscript_sync_response_v2_stub.py
index 88d6953e..b6b750f4 100644
--- a/test/types/rebuild_webscript_sync_response_v2_stub.py
+++ b/test/types/rebuild_webscript_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.rebuild_webscript_sync_response_v2 import (
@@ -24,12 +31,10 @@
RebuildWebscriptSyncResponseV2Adapter = TypeAdapter(RebuildWebscriptSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for RebuildWebscriptSyncResponseV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-rebuild_webscript_sync_response_v2_model_schema = json.loads(r"""{
+rebuild_webscript_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "causes", "entity", "message" ],
"type" : "object",
"properties" : {
@@ -45,7 +50,9 @@
},
"description" : "Webscript Rebuild Ignored"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
rebuild_webscript_sync_response_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/remove_function_query_v2_stub.py b/test/types/remove_function_query_v2_stub.py
index e05affed..5a8d453a 100644
--- a/test/types/remove_function_query_v2_stub.py
+++ b/test/types/remove_function_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.remove_function_query_v2 import (
@@ -24,10 +31,10 @@
RemoveFunctionQueryV2Adapter = TypeAdapter(RemoveFunctionQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RemoveFunctionQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-remove_function_query_v2_model_schema = json.loads(r"""{
+remove_function_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -50,7 +57,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
remove_function_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
remove_function_query_v2_faker = JSF(
diff --git a/test/types/remove_plug_query_v2_stub.py b/test/types/remove_plug_query_v2_stub.py
index d5d0bb0b..b5223ee8 100644
--- a/test/types/remove_plug_query_v2_stub.py
+++ b/test/types/remove_plug_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.remove_plug_query_v2 import RemovePlugQueryV2
@@ -22,10 +29,10 @@
RemovePlugQueryV2Adapter = TypeAdapter(RemovePlugQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RemovePlugQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-remove_plug_query_v2_model_schema = json.loads(r"""{
+remove_plug_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -48,7 +55,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
remove_plug_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
remove_plug_query_v2_faker = JSF(
diff --git a/test/types/request_operation_stub.py b/test/types/request_operation_stub.py
index ca88d138..caa07fb2 100644
--- a/test/types/request_operation_stub.py
+++ b/test/types/request_operation_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.request_operation import RequestOperation
@@ -22,16 +29,18 @@
RequestOperationAdapter = TypeAdapter(RequestOperation)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RequestOperation not available: {exc}")
MODELS_AVAILABLE = False
-request_operation_model_schema = json.loads(r"""{
+request_operation_model_schema = json.loads(
+ r"""{
"title" : "RequestOperation",
"type" : "string",
"description" : "A modifying operation on the function.",
"enum" : [ "create", "metadata-update", "assets-update", "rebuild", "verify", "publish", "deprecate", "undeploy" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
request_operation_model_schema.update({"definitions": MODEL_DEFINITIONS})
request_operation_faker = JSF(request_operation_model_schema, allow_none_optionals=1)
diff --git a/test/types/resource_limits_stub.py b/test/types/resource_limits_stub.py
index 39f4e010..06c1052a 100644
--- a/test/types/resource_limits_stub.py
+++ b/test/types/resource_limits_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.resource_limits import ResourceLimits
@@ -22,10 +29,10 @@
ResourceLimitsAdapter = TypeAdapter(ResourceLimits)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ResourceLimits not available: {exc}")
MODELS_AVAILABLE = False
-resource_limits_model_schema = json.loads(r"""{
+resource_limits_model_schema = json.loads(
+ r"""{
"title" : "ResourceLimits",
"required" : [ "cpu", "memory" ],
"type" : "object",
@@ -40,7 +47,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
resource_limits_model_schema.update({"definitions": MODEL_DEFINITIONS})
resource_limits_faker = JSF(resource_limits_model_schema, allow_none_optionals=1)
diff --git a/test/types/root_page_response_stub.py b/test/types/root_page_response_stub.py
index d215bdd6..60e4d9e2 100644
--- a/test/types/root_page_response_stub.py
+++ b/test/types/root_page_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.root_page_response import RootPageResponse
@@ -22,10 +29,10 @@
RootPageResponseAdapter = TypeAdapter(RootPageResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RootPageResponse not available: {exc}")
MODELS_AVAILABLE = False
-root_page_response_model_schema = json.loads(r"""{
+root_page_response_model_schema = json.loads(
+ r"""{
"required" : [ "enabled", "name", "revision", "version" ],
"type" : "object",
"properties" : {
@@ -47,7 +54,9 @@
},
"description" : "Status Page"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
root_page_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
root_page_response_faker = JSF(root_page_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_attributes_stub.py b/test/types/runtime_attributes_stub.py
index 3807c1cb..02842e81 100644
--- a/test/types/runtime_attributes_stub.py
+++ b/test/types/runtime_attributes_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_attributes import RuntimeAttributes
@@ -22,10 +29,10 @@
RuntimeAttributesAdapter = TypeAdapter(RuntimeAttributes)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeAttributes not available: {exc}")
MODELS_AVAILABLE = False
-runtime_attributes_model_schema = json.loads(r"""{
+runtime_attributes_model_schema = json.loads(
+ r"""{
"title" : "RuntimeAttributes",
"required" : [ "deprecated", "name", "upgradable", "version" ],
"type" : "object",
@@ -48,7 +55,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_attributes_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_attributes_faker = JSF(runtime_attributes_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_info_stub.py b/test/types/runtime_info_stub.py
index bf066911..046217d9 100644
--- a/test/types/runtime_info_stub.py
+++ b/test/types/runtime_info_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_info import RuntimeInfo
@@ -22,10 +29,10 @@
RuntimeInfoAdapter = TypeAdapter(RuntimeInfo)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeInfo not available: {exc}")
MODELS_AVAILABLE = False
-runtime_info_model_schema = json.loads(r"""{
+runtime_info_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "functionType", "name" ],
"type" : "object",
"properties" : {
@@ -41,7 +48,9 @@
},
"description" : "Runtime attributes that are the same for all versions of a runtime."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_info_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_info_faker = JSF(runtime_info_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_name_query_stub.py b/test/types/runtime_name_query_stub.py
index 5eeaee5f..352c2e05 100644
--- a/test/types/runtime_name_query_stub.py
+++ b/test/types/runtime_name_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_name_query import RuntimeNameQuery
@@ -22,10 +29,10 @@
RuntimeNameQueryAdapter = TypeAdapter(RuntimeNameQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeNameQuery not available: {exc}")
MODELS_AVAILABLE = False
-runtime_name_query_model_schema = json.loads(r"""{
+runtime_name_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -52,7 +59,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_name_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_name_query_faker = JSF(runtime_name_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_params_stub.py b/test/types/runtime_params_stub.py
index c19632f3..d248a3cb 100644
--- a/test/types/runtime_params_stub.py
+++ b/test/types/runtime_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_params import RuntimeParams
@@ -22,10 +29,10 @@
RuntimeParamsAdapter = TypeAdapter(RuntimeParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeParams not available: {exc}")
MODELS_AVAILABLE = False
-runtime_params_model_schema = json.loads(r"""{
+runtime_params_model_schema = json.loads(
+ r"""{
"required" : [ "name" ],
"type" : "object",
"properties" : {
@@ -35,7 +42,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_params_faker = JSF(runtime_params_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_query_stub.py b/test/types/runtime_query_stub.py
index 6cf5065e..9becc942 100644
--- a/test/types/runtime_query_stub.py
+++ b/test/types/runtime_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_query import RuntimeQuery
@@ -22,10 +29,10 @@
RuntimeQueryAdapter = TypeAdapter(RuntimeQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeQuery not available: {exc}")
MODELS_AVAILABLE = False
-runtime_query_model_schema = json.loads(r"""{
+runtime_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -63,7 +70,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_query_faker = JSF(runtime_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_reference_stub.py b/test/types/runtime_reference_stub.py
index 835bda6a..05251769 100644
--- a/test/types/runtime_reference_stub.py
+++ b/test/types/runtime_reference_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_reference import RuntimeReference
@@ -22,10 +29,10 @@
RuntimeReferenceAdapter = TypeAdapter(RuntimeReference)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeReference not available: {exc}")
MODELS_AVAILABLE = False
-runtime_reference_model_schema = json.loads(r"""{
+runtime_reference_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"description" : "Reference to a runtime version."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_reference_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_reference_faker = JSF(runtime_reference_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_specification_stub.py b/test/types/runtime_specification_stub.py
index f9da539a..19b4e3cc 100644
--- a/test/types/runtime_specification_stub.py
+++ b/test/types/runtime_specification_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_specification import (
@@ -24,10 +31,10 @@
RuntimeSpecificationAdapter = TypeAdapter(RuntimeSpecification)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeSpecification not available: {exc}")
MODELS_AVAILABLE = False
-runtime_specification_model_schema = json.loads(r"""{
+runtime_specification_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"build" : {
@@ -56,7 +63,9 @@
},
"description" : "Runtime (version) specification that says\n* what assets are required/allowed to build the function\n* what build parameters are used\n* what deployment parameters are used\n* which dependencies are provided by the runtime"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_specification_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_specification_faker = JSF(
diff --git a/test/types/runtime_summary_attrs_stub.py b/test/types/runtime_summary_attrs_stub.py
index 2a290f9e..ceb2381b 100644
--- a/test/types/runtime_summary_attrs_stub.py
+++ b/test/types/runtime_summary_attrs_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_summary_attrs import (
@@ -24,10 +31,10 @@
RuntimeSummaryAttrsAdapter = TypeAdapter(RuntimeSummaryAttrs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeSummaryAttrs not available: {exc}")
MODELS_AVAILABLE = False
-runtime_summary_attrs_model_schema = json.loads(r"""{
+runtime_summary_attrs_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "functionType", "name", "title" ],
"type" : "object",
"properties" : {
@@ -48,7 +55,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_summary_attrs_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_summary_attrs_faker = JSF(
diff --git a/test/types/runtime_summary_response_stub.py b/test/types/runtime_summary_response_stub.py
index f00b6e95..11caa332 100644
--- a/test/types/runtime_summary_response_stub.py
+++ b/test/types/runtime_summary_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_summary_response import (
@@ -24,10 +31,10 @@
RuntimeSummaryResponseAdapter = TypeAdapter(RuntimeSummaryResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeSummaryResponse not available: {exc}")
MODELS_AVAILABLE = False
-runtime_summary_response_model_schema = json.loads(r"""{
+runtime_summary_response_model_schema = json.loads(
+ r"""{
"required" : [ "runtimes" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "Runtimes Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_summary_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_summary_response_faker = JSF(
diff --git a/test/types/runtime_summary_stub.py b/test/types/runtime_summary_stub.py
index 77eda22b..e71c4b09 100644
--- a/test/types/runtime_summary_stub.py
+++ b/test/types/runtime_summary_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_summary import RuntimeSummary
@@ -22,10 +29,10 @@
RuntimeSummaryAdapter = TypeAdapter(RuntimeSummary)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeSummary not available: {exc}")
MODELS_AVAILABLE = False
-runtime_summary_model_schema = json.loads(r"""{
+runtime_summary_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "functionType", "name", "title", "versions" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "A summary representation of the runtime, and (selected) versions of it."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_summary_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_summary_faker = JSF(runtime_summary_model_schema, allow_none_optionals=1)
diff --git a/test/types/runtime_version_and_path_params_stub.py b/test/types/runtime_version_and_path_params_stub.py
index 21300ca8..93d52579 100644
--- a/test/types/runtime_version_and_path_params_stub.py
+++ b/test/types/runtime_version_and_path_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_and_path_params import (
@@ -24,10 +31,10 @@
RuntimeVersionAndPathParamsAdapter = TypeAdapter(RuntimeVersionAndPathParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionAndPathParams not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_and_path_params_model_schema = json.loads(r"""{
+runtime_version_and_path_params_model_schema = json.loads(
+ r"""{
"required" : [ "*", "name", "version" ],
"type" : "object",
"properties" : {
@@ -44,7 +51,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_and_path_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_and_path_params_faker = JSF(
diff --git a/test/types/runtime_version_info_stub.py b/test/types/runtime_version_info_stub.py
index 85fcc542..a82f9e7c 100644
--- a/test/types/runtime_version_info_stub.py
+++ b/test/types/runtime_version_info_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_info import RuntimeVersionInfo
@@ -22,10 +29,10 @@
RuntimeVersionInfoAdapter = TypeAdapter(RuntimeVersionInfo)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionInfo not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_info_model_schema = json.loads(r"""{
+runtime_version_info_model_schema = json.loads(
+ r"""{
"title" : "RuntimeVersionInfo",
"required" : [ "deprecated", "title", "upgradable", "version" ],
"type" : "object",
@@ -54,7 +61,9 @@
},
"description" : "A summary of a selected version for a runtime"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_info_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_info_faker = JSF(
diff --git a/test/types/runtime_version_params_stub.py b/test/types/runtime_version_params_stub.py
index 891aaeca..853dda11 100644
--- a/test/types/runtime_version_params_stub.py
+++ b/test/types/runtime_version_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_params import (
@@ -24,10 +31,10 @@
RuntimeVersionParamsAdapter = TypeAdapter(RuntimeVersionParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionParams not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_params_model_schema = json.loads(r"""{
+runtime_version_params_model_schema = json.loads(
+ r"""{
"required" : [ "name", "version" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_params_faker = JSF(
diff --git a/test/types/runtime_version_query_stub.py b/test/types/runtime_version_query_stub.py
index 345abbff..446f5117 100644
--- a/test/types/runtime_version_query_stub.py
+++ b/test/types/runtime_version_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_query import (
@@ -24,10 +31,10 @@
RuntimeVersionQueryAdapter = TypeAdapter(RuntimeVersionQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionQuery not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_query_model_schema = json.loads(r"""{
+runtime_version_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"version" : {
@@ -44,7 +51,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_query_faker = JSF(
diff --git a/test/types/runtime_version_response_stub.py b/test/types/runtime_version_response_stub.py
index 3765b6bc..41af20fa 100644
--- a/test/types/runtime_version_response_stub.py
+++ b/test/types/runtime_version_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_response import (
@@ -24,10 +31,10 @@
RuntimeVersionResponseAdapter = TypeAdapter(RuntimeVersionResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionResponse not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_response_model_schema = json.loads(r"""{
+runtime_version_response_model_schema = json.loads(
+ r"""{
"required" : [ "runtime" ],
"type" : "object",
"properties" : {
@@ -37,7 +44,9 @@
},
"description" : ": Runtime Version Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_response_faker = JSF(
diff --git a/test/types/runtime_version_specification_stub.py b/test/types/runtime_version_specification_stub.py
index c0fe3e5a..b1a25c83 100644
--- a/test/types/runtime_version_specification_stub.py
+++ b/test/types/runtime_version_specification_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_specification import (
@@ -24,10 +31,10 @@
RuntimeVersionSpecificationAdapter = TypeAdapter(RuntimeVersionSpecification)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionSpecification not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_specification_model_schema = json.loads(r"""{
+runtime_version_specification_model_schema = json.loads(
+ r"""{
"required" : [ "title", "version" ],
"type" : "object",
"properties" : {
@@ -65,7 +72,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_specification_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_specification_faker = JSF(
diff --git a/test/types/runtime_version_status_stub.py b/test/types/runtime_version_status_stub.py
index 2372a739..a069f93f 100644
--- a/test/types/runtime_version_status_stub.py
+++ b/test/types/runtime_version_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_status import (
@@ -24,10 +31,10 @@
RuntimeVersionStatusAdapter = TypeAdapter(RuntimeVersionStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionStatus not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_status_model_schema = json.loads(r"""{
+runtime_version_status_model_schema = json.loads(
+ r"""{
"required" : [ "deprecated", "upgradable" ],
"type" : "object",
"properties" : {
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_status_faker = JSF(
diff --git a/test/types/runtime_version_summary_stub.py b/test/types/runtime_version_summary_stub.py
index 94880990..cf81ad8c 100644
--- a/test/types/runtime_version_summary_stub.py
+++ b/test/types/runtime_version_summary_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.runtime_version_summary import (
@@ -24,10 +31,10 @@
RuntimeVersionSummaryAdapter = TypeAdapter(RuntimeVersionSummary)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for RuntimeVersionSummary not available: {exc}")
MODELS_AVAILABLE = False
-runtime_version_summary_model_schema = json.loads(r"""{
+runtime_version_summary_model_schema = json.loads(
+ r"""{
"required" : [ "archiveFormat", "deprecated", "functionType", "name", "title", "upgradable", "version" ],
"type" : "object",
"properties" : {
@@ -59,7 +66,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
runtime_version_summary_model_schema.update({"definitions": MODEL_DEFINITIONS})
runtime_version_summary_faker = JSF(
diff --git a/test/types/scale1_stub.py b/test/types/scale1_stub.py
index 2acff368..827ea2ee 100644
--- a/test/types/scale1_stub.py
+++ b/test/types/scale1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.scale1 import Scale1
@@ -22,10 +29,10 @@
Scale1Adapter = TypeAdapter(Scale1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Scale1 not available: {exc}")
MODELS_AVAILABLE = False
-scale_1_model_schema = json.loads(r"""{
+scale_1_model_schema = json.loads(
+ r"""{
"title" : "Scale",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
scale_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
scale_1_faker = JSF(scale_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/scale_args_stub.py b/test/types/scale_args_stub.py
index 74c94355..a8875b28 100644
--- a/test/types/scale_args_stub.py
+++ b/test/types/scale_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.scale_args import ScaleArgs
@@ -22,10 +29,10 @@
ScaleArgsAdapter = TypeAdapter(ScaleArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ScaleArgs not available: {exc}")
MODELS_AVAILABLE = False
-scale_args_model_schema = json.loads(r"""{
+scale_args_model_schema = json.loads(
+ r"""{
"title" : "ScaleArgs",
"required" : [ "endpoint", "namespace", "replicas", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -59,7 +66,9 @@
},
"description" : "Input argument to an (openfaas) scale job for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
scale_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
scale_args_faker = JSF(scale_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/scale_job_status_stub.py b/test/types/scale_job_status_stub.py
index bc713940..5df30f16 100644
--- a/test/types/scale_job_status_stub.py
+++ b/test/types/scale_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.scale_job_status import ScaleJobStatus
@@ -22,10 +29,10 @@
ScaleJobStatusAdapter = TypeAdapter(ScaleJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for ScaleJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-scale_job_status_model_schema = json.loads(r"""{
+scale_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -64,7 +71,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
scale_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
scale_job_status_faker = JSF(scale_job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/scale_stub.py b/test/types/scale_stub.py
index 259c8ce4..07b1f2f4 100644
--- a/test/types/scale_stub.py
+++ b/test/types/scale_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.scale import Scale
@@ -22,10 +29,10 @@
ScaleAdapter = TypeAdapter(Scale)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Scale not available: {exc}")
MODELS_AVAILABLE = False
-scale_model_schema = json.loads(r"""{
+scale_model_schema = json.loads(
+ r"""{
"title" : "Scale",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -75,7 +82,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
scale_model_schema.update({"definitions": MODEL_DEFINITIONS})
scale_faker = JSF(scale_model_schema, allow_none_optionals=1)
diff --git a/test/types/schema_by_id_params_stub.py b/test/types/schema_by_id_params_stub.py
index af37de97..14f056e9 100644
--- a/test/types/schema_by_id_params_stub.py
+++ b/test/types/schema_by_id_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.schema_by_id_params import SchemaByIdParams
@@ -22,10 +29,10 @@
SchemaByIdParamsAdapter = TypeAdapter(SchemaByIdParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for SchemaByIdParams not available: {exc}")
MODELS_AVAILABLE = False
-schema_by_id_params_model_schema = json.loads(r"""{
+schema_by_id_params_model_schema = json.loads(
+ r"""{
"required" : [ "schemaId" ],
"type" : "object",
"properties" : {
@@ -36,7 +43,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
schema_by_id_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
schema_by_id_params_faker = JSF(
diff --git a/test/types/schema_params_stub.py b/test/types/schema_params_stub.py
index 30846eb7..6c412f93 100644
--- a/test/types/schema_params_stub.py
+++ b/test/types/schema_params_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.schema_params import SchemaParams
@@ -22,10 +29,10 @@
SchemaParamsAdapter = TypeAdapter(SchemaParams)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for SchemaParams not available: {exc}")
MODELS_AVAILABLE = False
-schema_params_model_schema = json.loads(r"""{
+schema_params_model_schema = json.loads(
+ r"""{
"required" : [ "functionType", "role" ],
"type" : "object",
"properties" : {
@@ -38,7 +45,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
schema_params_model_schema.update({"definitions": MODEL_DEFINITIONS})
schema_params_faker = JSF(schema_params_model_schema, allow_none_optionals=1)
diff --git a/test/types/semantic_version_range_stub.py b/test/types/semantic_version_range_stub.py
index fdd8c807..c79f7ed0 100644
--- a/test/types/semantic_version_range_stub.py
+++ b/test/types/semantic_version_range_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.semantic_version_range import (
@@ -24,10 +31,10 @@
SemanticVersionRangeAdapter = TypeAdapter(SemanticVersionRange)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for SemanticVersionRange not available: {exc}")
MODELS_AVAILABLE = False
-semantic_version_range_model_schema = json.loads(r"""{
+semantic_version_range_model_schema = json.loads(
+ r"""{
"title" : "SemanticVersionRange",
"description" : "A range of semantic versions. See https://devhints.io/semver",
"anyOf" : [ {
@@ -36,7 +43,9 @@
"$ref" : "#/components/schemas/SemanticVersion"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
semantic_version_range_model_schema.update({"definitions": MODEL_DEFINITIONS})
semantic_version_range_faker = JSF(
diff --git a/test/types/status_any_stub.py b/test/types/status_any_stub.py
index 0b382966..84a2581b 100644
--- a/test/types/status_any_stub.py
+++ b/test/types/status_any_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.status_any import StatusAny
@@ -22,15 +29,17 @@
StatusAnyAdapter = TypeAdapter(StatusAny)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for StatusAny not available: {exc}")
MODELS_AVAILABLE = False
-status_any_model_schema = json.loads(r"""{
+status_any_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "Includes *all* statuses (including `undeployed`) as a filter",
"enum" : [ "any" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
status_any_model_schema.update({"definitions": MODEL_DEFINITIONS})
status_any_faker = JSF(status_any_model_schema, allow_none_optionals=1)
diff --git a/test/types/status_filter_stub.py b/test/types/status_filter_stub.py
index 0913e0db..2def6139 100644
--- a/test/types/status_filter_stub.py
+++ b/test/types/status_filter_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.status_filter import StatusFilter
@@ -22,10 +29,10 @@
StatusFilterAdapter = TypeAdapter(StatusFilter)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for StatusFilter not available: {exc}")
MODELS_AVAILABLE = False
-status_filter_model_schema = json.loads(r"""{
+status_filter_model_schema = json.loads(
+ r"""{
"description" : "Inclusion or exclusion filter on the `status` property.",
"anyOf" : [ {
"$ref" : "#/components/schemas/StatusInclude"
@@ -35,7 +42,9 @@
"$ref" : "#/components/schemas/StatusAny"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
status_filter_model_schema.update({"definitions": MODEL_DEFINITIONS})
status_filter_faker = JSF(status_filter_model_schema, allow_none_optionals=1)
diff --git a/test/types/status_include_stub.py b/test/types/status_include_stub.py
index 46067044..1d8a9c91 100644
--- a/test/types/status_include_stub.py
+++ b/test/types/status_include_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.status_include import StatusInclude
@@ -22,16 +29,18 @@
StatusIncludeAdapter = TypeAdapter(StatusInclude)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for StatusInclude not available: {exc}")
MODELS_AVAILABLE = False
-status_include_model_schema = json.loads(r"""{
+status_include_model_schema = json.loads(
+ r"""{
"type" : "string",
"description" : "Inlude a status as a filter.",
"example" : "running",
"enum" : [ "registered", "running", "pending", "deployed", "unhealthy", "failed", "undeploying", "undeployed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
status_include_model_schema.update({"definitions": MODEL_DEFINITIONS})
status_include_faker = JSF(status_include_model_schema, allow_none_optionals=1)
diff --git a/test/types/status_response_stub.py b/test/types/status_response_stub.py
index 655e0c02..78d9c6c0 100644
--- a/test/types/status_response_stub.py
+++ b/test/types/status_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.status_response import StatusResponse
@@ -22,10 +29,10 @@
StatusResponseAdapter = TypeAdapter(StatusResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for StatusResponse not available: {exc}")
MODELS_AVAILABLE = False
-status_response_model_schema = json.loads(r"""{
+status_response_model_schema = json.loads(
+ r"""{
"required" : [ "statusCode" ],
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
status_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
status_response_faker = JSF(status_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/status_stub.py b/test/types/status_stub.py
index 4b537a3e..d8d6d2f1 100644
--- a/test/types/status_stub.py
+++ b/test/types/status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.status import Status
@@ -22,16 +29,18 @@
StatusAdapter = TypeAdapter(Status)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Status not available: {exc}")
MODELS_AVAILABLE = False
-status_model_schema = json.loads(r"""{
+status_model_schema = json.loads(
+ r"""{
"title" : "Status",
"type" : "string",
"description" : "Status for a deployed function.",
"enum" : [ "registered", "running", "pending", "deployed", "unhealthy", "killed", "failed", "undeploying", "undeployed" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
status_model_schema.update({"definitions": MODEL_DEFINITIONS})
status_faker = JSF(status_model_schema, allow_none_optionals=1)
diff --git a/test/types/stream_closing_stub.py b/test/types/stream_closing_stub.py
index cb2b64c3..3828b84e 100644
--- a/test/types/stream_closing_stub.py
+++ b/test/types/stream_closing_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.stream_closing import StreamClosing
@@ -22,10 +29,10 @@
StreamClosingAdapter = TypeAdapter(StreamClosing)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for StreamClosing not available: {exc}")
MODELS_AVAILABLE = False
-stream_closing_model_schema = json.loads(r"""{
+stream_closing_model_schema = json.loads(
+ r"""{
"title" : "Stream Closing",
"required" : [ "data", "event" ],
"type" : "object",
@@ -41,7 +48,9 @@
},
"description" : "A message that notifies that the server will not send more events, and that the client should close."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
stream_closing_model_schema.update({"definitions": MODEL_DEFINITIONS})
stream_closing_faker = JSF(stream_closing_model_schema, allow_none_optionals=1)
diff --git a/test/types/stream_ready_stub.py b/test/types/stream_ready_stub.py
index 44af093d..1f1bfac7 100644
--- a/test/types/stream_ready_stub.py
+++ b/test/types/stream_ready_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.stream_ready import StreamReady
@@ -22,10 +29,10 @@
StreamReadyAdapter = TypeAdapter(StreamReady)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for StreamReady not available: {exc}")
MODELS_AVAILABLE = False
-stream_ready_model_schema = json.loads(r"""{
+stream_ready_model_schema = json.loads(
+ r"""{
"title" : "Stream Ready",
"required" : [ "data", "event" ],
"type" : "object",
@@ -41,7 +48,9 @@
},
"description" : "A message that acknowledges that the server will sent job state changes."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
stream_ready_model_schema.update({"definitions": MODEL_DEFINITIONS})
stream_ready_faker = JSF(stream_ready_model_schema, allow_none_optionals=1)
diff --git a/test/types/supported_events_stub.py b/test/types/supported_events_stub.py
index f57c153e..705cf73a 100644
--- a/test/types/supported_events_stub.py
+++ b/test/types/supported_events_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.supported_events import SupportedEvents
@@ -22,15 +29,17 @@
SupportedEventsAdapter = TypeAdapter(SupportedEvents)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for SupportedEvents not available: {exc}")
MODELS_AVAILABLE = False
-supported_events_model_schema = json.loads(r"""{
+supported_events_model_schema = json.loads(
+ r"""{
"title" : "SupportedEvents",
"type" : "string",
"enum" : [ "completed", "failed", "active", "delayed", "waiting", "waiting-children" ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
supported_events_model_schema.update({"definitions": MODEL_DEFINITIONS})
supported_events_faker = JSF(supported_events_model_schema, allow_none_optionals=1)
diff --git a/test/types/tag_query_stub.py b/test/types/tag_query_stub.py
index c82bf59c..5249af7c 100644
--- a/test/types/tag_query_stub.py
+++ b/test/types/tag_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.tag_query import TagQuery
@@ -22,10 +29,10 @@
TagQueryAdapter = TypeAdapter(TagQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for TagQuery not available: {exc}")
MODELS_AVAILABLE = False
-tag_query_model_schema = json.loads(r"""{
+tag_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"name" : {
@@ -41,7 +48,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
tag_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
tag_query_faker = JSF(tag_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/tag_stub.py b/test/types/tag_stub.py
index 015e7306..88671f54 100644
--- a/test/types/tag_stub.py
+++ b/test/types/tag_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.tag import Tag
@@ -22,10 +29,10 @@
TagAdapter = TypeAdapter(Tag)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Tag not available: {exc}")
MODELS_AVAILABLE = False
-tag_model_schema = json.loads(r"""{
+tag_model_schema = json.loads(
+ r"""{
"title" : "Tag",
"required" : [ "color", "name" ],
"type" : "object",
@@ -43,7 +50,9 @@
},
"description" : "One or more tags can be assigned to a function entity to facilitate grouping and searching."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
tag_model_schema.update({"definitions": MODEL_DEFINITIONS})
tag_faker = JSF(tag_model_schema, allow_none_optionals=1)
diff --git a/test/types/tags_filter_stub.py b/test/types/tags_filter_stub.py
index b90884f6..354222dc 100644
--- a/test/types/tags_filter_stub.py
+++ b/test/types/tags_filter_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.tags_filter import TagsFilter
@@ -22,10 +29,10 @@
TagsFilterAdapter = TypeAdapter(TagsFilter)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for TagsFilter not available: {exc}")
MODELS_AVAILABLE = False
-tags_filter_model_schema = json.loads(r"""{
+tags_filter_model_schema = json.loads(
+ r"""{
"title" : "TagsFilter",
"anyOf" : [ {
"type" : "array",
@@ -36,7 +43,9 @@
"type" : "string"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
tags_filter_model_schema.update({"definitions": MODEL_DEFINITIONS})
tags_filter_faker = JSF(tags_filter_model_schema, allow_none_optionals=1)
diff --git a/test/types/tags_query_stub.py b/test/types/tags_query_stub.py
index 1b659878..3f6e602c 100644
--- a/test/types/tags_query_stub.py
+++ b/test/types/tags_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.tags_query import TagsQuery
@@ -22,10 +29,10 @@
TagsQueryAdapter = TypeAdapter(TagsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for TagsQuery not available: {exc}")
MODELS_AVAILABLE = False
-tags_query_model_schema = json.loads(r"""{
+tags_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"tags" : {
@@ -34,7 +41,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
tags_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
tags_query_faker = JSF(tags_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/timestamp_absolute_stub.py b/test/types/timestamp_absolute_stub.py
index 95b9d328..4d73e9c1 100644
--- a/test/types/timestamp_absolute_stub.py
+++ b/test/types/timestamp_absolute_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.timestamp_absolute import TimestampAbsolute
@@ -22,10 +29,10 @@
TimestampAbsoluteAdapter = TypeAdapter(TimestampAbsolute)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for TimestampAbsolute not available: {exc}")
MODELS_AVAILABLE = False
-timestamp_absolute_model_schema = json.loads(r"""{
+timestamp_absolute_model_schema = json.loads(
+ r"""{
"title" : "TimestampAbsolute",
"description" : "An absolute timestamp as an ISO8601 string",
"anyOf" : [ {
@@ -34,7 +41,9 @@
"$ref" : "#/components/schemas/SO8601Date"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
timestamp_absolute_model_schema.update({"definitions": MODEL_DEFINITIONS})
timestamp_absolute_faker = JSF(timestamp_absolute_model_schema, allow_none_optionals=1)
diff --git a/test/types/timestamp_age_stub.py b/test/types/timestamp_age_stub.py
index ae46ec89..1b093d3b 100644
--- a/test/types/timestamp_age_stub.py
+++ b/test/types/timestamp_age_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.timestamp_age import TimestampAge
@@ -22,10 +29,10 @@
TimestampAgeAdapter = TypeAdapter(TimestampAge)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for TimestampAge not available: {exc}")
MODELS_AVAILABLE = False
-timestamp_age_model_schema = json.loads(r"""{
+timestamp_age_model_schema = json.loads(
+ r"""{
"title" : "TimestampAge",
"description" : "A timestamp expressed as a age relative to now",
"anyOf" : [ {
@@ -34,7 +41,9 @@
"$ref" : "#/components/schemas/DurationSpec"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
timestamp_age_model_schema.update({"definitions": MODEL_DEFINITIONS})
timestamp_age_faker = JSF(timestamp_age_model_schema, allow_none_optionals=1)
diff --git a/test/types/timestamp_spec_stub.py b/test/types/timestamp_spec_stub.py
index 7e959bad..3315ca56 100644
--- a/test/types/timestamp_spec_stub.py
+++ b/test/types/timestamp_spec_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.timestamp_spec import TimestampSpec
@@ -22,10 +29,10 @@
TimestampSpecAdapter = TypeAdapter(TimestampSpec)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for TimestampSpec not available: {exc}")
MODELS_AVAILABLE = False
-timestamp_spec_model_schema = json.loads(r"""{
+timestamp_spec_model_schema = json.loads(
+ r"""{
"title" : "TimestampSpec",
"description" : "A timestamp specification.",
"anyOf" : [ {
@@ -34,7 +41,9 @@
"$ref" : "#/components/schemas/TimestampAbsolute"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
timestamp_spec_model_schema.update({"definitions": MODEL_DEFINITIONS})
timestamp_spec_faker = JSF(timestamp_spec_model_schema, allow_none_optionals=1)
diff --git a/test/types/undeploy1_stub.py b/test/types/undeploy1_stub.py
index a0b9e601..e4c4334b 100644
--- a/test/types/undeploy1_stub.py
+++ b/test/types/undeploy1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeploy1 import Undeploy1
@@ -22,10 +29,10 @@
Undeploy1Adapter = TypeAdapter(Undeploy1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Undeploy1 not available: {exc}")
MODELS_AVAILABLE = False
-undeploy_1_model_schema = json.loads(r"""{
+undeploy_1_model_schema = json.loads(
+ r"""{
"title" : "Undeploy",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeploy_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeploy_1_faker = JSF(undeploy_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/undeploy_args_stub.py b/test/types/undeploy_args_stub.py
index 57fa8938..5d268408 100644
--- a/test/types/undeploy_args_stub.py
+++ b/test/types/undeploy_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeploy_args import UndeployArgs
@@ -22,10 +29,10 @@
UndeployArgsAdapter = TypeAdapter(UndeployArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UndeployArgs not available: {exc}")
MODELS_AVAILABLE = False
-undeploy_args_model_schema = json.loads(r"""{
+undeploy_args_model_schema = json.loads(
+ r"""{
"title" : "UndeployArgs",
"required" : [ "deleteEntity", "endpoint", "isNativePlug", "namespace", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -63,7 +70,9 @@
},
"description" : "Input argument to an (openfaas) undeployment job for a function."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeploy_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeploy_args_faker = JSF(undeploy_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/undeploy_job_status_stub.py b/test/types/undeploy_job_status_stub.py
index 985aace7..a0b95960 100644
--- a/test/types/undeploy_job_status_stub.py
+++ b/test/types/undeploy_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeploy_job_status import UndeployJobStatus
@@ -22,10 +29,10 @@
UndeployJobStatusAdapter = TypeAdapter(UndeployJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UndeployJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-undeploy_job_status_model_schema = json.loads(r"""{
+undeploy_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -65,7 +72,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeploy_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeploy_job_status_faker = JSF(
diff --git a/test/types/undeploy_result_stub.py b/test/types/undeploy_result_stub.py
index cce2eded..04e8908c 100644
--- a/test/types/undeploy_result_stub.py
+++ b/test/types/undeploy_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeploy_result import UndeployResult
@@ -22,10 +29,10 @@
UndeployResultAdapter = TypeAdapter(UndeployResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UndeployResult not available: {exc}")
MODELS_AVAILABLE = False
-undeploy_result_model_schema = json.loads(r"""{
+undeploy_result_model_schema = json.loads(
+ r"""{
"title" : "UndeployResult",
"required" : [ "assets", "deployment", "registration" ],
"type" : "object",
@@ -45,7 +52,9 @@
},
"description" : "The result data for a completed undeployment job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeploy_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeploy_result_faker = JSF(undeploy_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/undeploy_stub.py b/test/types/undeploy_stub.py
index 0d4f2abd..05c9e3c5 100644
--- a/test/types/undeploy_stub.py
+++ b/test/types/undeploy_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeploy import Undeploy
@@ -22,10 +29,10 @@
UndeployAdapter = TypeAdapter(Undeploy)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Undeploy not available: {exc}")
MODELS_AVAILABLE = False
-undeploy_model_schema = json.loads(r"""{
+undeploy_model_schema = json.loads(
+ r"""{
"title" : "Undeploy",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -75,7 +82,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeploy_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeploy_faker = JSF(undeploy_model_schema, allow_none_optionals=1)
diff --git a/test/types/undeploy_submitted_response_v2_stub.py b/test/types/undeploy_submitted_response_v2_stub.py
index 224f860d..77f5fdf6 100644
--- a/test/types/undeploy_submitted_response_v2_stub.py
+++ b/test/types/undeploy_submitted_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeploy_submitted_response_v2 import (
@@ -24,10 +31,10 @@
UndeploySubmittedResponseV2Adapter = TypeAdapter(UndeploySubmittedResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UndeploySubmittedResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-undeploy_submitted_response_v2_model_schema = json.loads(r"""{
+undeploy_submitted_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "message", "versions" ],
"type" : "object",
"properties" : {
@@ -47,7 +54,9 @@
},
"description" : "Undeployment Initiated"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeploy_submitted_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeploy_submitted_response_v2_faker = JSF(
diff --git a/test/types/undeployed_response_v2_stub.py b/test/types/undeployed_response_v2_stub.py
index 6f83358a..38200aed 100644
--- a/test/types/undeployed_response_v2_stub.py
+++ b/test/types/undeployed_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.undeployed_response_v2 import (
@@ -24,10 +31,10 @@
UndeployedResponseV2Adapter = TypeAdapter(UndeployedResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UndeployedResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-undeployed_response_v2_model_schema = json.loads(r"""{
+undeployed_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "message", "versions" ],
"type" : "object",
"properties" : {
@@ -44,7 +51,9 @@
},
"description" : "Undeployed"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
undeployed_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
undeployed_response_v2_faker = JSF(
diff --git a/test/types/unhealthy_invokable_webscript_error_stub.py b/test/types/unhealthy_invokable_webscript_error_stub.py
index ec353370..631dcea0 100644
--- a/test/types/unhealthy_invokable_webscript_error_stub.py
+++ b/test/types/unhealthy_invokable_webscript_error_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.unhealthy_invokable_webscript_error import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for UnhealthyInvokableWebscriptError not available: {exc}"
- )
MODELS_AVAILABLE = False
-unhealthy_invokable_webscript_error_model_schema = json.loads(r"""{
+unhealthy_invokable_webscript_error_model_schema = json.loads(
+ r"""{
"required" : [ "_links", "code", "entity", "error" ],
"type" : "object",
"properties" : {
@@ -50,7 +55,9 @@
},
"description" : "Webscript Not Healthy"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
unhealthy_invokable_webscript_error_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/update_comment_stub.py b/test/types/update_comment_stub.py
index 52b1aea9..fd4f5728 100644
--- a/test/types/update_comment_stub.py
+++ b/test/types/update_comment_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.update_comment import UpdateComment
@@ -22,10 +29,10 @@
UpdateCommentAdapter = TypeAdapter(UpdateComment)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UpdateComment not available: {exc}")
MODELS_AVAILABLE = False
-update_comment_model_schema = json.loads(r"""{
+update_comment_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"comment" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
update_comment_model_schema.update({"definitions": MODEL_DEFINITIONS})
update_comment_faker = JSF(update_comment_model_schema, allow_none_optionals=1)
diff --git a/test/types/update_draft_query_stub.py b/test/types/update_draft_query_stub.py
index 2c2fa8ec..8c4e1b7a 100644
--- a/test/types/update_draft_query_stub.py
+++ b/test/types/update_draft_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.update_draft_query import UpdateDraftQuery
@@ -22,10 +29,10 @@
UpdateDraftQueryAdapter = TypeAdapter(UpdateDraftQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UpdateDraftQuery not available: {exc}")
MODELS_AVAILABLE = False
-update_draft_query_model_schema = json.loads(r"""{
+update_draft_query_model_schema = json.loads(
+ r"""{
"required" : [ "chown" ],
"type" : "object",
"properties" : {
@@ -46,7 +53,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
update_draft_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
update_draft_query_faker = JSF(update_draft_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/update_metadata_request_v1_stub.py b/test/types/update_metadata_request_v1_stub.py
index a0347f3a..782fc7f5 100644
--- a/test/types/update_metadata_request_v1_stub.py
+++ b/test/types/update_metadata_request_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.update_metadata_request_v1 import (
@@ -24,10 +31,10 @@
UpdateMetadataRequestV1Adapter = TypeAdapter(UpdateMetadataRequestV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UpdateMetadataRequestV1 not available: {exc}")
MODELS_AVAILABLE = False
-update_metadata_request_v1_model_schema = json.loads(r"""{
+update_metadata_request_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -72,7 +79,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
update_metadata_request_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
update_metadata_request_v1_faker = JSF(
diff --git a/test/types/update_metadata_request_v2_stub.py b/test/types/update_metadata_request_v2_stub.py
index 302167b1..4d8a653f 100644
--- a/test/types/update_metadata_request_v2_stub.py
+++ b/test/types/update_metadata_request_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.update_metadata_request_v2 import (
@@ -24,10 +31,10 @@
UpdateMetadataRequestV2Adapter = TypeAdapter(UpdateMetadataRequestV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UpdateMetadataRequestV2 not available: {exc}")
MODELS_AVAILABLE = False
-update_metadata_request_v2_model_schema = json.loads(r"""{
+update_metadata_request_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -72,7 +79,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
update_metadata_request_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
update_metadata_request_v2_faker = JSF(
diff --git a/test/types/update_record_stub.py b/test/types/update_record_stub.py
index e1091a1c..9b709ad9 100644
--- a/test/types/update_record_stub.py
+++ b/test/types/update_record_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.update_record import UpdateRecord
@@ -22,10 +29,10 @@
UpdateRecordAdapter = TypeAdapter(UpdateRecord)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UpdateRecord not available: {exc}")
MODELS_AVAILABLE = False
-update_record_model_schema = json.loads(r"""{
+update_record_model_schema = json.loads(
+ r"""{
"title" : "UpdateRecord",
"required" : [ "at", "by", "operation" ],
"type" : "object",
@@ -59,7 +66,9 @@
},
"description" : "An update report corresponding to a modifying operation initiated by a user/administrator on the entity."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
update_record_model_schema.update({"definitions": MODEL_DEFINITIONS})
update_record_faker = JSF(update_record_model_schema, allow_none_optionals=1)
diff --git a/test/types/user_plug_meta_stub.py b/test/types/user_plug_meta_stub.py
index 2dee7b52..0e2ed21a 100644
--- a/test/types/user_plug_meta_stub.py
+++ b/test/types/user_plug_meta_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.user_plug_meta import UserPlugMeta
@@ -22,10 +29,10 @@
UserPlugMetaAdapter = TypeAdapter(UserPlugMeta)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for UserPlugMeta not available: {exc}")
MODELS_AVAILABLE = False
-user_plug_meta_model_schema = json.loads(r"""{
+user_plug_meta_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"author" : {
@@ -70,7 +77,9 @@
},
"description" : "Plug metadata that the user can update as `metadata`"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
user_plug_meta_model_schema.update({"definitions": MODEL_DEFINITIONS})
user_plug_meta_faker = JSF(user_plug_meta_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify1_stub.py b/test/types/verify1_stub.py
index af8eb406..627ccd38 100644
--- a/test/types/verify1_stub.py
+++ b/test/types/verify1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify1 import Verify1
@@ -22,10 +29,10 @@
Verify1Adapter = TypeAdapter(Verify1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Verify1 not available: {exc}")
MODELS_AVAILABLE = False
-verify_1_model_schema = json.loads(r"""{
+verify_1_model_schema = json.loads(
+ r"""{
"title" : "Verify",
"required" : [ "_links", "createdAt", "createdBy", "id", "operation", "state", "type" ],
"type" : "object",
@@ -68,7 +75,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_1_faker = JSF(verify_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify_args_stub.py b/test/types/verify_args_stub.py
index 650f6213..20eedf9f 100644
--- a/test/types/verify_args_stub.py
+++ b/test/types/verify_args_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_args import VerifyArgs
@@ -22,10 +29,10 @@
VerifyArgsAdapter = TypeAdapter(VerifyArgs)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VerifyArgs not available: {exc}")
MODELS_AVAILABLE = False
-verify_args_model_schema = json.loads(r"""{
+verify_args_model_schema = json.loads(
+ r"""{
"title" : "VerifyArgs",
"required" : [ "endpoint", "namespace", "runtimeName", "runtimeVersion" ],
"type" : "object",
@@ -54,7 +61,9 @@
},
"description" : "Input arguments for an (openfaas) deployment verification job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_args_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_args_faker = JSF(verify_args_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify_job_status_stub.py b/test/types/verify_job_status_stub.py
index fbf75d2d..db5d0a84 100644
--- a/test/types/verify_job_status_stub.py
+++ b/test/types/verify_job_status_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_job_status import VerifyJobStatus
@@ -22,10 +29,10 @@
VerifyJobStatusAdapter = TypeAdapter(VerifyJobStatus)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VerifyJobStatus not available: {exc}")
MODELS_AVAILABLE = False
-verify_job_status_model_schema = json.loads(r"""{
+verify_job_status_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "job", "operation", "request", "state", "type" ],
"type" : "object",
"properties" : {
@@ -65,7 +72,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_job_status_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_job_status_faker = JSF(verify_job_status_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify_model_sync_response_v2_stub.py b/test/types/verify_model_sync_response_v2_stub.py
index 12ccd84e..7c01c8e3 100644
--- a/test/types/verify_model_sync_response_v2_stub.py
+++ b/test/types/verify_model_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_model_sync_response_v2 import (
@@ -24,10 +31,10 @@
VerifyModelSyncResponseV2Adapter = TypeAdapter(VerifyModelSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VerifyModelSyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-verify_model_sync_response_v2_model_schema = json.loads(r"""{
+verify_model_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message", "result" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Model Health Verified"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_model_sync_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_model_sync_response_v2_faker = JSF(
diff --git a/test/types/verify_plug_sync_response_v2_stub.py b/test/types/verify_plug_sync_response_v2_stub.py
index 477cb5c9..3de4b828 100644
--- a/test/types/verify_plug_sync_response_v2_stub.py
+++ b/test/types/verify_plug_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_plug_sync_response_v2 import (
@@ -24,10 +31,10 @@
VerifyPlugSyncResponseV2Adapter = TypeAdapter(VerifyPlugSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VerifyPlugSyncResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-verify_plug_sync_response_v2_model_schema = json.loads(r"""{
+verify_plug_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message", "result" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
},
"description" : "Plug Health Verified"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_plug_sync_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_plug_sync_response_v2_faker = JSF(
diff --git a/test/types/verify_query_v1_stub.py b/test/types/verify_query_v1_stub.py
index 77f56b2d..33c5088a 100644
--- a/test/types/verify_query_v1_stub.py
+++ b/test/types/verify_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_query_v1 import VerifyQueryV1
@@ -22,10 +29,10 @@
VerifyQueryV1Adapter = TypeAdapter(VerifyQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VerifyQueryV1 not available: {exc}")
MODELS_AVAILABLE = False
-verify_query_v1_model_schema = json.loads(r"""{
+verify_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"scaleToZero" : {
@@ -35,7 +42,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_query_v1_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_query_v1_faker = JSF(verify_query_v1_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify_result_stub.py b/test/types/verify_result_stub.py
index be64499c..79a3e0cb 100644
--- a/test/types/verify_result_stub.py
+++ b/test/types/verify_result_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_result import VerifyResult
@@ -22,10 +29,10 @@
VerifyResultAdapter = TypeAdapter(VerifyResult)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VerifyResult not available: {exc}")
MODELS_AVAILABLE = False
-verify_result_model_schema = json.loads(r"""{
+verify_result_model_schema = json.loads(
+ r"""{
"title" : "VerifyResult",
"required" : [ "healthy" ],
"type" : "object",
@@ -43,7 +50,9 @@
},
"description" : "The result data for a completed verification job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_result_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_result_faker = JSF(verify_result_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify_stub.py b/test/types/verify_stub.py
index e49e09bc..41331dd8 100644
--- a/test/types/verify_stub.py
+++ b/test/types/verify_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify import Verify
@@ -22,10 +29,10 @@
VerifyAdapter = TypeAdapter(Verify)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Verify not available: {exc}")
MODELS_AVAILABLE = False
-verify_model_schema = json.loads(r"""{
+verify_model_schema = json.loads(
+ r"""{
"title" : "Verify",
"required" : [ "createdAt", "createdBy", "operation", "state", "type" ],
"type" : "object",
@@ -75,7 +82,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_model_schema.update({"definitions": MODEL_DEFINITIONS})
verify_faker = JSF(verify_model_schema, allow_none_optionals=1)
diff --git a/test/types/verify_webscript_sync_response_v2_stub.py b/test/types/verify_webscript_sync_response_v2_stub.py
index 15b605a0..568aa5a5 100644
--- a/test/types/verify_webscript_sync_response_v2_stub.py
+++ b/test/types/verify_webscript_sync_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.verify_webscript_sync_response_v2 import (
@@ -24,12 +31,10 @@
VerifyWebscriptSyncResponseV2Adapter = TypeAdapter(VerifyWebscriptSyncResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for VerifyWebscriptSyncResponseV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-verify_webscript_sync_response_v2_model_schema = json.loads(r"""{
+verify_webscript_sync_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "entity", "message", "result" ],
"type" : "object",
"properties" : {
@@ -45,7 +50,9 @@
},
"description" : "Webscript Health Verified"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
verify_webscript_sync_response_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/version_includes_stub.py b/test/types/version_includes_stub.py
index 4fe8b54f..49298897 100644
--- a/test/types/version_includes_stub.py
+++ b/test/types/version_includes_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.version_includes import VersionIncludes
@@ -22,10 +29,10 @@
VersionIncludesAdapter = TypeAdapter(VersionIncludes)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VersionIncludes not available: {exc}")
MODELS_AVAILABLE = False
-version_includes_model_schema = json.loads(r"""{
+version_includes_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -39,7 +46,9 @@
},
"additionalProperties" : false
}
-""")
+""",
+ object_hook=with_example_provider,
+)
version_includes_model_schema.update({"definitions": MODEL_DEFINITIONS})
version_includes_faker = JSF(version_includes_model_schema, allow_none_optionals=1)
diff --git a/test/types/versions_query_stub.py b/test/types/versions_query_stub.py
index 610d0bf2..ead776a9 100644
--- a/test/types/versions_query_stub.py
+++ b/test/types/versions_query_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.versions_query import VersionsQuery
@@ -22,10 +29,10 @@
VersionsQueryAdapter = TypeAdapter(VersionsQuery)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VersionsQuery not available: {exc}")
MODELS_AVAILABLE = False
-versions_query_model_schema = json.loads(r"""{
+versions_query_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -123,7 +130,9 @@
"additionalProperties" : false,
"description" : "Function versions paged query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
versions_query_model_schema.update({"definitions": MODEL_DEFINITIONS})
versions_query_faker = JSF(versions_query_model_schema, allow_none_optionals=1)
diff --git a/test/types/versions_query_v2_stub.py b/test/types/versions_query_v2_stub.py
index f4d88cbc..e4fe477b 100644
--- a/test/types/versions_query_v2_stub.py
+++ b/test/types/versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.versions_query_v2 import VersionsQueryV2
@@ -22,10 +29,10 @@
VersionsQueryV2Adapter = TypeAdapter(VersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VersionsQueryV2 not available: {exc}")
MODELS_AVAILABLE = False
-versions_query_v2_model_schema = json.loads(r"""{
+versions_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -123,7 +130,9 @@
"additionalProperties" : false,
"description" : "Function versions paged query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
versions_query_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
versions_query_v2_faker = JSF(versions_query_v2_model_schema, allow_none_optionals=1)
diff --git a/test/types/versions_response_v2_stub.py b/test/types/versions_response_v2_stub.py
index cd91c314..f801be0d 100644
--- a/test/types/versions_response_v2_stub.py
+++ b/test/types/versions_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.versions_response_v2 import VersionsResponseV2
@@ -22,10 +29,10 @@
VersionsResponseV2Adapter = TypeAdapter(VersionsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for VersionsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-versions_response_v2_model_schema = json.loads(r"""{
+versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -51,7 +58,9 @@
},
"description" : "Version Listing Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
versions_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
versions_response_v2_faker = JSF(
diff --git a/test/types/waiting_children_event_sse_stub.py b/test/types/waiting_children_event_sse_stub.py
index f64cf491..767200f0 100644
--- a/test/types/waiting_children_event_sse_stub.py
+++ b/test/types/waiting_children_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.waiting_children_event_sse import (
@@ -24,10 +31,10 @@
WaitingChildrenEventSSEAdapter = TypeAdapter(WaitingChildrenEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WaitingChildrenEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-waiting_children_event_sse_model_schema = json.loads(r"""{
+waiting_children_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -42,7 +49,9 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
waiting_children_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
waiting_children_event_sse_faker = JSF(
diff --git a/test/types/waiting_event_data_stub.py b/test/types/waiting_event_data_stub.py
index dc4b99c4..a9e7d00a 100644
--- a/test/types/waiting_event_data_stub.py
+++ b/test/types/waiting_event_data_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.waiting_event_data import WaitingEventData
@@ -22,10 +29,10 @@
WaitingEventDataAdapter = TypeAdapter(WaitingEventData)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WaitingEventData not available: {exc}")
MODELS_AVAILABLE = False
-waiting_event_data_model_schema = json.loads(r"""{
+waiting_event_data_model_schema = json.loads(
+ r"""{
"title" : "WaitingEventData",
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
waiting_event_data_model_schema.update({"definitions": MODEL_DEFINITIONS})
waiting_event_data_faker = JSF(waiting_event_data_model_schema, allow_none_optionals=1)
diff --git a/test/types/waiting_event_sse_stub.py b/test/types/waiting_event_sse_stub.py
index 1f69a3db..9a4d5114 100644
--- a/test/types/waiting_event_sse_stub.py
+++ b/test/types/waiting_event_sse_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.waiting_event_sse import WaitingEventSSE
@@ -22,10 +29,10 @@
WaitingEventSSEAdapter = TypeAdapter(WaitingEventSSE)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WaitingEventSSE not available: {exc}")
MODELS_AVAILABLE = False
-waiting_event_sse_model_schema = json.loads(r"""{
+waiting_event_sse_model_schema = json.loads(
+ r"""{
"required" : [ "data", "event" ],
"type" : "object",
"properties" : {
@@ -40,7 +47,9 @@
},
"description" : "A message that notifies a state change in a background job."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
waiting_event_sse_model_schema.update({"definitions": MODEL_DEFINITIONS})
waiting_event_sse_faker = JSF(waiting_event_sse_model_schema, allow_none_optionals=1)
diff --git a/test/types/webscript1_stub.py b/test/types/webscript1_stub.py
index 331f2854..e63c84f2 100644
--- a/test/types/webscript1_stub.py
+++ b/test/types/webscript1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript1 import Webscript1
@@ -22,10 +29,10 @@
Webscript1Adapter = TypeAdapter(Webscript1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Webscript1 not available: {exc}")
MODELS_AVAILABLE = False
-webscript_1_model_schema = json.loads(r"""{
+webscript_1_model_schema = json.loads(
+ r"""{
"title" : "Webscript",
"required" : [ "webscript" ],
"type" : "object",
@@ -41,7 +48,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_1_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_1_faker = JSF(webscript_1_model_schema, allow_none_optionals=1)
diff --git a/test/types/webscript2_stub.py b/test/types/webscript2_stub.py
index 2342fdbe..1af27a80 100644
--- a/test/types/webscript2_stub.py
+++ b/test/types/webscript2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript2 import Webscript2
@@ -22,10 +29,10 @@
Webscript2Adapter = TypeAdapter(Webscript2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Webscript2 not available: {exc}")
MODELS_AVAILABLE = False
-webscript_2_model_schema = json.loads(r"""{
+webscript_2_model_schema = json.loads(
+ r"""{
"title" : "Webscript",
"required" : [ "webscript" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_2_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_2_faker = JSF(webscript_2_model_schema, allow_none_optionals=1)
diff --git a/test/types/webscript_latest_version_query_v2_stub.py b/test/types/webscript_latest_version_query_v2_stub.py
index 4bf7c076..9289a7f3 100644
--- a/test/types/webscript_latest_version_query_v2_stub.py
+++ b/test/types/webscript_latest_version_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_latest_version_query_v2 import (
@@ -24,12 +31,10 @@
WebscriptLatestVersionQueryV2Adapter = TypeAdapter(WebscriptLatestVersionQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for WebscriptLatestVersionQueryV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-webscript_latest_version_query_v2_model_schema = json.loads(r"""{
+webscript_latest_version_query_v2_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"includeDraft" : {
@@ -44,7 +49,9 @@
"additionalProperties" : false,
"description" : "Webscript latest named version query."
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_latest_version_query_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/webscript_latest_versions_query_v1_stub.py b/test/types/webscript_latest_versions_query_v1_stub.py
index 1abc394b..57743676 100644
--- a/test/types/webscript_latest_versions_query_v1_stub.py
+++ b/test/types/webscript_latest_versions_query_v1_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_latest_versions_query_v1 import (
@@ -24,12 +31,10 @@
WebscriptLatestVersionsQueryV1Adapter = TypeAdapter(WebscriptLatestVersionsQueryV1)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for WebscriptLatestVersionsQueryV1 not available: {exc}"
- )
MODELS_AVAILABLE = False
-webscript_latest_versions_query_v1_model_schema = json.loads(r"""{
+webscript_latest_versions_query_v1_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -108,7 +113,9 @@
"additionalProperties" : false,
"description" : "Webscript lastest versions listing query"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_latest_versions_query_v1_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/webscript_latest_versions_query_v2_stub.py b/test/types/webscript_latest_versions_query_v2_stub.py
index ec095a0e..7a212d58 100644
--- a/test/types/webscript_latest_versions_query_v2_stub.py
+++ b/test/types/webscript_latest_versions_query_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_latest_versions_query_v2 import (
@@ -24,12 +31,10 @@
WebscriptLatestVersionsQueryV2Adapter = TypeAdapter(WebscriptLatestVersionsQueryV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for WebscriptLatestVersionsQueryV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-webscript_latest_versions_query_v2_model_schema = json.loads(r"""{
+webscript_latest_versions_query_v2_model_schema = json.loads(
+ r"""{
"description" : "Webscript lastest versions listing query.",
"anyOf" : [ {
"$ref" : "#/components/schemas/LatestFunctionVersionsQuery"
@@ -37,7 +42,9 @@
"$ref" : "#/components/schemas/LatestFunctionsQuery"
} ]
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_latest_versions_query_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/webscript_manifest_stub.py b/test/types/webscript_manifest_stub.py
index 7701e514..0b27db7a 100644
--- a/test/types/webscript_manifest_stub.py
+++ b/test/types/webscript_manifest_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_manifest import WebscriptManifest
@@ -22,10 +29,10 @@
WebscriptManifestAdapter = TypeAdapter(WebscriptManifest)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WebscriptManifest not available: {exc}")
MODELS_AVAILABLE = False
-webscript_manifest_model_schema = json.loads(r"""{
+webscript_manifest_model_schema = json.loads(
+ r"""{
"title" : "WebscriptManifest",
"required" : [ "allowHmac", "metadata", "name", "private", "runtime", "version" ],
"type" : "object",
@@ -62,7 +69,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_manifest_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_manifest_faker = JSF(webscript_manifest_model_schema, allow_none_optionals=1)
diff --git a/test/types/webscript_response_stub.py b/test/types/webscript_response_stub.py
index 763b5795..cbb312fa 100644
--- a/test/types/webscript_response_stub.py
+++ b/test/types/webscript_response_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_response import WebscriptResponse
@@ -22,10 +29,10 @@
WebscriptResponseAdapter = TypeAdapter(WebscriptResponse)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WebscriptResponse not available: {exc}")
MODELS_AVAILABLE = False
-webscript_response_model_schema = json.loads(r"""{
+webscript_response_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "metadata", "name", "runtime", "secret", "status", "updatedAt", "updatedBy", "version" ],
"type" : "object",
"properties" : {
@@ -86,7 +93,9 @@
},
"description" : "Successful Response"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_response_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_response_faker = JSF(webscript_response_model_schema, allow_none_optionals=1)
diff --git a/test/types/webscript_response_v2_stub.py b/test/types/webscript_response_v2_stub.py
index a420cd8d..fe3c8d80 100644
--- a/test/types/webscript_response_v2_stub.py
+++ b/test/types/webscript_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_response_v2 import (
@@ -24,10 +31,10 @@
WebscriptResponseV2Adapter = TypeAdapter(WebscriptResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WebscriptResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-webscript_response_v2_model_schema = json.loads(r"""{
+webscript_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates", "webscript" ],
"type" : "object",
"properties" : {
@@ -82,7 +89,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_response_v2_faker = JSF(
diff --git a/test/types/webscript_response_with_invoke_link_v2_stub.py b/test/types/webscript_response_with_invoke_link_v2_stub.py
index e6f95498..0df46b2f 100644
--- a/test/types/webscript_response_with_invoke_link_v2_stub.py
+++ b/test/types/webscript_response_with_invoke_link_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_response_with_invoke_link_v2 import (
@@ -26,12 +33,10 @@
)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(
- f"Type adapter for WebscriptResponseWithInvokeLinkV2 not available: {exc}"
- )
MODELS_AVAILABLE = False
-webscript_response_with_invoke_link_v2_model_schema = json.loads(r"""{
+webscript_response_with_invoke_link_v2_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates", "webscript" ],
"type" : "object",
"properties" : {
@@ -89,7 +94,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_response_with_invoke_link_v2_model_schema.update(
{"definitions": MODEL_DEFINITIONS}
)
diff --git a/test/types/webscript_stub.py b/test/types/webscript_stub.py
index 73f1cbc7..1d206392 100644
--- a/test/types/webscript_stub.py
+++ b/test/types/webscript_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript import Webscript
@@ -22,10 +29,10 @@
WebscriptAdapter = TypeAdapter(Webscript)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for Webscript not available: {exc}")
MODELS_AVAILABLE = False
-webscript_model_schema = json.loads(r"""{
+webscript_model_schema = json.loads(
+ r"""{
"title" : "Webscript",
"required" : [ "webscript" ],
"type" : "object",
@@ -38,7 +45,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_faker = JSF(webscript_model_schema, allow_none_optionals=1)
diff --git a/test/types/webscript_versions_response_v2_stub.py b/test/types/webscript_versions_response_v2_stub.py
index aefb1f4c..54a54ff3 100644
--- a/test/types/webscript_versions_response_v2_stub.py
+++ b/test/types/webscript_versions_response_v2_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.webscript_versions_response_v2 import (
@@ -24,10 +31,10 @@
WebscriptVersionsResponseV2Adapter = TypeAdapter(WebscriptVersionsResponseV2)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WebscriptVersionsResponseV2 not available: {exc}")
MODELS_AVAILABLE = False
-webscript_versions_response_v2_model_schema = json.loads(r"""{
+webscript_versions_response_v2_model_schema = json.loads(
+ r"""{
"required" : [ "count", "entities" ],
"type" : "object",
"properties" : {
@@ -53,7 +60,9 @@
},
"description" : "Webscript Versions Found"
}
-""")
+""",
+ object_hook=with_example_provider,
+)
webscript_versions_response_v2_model_schema.update({"definitions": MODEL_DEFINITIONS})
webscript_versions_response_v2_faker = JSF(
diff --git a/test/types/with_asset_hal_link_stub.py b/test/types/with_asset_hal_link_stub.py
index 99fcc35a..a0408bdd 100644
--- a/test/types/with_asset_hal_link_stub.py
+++ b/test/types/with_asset_hal_link_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.with_asset_hal_link import WithAssetHALLink
@@ -22,10 +29,10 @@
WithAssetHALLinkAdapter = TypeAdapter(WithAssetHALLink)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WithAssetHALLink not available: {exc}")
MODELS_AVAILABLE = False
-with_asset_hal_link_model_schema = json.loads(r"""{
+with_asset_hal_link_model_schema = json.loads(
+ r"""{
"required" : [ "_links" ],
"type" : "object",
"properties" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
with_asset_hal_link_model_schema.update({"definitions": MODEL_DEFINITIONS})
with_asset_hal_link_faker = JSF(
diff --git a/test/types/with_entity_attributes_stub.py b/test/types/with_entity_attributes_stub.py
index 60fea44d..70a6e5c3 100644
--- a/test/types/with_entity_attributes_stub.py
+++ b/test/types/with_entity_attributes_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.with_entity_attributes import (
@@ -24,10 +31,10 @@
WithEntityAttributesAdapter = TypeAdapter(WithEntityAttributes)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WithEntityAttributes not available: {exc}")
MODELS_AVAILABLE = False
-with_entity_attributes_model_schema = json.loads(r"""{
+with_entity_attributes_model_schema = json.loads(
+ r"""{
"required" : [ "createdAt", "createdBy", "deprecated", "draft", "runtime", "status", "updatedAt", "updatedBy", "updates" ],
"type" : "object",
"properties" : {
@@ -75,7 +82,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
with_entity_attributes_model_schema.update({"definitions": MODEL_DEFINITIONS})
with_entity_attributes_faker = JSF(
diff --git a/test/types/with_limit_stub.py b/test/types/with_limit_stub.py
index c34b6d7a..30be76dc 100644
--- a/test/types/with_limit_stub.py
+++ b/test/types/with_limit_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.with_limit import WithLimit
@@ -22,10 +29,10 @@
WithLimitAdapter = TypeAdapter(WithLimit)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WithLimit not available: {exc}")
MODELS_AVAILABLE = False
-with_limit_model_schema = json.loads(r"""{
+with_limit_model_schema = json.loads(
+ r"""{
"type" : "object",
"properties" : {
"limit" : {
@@ -34,7 +41,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
with_limit_model_schema.update({"definitions": MODEL_DEFINITIONS})
with_limit_faker = JSF(with_limit_model_schema, allow_none_optionals=1)
diff --git a/test/types/with_paging_stub.py b/test/types/with_paging_stub.py
index fc2eb62c..b2d6388e 100644
--- a/test/types/with_paging_stub.py
+++ b/test/types/with_paging_stub.py
@@ -8,13 +8,20 @@
Do not edit the class manually.
"""
+import datetime
import json
import warnings
+from typing import (
+ Union,
+ List,
+ Dict,
+ Literal, # >=3.8
+)
from jsf import JSF
from pydantic import TypeAdapter
-from ..openapi import MODEL_DEFINITIONS
+from ..openapi import MODEL_DEFINITIONS, with_example_provider
try:
from waylay.services.registry.models.with_paging import WithPaging
@@ -22,10 +29,10 @@
WithPagingAdapter = TypeAdapter(WithPaging)
MODELS_AVAILABLE = True
except ImportError as exc:
- warnings.warn(f"Type adapter for WithPaging not available: {exc}")
MODELS_AVAILABLE = False
-with_paging_model_schema = json.loads(r"""{
+with_paging_model_schema = json.loads(
+ r"""{
"required" : [ "count" ],
"type" : "object",
"properties" : {
@@ -43,7 +50,9 @@
}
}
}
-""")
+""",
+ object_hook=with_example_provider,
+)
with_paging_model_schema.update({"definitions": MODEL_DEFINITIONS})
with_paging_faker = JSF(with_paging_model_schema, allow_none_optionals=1)
diff --git a/waylay_registry_api/pyproject.toml b/waylay_registry_api/pyproject.toml
index f9bd0b03..71f2881e 100644
--- a/waylay_registry_api/pyproject.toml
+++ b/waylay_registry_api/pyproject.toml
@@ -59,6 +59,8 @@ include = ["pyproject.toml", "src/**/*.py"]
ignore-init-module-imports = true
# allow duplicate imports
ignore=["F811"]
+# https://docs.astral.sh/ruff/rules
+select=["UP007"] # convert Union to | (pep-604)
[tool.ruff.lint.per-file-ignores]
# do not touch imports here
diff --git a/waylay_registry_api/src/waylay/services/registry/api/default_api.py b/waylay_registry_api/src/waylay/services/registry/api/default_api.py
index 3658264a..0666ec9a 100644
--- a/waylay_registry_api/src/waylay/services/registry/api/default_api.py
+++ b/waylay_registry_api/src/waylay/services/registry/api/default_api.py
@@ -9,23 +9,48 @@
"""
from __future__ import annotations # for Python 3.7–3.9
-
-from pydantic import StrictBool, TypeAdapter, ConfigDict
+import io
+import warnings
+
+import enum
+from enum import Enum
+from pydantic import (
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ StrictBool,
+ StrictBytes,
+ ConfigDict,
+ TypeAdapter,
+)
from typing import (
Dict,
+ List,
Literal,
Optional,
+ Tuple,
Union,
Any,
overload,
TYPE_CHECKING,
)
+from typing_extensions import (
+ Annotated, # >=3.9,
+ NotRequired, # >=3.11
+)
from waylay.sdk.plugin import WithApiClient
from waylay.sdk.api import (
+ ApiValueError,
+ Request,
Response,
HeaderTypes,
QueryParamTypes,
+ RequestFiles,
+ RequestData,
+ RequestContent,
)
from waylay.sdk.api._models import Model
@@ -44,19 +69,17 @@
from waylay.services.registry.models import RootPageResponse
- types_available = True
+ MODELS_AVAILABLE = True
except ImportError:
- types_available = False
+ MODELS_AVAILABLE = False
if not TYPE_CHECKING:
GetQuery = dict
RootPageResponse = Model
- RootPageResponse = Model
-
-StringAdapter = TypeAdapter(str, config=ConfigDict(coerce_numbers_to_str=True))
+from waylay.sdk.api import ApiClient, RESTTimeout
class DefaultApi(WithApiClient):
@@ -72,10 +95,10 @@ class DefaultApi(WithApiClient):
async def get(
self,
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> RootPageResponse: ...
@@ -83,23 +106,33 @@ async def get(
async def get(
self,
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def get(
self,
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def get(
+ self,
+ *,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[RootPageResponse, Response, Model]:
+ ) -> RootPageResponse | Response | Model:
"""Version.
Get the version of this function registry deployment.
@@ -126,6 +159,10 @@ 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
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -137,6 +174,10 @@ async def get(
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(GetQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -154,7 +195,7 @@ async def get(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"*": RootPageResponse if not select_path else Model,
}
stream = send_args.get("stream", False)
diff --git a/waylay_registry_api/src/waylay/services/registry/api/jobs_api.py b/waylay_registry_api/src/waylay/services/registry/api/jobs_api.py
index 7f5d7504..b2394720 100644
--- a/waylay_registry_api/src/waylay/services/registry/api/jobs_api.py
+++ b/waylay_registry_api/src/waylay/services/registry/api/jobs_api.py
@@ -9,23 +9,48 @@
"""
from __future__ import annotations # for Python 3.7–3.9
-
-from pydantic import StrictStr, StrictBool, TypeAdapter, ConfigDict
+import io
+import warnings
+
+import enum
+from enum import Enum
+from pydantic import (
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ StrictBool,
+ StrictBytes,
+ ConfigDict,
+ TypeAdapter,
+)
from typing import (
Dict,
+ List,
Literal,
Optional,
+ Tuple,
Union,
Any,
overload,
TYPE_CHECKING,
)
+from typing_extensions import (
+ Annotated, # >=3.9,
+ NotRequired, # >=3.11
+)
from waylay.sdk.plugin import WithApiClient
from waylay.sdk.api import (
+ ApiValueError,
+ Request,
Response,
HeaderTypes,
QueryParamTypes,
+ RequestFiles,
+ RequestData,
+ RequestContent,
)
from waylay.sdk.api._models import Model
@@ -72,33 +97,27 @@
from waylay.services.registry.models import JobsResponse
- types_available = True
+ MODELS_AVAILABLE = True
except ImportError:
- types_available = False
+ MODELS_AVAILABLE = False
if not TYPE_CHECKING:
EventsQuery = dict
EventWithCloseSSE = Model
- EventWithCloseSSE = Model
-
JobType = str
GetQuery = dict
JobResponse = Model
- JobResponse = Model
-
ListQuery = dict
JobsResponse = Model
- JobsResponse = Model
-
-StringAdapter = TypeAdapter(str, config=ConfigDict(coerce_numbers_to_str=True))
+from waylay.sdk.api import ApiClient, RESTTimeout
class JobsApi(WithApiClient):
@@ -114,10 +133,10 @@ class JobsApi(WithApiClient):
async def events(
self,
*,
- query: Optional[Union[EventsQuery, QueryParamTypes]] = None,
+ query: EventsQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> EventWithCloseSSE: ...
@@ -125,33 +144,43 @@ async def events(
async def events(
self,
*,
- query: Optional[Union[EventsQuery, QueryParamTypes]] = None,
+ query: EventsQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def events(
self,
*,
- query: Optional[Union[EventsQuery, QueryParamTypes]] = None,
+ query: EventsQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def events(
+ self,
+ *,
+ query: EventsQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[EventWithCloseSSE, Response, Model]:
+ ) -> EventWithCloseSSE | Response | Model:
"""Stream Events.
Get an SSE stream of all job events for the users tenant. The stream can be filtered on job type or on a specific job id. When filtering on job id, the server will send a close
event upon completion of the job. The client should handle this event by closing the stream.
:param query: URL Query parameters.
:type query: EventsQuery | QueryParamTypes, optional
- :param query['type']: The type of the job.
+ :param query['type'] (dict)
query.type (Query) : The type of the job.
:type query['type']: JobType
- :param query['id']: The id of the job.
+ :param query['id'] (dict)
query.id (Query) : The id of the job.
:type query['id']: str
- :param query['children']: If set to true
, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to false
.
+ :param query['children'] (dict)
query.children (Query) : If set to true
, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to false
.
:type query['children']: 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.
@@ -174,6 +203,10 @@ async def events(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -185,6 +218,10 @@ async def events(
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(EventsQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -202,7 +239,7 @@ async def events(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": EventWithCloseSSE if not select_path else Model,
}
stream = send_args.get("stream", False)
@@ -216,10 +253,10 @@ async def get(
type: JobType,
id: StrictStr,
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> JobResponse: ...
@@ -229,25 +266,37 @@ async def get(
type: JobType,
id: StrictStr,
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def get(
self,
type: JobType,
id: StrictStr,
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def get(
+ self,
+ type: JobType,
+ id: StrictStr,
+ *,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[JobResponse, Response, Model]:
+ ) -> JobResponse | Response | Model:
"""Get Job.
Get a background job by type and id.
@@ -278,6 +327,10 @@ 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
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -285,13 +338,17 @@ async def get(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "type": StringAdapter.validate_python(type),
- "id": StringAdapter.validate_python(id),
+ "type": str(type),
+ "id": str(id),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(GetQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -309,7 +366,7 @@ async def get(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": JobResponse if not select_path else Model,
}
stream = send_args.get("stream", False)
@@ -321,10 +378,10 @@ async def get(
async def list(
self,
*,
- query: Optional[Union[ListQuery, QueryParamTypes]] = None,
+ query: ListQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> JobsResponse: ...
@@ -332,39 +389,49 @@ async def list(
async def list(
self,
*,
- query: Optional[Union[ListQuery, QueryParamTypes]] = None,
+ query: ListQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
+ async def list(
+ self,
+ *,
+ query: ListQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
async def list(
self,
*,
- query: Optional[Union[ListQuery, QueryParamTypes]] = None,
+ query: ListQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[JobsResponse, Response, Model]:
+ ) -> JobsResponse | Response | Model:
"""List Jobs.
List all background jobs for the users tenant.
:param query: URL Query parameters.
:type query: ListQuery | QueryParamTypes, optional
- :param query['limit']: The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.
+ :param query['limit'] (dict)
query.limit (Query) : The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.
:type query['limit']: float
- :param query['type']: Filter on job type
+ :param query['type'] (dict)
query.type (Query) : Filter on job type
:type query['type']: List[JobTypeSchema]
- :param query['state']: Filter on job state
+ :param query['state'] (dict)
query.state (Query) : Filter on job state
:type query['state']: List[JobStateResult]
- :param query['functionType']: Filter on function type
+ :param query['functionType'] (dict)
query.function_type (Query) : Filter on function type
:type query['functionType']: List[FunctionType]
- :param query['createdBefore']: Filter on jobs that created before the given timestamp or age
+ :param query['createdBefore'] (dict)
query.created_before (Query) : Filter on jobs that created before the given timestamp or age
:type query['createdBefore']: TimestampSpec
- :param query['createdAfter']: Filter on jobs that created after the given timestamp or age
+ :param query['createdAfter'] (dict)
query.created_after (Query) : Filter on jobs that created after the given timestamp or age
:type query['createdAfter']: TimestampSpec
: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.
@@ -387,6 +454,10 @@ 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
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -398,6 +469,10 @@ async def list(
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(ListQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -415,7 +490,7 @@ async def list(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": JobsResponse if not select_path else Model,
}
stream = send_args.get("stream", False)
diff --git a/waylay_registry_api/src/waylay/services/registry/api/model_functions_api.py b/waylay_registry_api/src/waylay/services/registry/api/model_functions_api.py
index 9ddf2a94..cac1a1e4 100644
--- a/waylay_registry_api/src/waylay/services/registry/api/model_functions_api.py
+++ b/waylay_registry_api/src/waylay/services/registry/api/model_functions_api.py
@@ -9,12 +9,28 @@
"""
from __future__ import annotations # for Python 3.7–3.9
-
-from pydantic import Field, StrictStr, StrictBool, TypeAdapter, ConfigDict
+import io
+import warnings
+
+import enum
+from enum import Enum
+from pydantic import (
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ StrictBool,
+ StrictBytes,
+ ConfigDict,
+ TypeAdapter,
+)
from typing import (
Dict,
+ List,
Literal,
Optional,
+ Tuple,
Union,
Any,
overload,
@@ -22,14 +38,18 @@
)
from typing_extensions import (
Annotated, # >=3.9,
+ NotRequired, # >=3.11
)
from waylay.sdk.plugin import WithApiClient
from waylay.sdk.api import (
+ ApiValueError,
+ Request,
Response,
HeaderTypes,
QueryParamTypes,
RequestFiles,
+ RequestData,
RequestContent,
)
from waylay.sdk.api._models import Model
@@ -42,6 +62,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import DeleteAssetQuery
@@ -49,6 +70,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import GetArchiveQuery
@@ -98,6 +120,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import RebuildQuery
@@ -105,6 +128,7 @@
from waylay.services.registry.models import RebuildModelSyncResponseV2
from waylay.services.registry.models import RebuildModelSyncResponseV2
+
from waylay.services.registry.models import RebuildModelAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import RemoveVersionQuery
@@ -112,6 +136,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.queries.model_functions_api import RemoveVersionsQuery
@@ -119,6 +144,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.models import FileUpload
@@ -128,6 +154,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.models import MultipartFileUpload
@@ -137,6 +164,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import VerifyQuery
@@ -144,6 +172,7 @@
from waylay.services.registry.models import VerifyModelSyncResponseV2
from waylay.services.registry.models import VerifyModelSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
@@ -155,6 +184,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import DeleteAssetQuery
@@ -162,6 +192,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import GetArchiveQuery
@@ -211,6 +242,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import RebuildQuery
@@ -218,6 +250,7 @@
from waylay.services.registry.models import RebuildModelSyncResponseV2
from waylay.services.registry.models import RebuildModelSyncResponseV2
+
from waylay.services.registry.models import RebuildModelAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import RemoveVersionQuery
@@ -225,6 +258,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.queries.model_functions_api import RemoveVersionsQuery
@@ -232,6 +266,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.models import FileUpload
@@ -241,6 +276,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.models import MultipartFileUpload
@@ -250,6 +286,7 @@
from waylay.services.registry.models import PostModelJobSyncResponseV2
from waylay.services.registry.models import PostModelJobSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
from waylay.services.registry.queries.model_functions_api import VerifyQuery
@@ -257,11 +294,12 @@
from waylay.services.registry.models import VerifyModelSyncResponseV2
from waylay.services.registry.models import VerifyModelSyncResponseV2
+
from waylay.services.registry.models import PostModelJobAsyncResponseV2
- types_available = True
+ MODELS_AVAILABLE = True
except ImportError:
- types_available = False
+ MODELS_AVAILABLE = False
if not TYPE_CHECKING:
MultipartFileUpload = Model
@@ -270,14 +308,12 @@
PostModelJobSyncResponseV2 = Model
- PostModelJobSyncResponseV2 = Model
PostModelJobAsyncResponseV2 = Model
DeleteAssetQuery = dict
PostModelJobSyncResponseV2 = Model
- PostModelJobSyncResponseV2 = Model
PostModelJobAsyncResponseV2 = Model
GetArchiveQuery = dict
@@ -288,66 +324,50 @@
GetModelResponseV2 = Model
- GetModelResponseV2 = Model
-
GetQuery = dict
GetModelResponseV2 = Model
- GetModelResponseV2 = Model
-
JobsQuery = dict
JobsForModelResponseV2 = Model
- JobsForModelResponseV2 = Model
-
ListQuery = dict
LatestModelsResponseV2 = Model
- LatestModelsResponseV2 = Model
-
ListVersionsQuery = dict
ModelVersionsResponseV2 = Model
- ModelVersionsResponseV2 = Model
-
FunctionMeta = Model
PatchMetadataQuery = dict
GetModelResponseV2 = Model
- GetModelResponseV2 = Model
-
PublishQuery = dict
PostModelJobSyncResponseV2 = Model
- PostModelJobSyncResponseV2 = Model
PostModelJobAsyncResponseV2 = Model
RebuildQuery = dict
RebuildModelSyncResponseV2 = Model
- RebuildModelSyncResponseV2 = Model
RebuildModelAsyncResponseV2 = Model
RemoveVersionQuery = dict
UndeployedResponseV2 = Model
- UndeployedResponseV2 = Model
UndeploySubmittedResponseV2 = Model
RemoveVersionsQuery = dict
UndeployedResponseV2 = Model
- UndeployedResponseV2 = Model
UndeploySubmittedResponseV2 = Model
FileUpload = Model
@@ -356,7 +376,6 @@
PostModelJobSyncResponseV2 = Model
- PostModelJobSyncResponseV2 = Model
PostModelJobAsyncResponseV2 = Model
MultipartFileUpload = Model
@@ -365,18 +384,16 @@
PostModelJobSyncResponseV2 = Model
- PostModelJobSyncResponseV2 = Model
PostModelJobAsyncResponseV2 = Model
VerifyQuery = dict
VerifyModelSyncResponseV2 = Model
- VerifyModelSyncResponseV2 = Model
PostModelJobAsyncResponseV2 = Model
-StringAdapter = TypeAdapter(str, config=ConfigDict(coerce_numbers_to_str=True))
+from waylay.sdk.api import ApiClient, RESTTimeout
class ModelFunctionsApi(WithApiClient):
@@ -393,60 +410,79 @@ async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a model function can be provided as either
application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestmodel.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=kfserving
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostModelJobSyncResponseV2: ...
+ ) -> PostModelJobSyncResponseV2 | PostModelJobAsyncResponseV2: ...
@overload
async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestmodel.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=kfserving
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestmodel.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=kfserving
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def create(
+ self,
+ *,
+ content: Annotated[
+ RequestContent | None,
+ Field(
+ description="The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestmodel.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=kfserving
). For each runtime other files will be required or supported. "
+ ),
+ ] = None,
+ files: Annotated[
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostModelJobSyncResponseV2, Response, Model]:
+ ) -> PostModelJobSyncResponseV2 | PostModelJobAsyncResponseV2 | Response | Model:
"""Create Model.
Creates a new model function by uploading its assets. The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestmodel.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=kfserving
). For each runtime other files will be required or supported.
@@ -456,19 +492,19 @@ async def create(
:type files: FilesRequest, optional
:param query: URL Query parameters.
:type query: CreateQuery | QueryParamTypes, optional
- :param query['deprecatePrevious']: Set the cleanup policy used to automatically deprecate/delete previous versions.
+ :param query['deprecatePrevious'] (dict) true
, validates the deployment conditions, but does not change anything.
+ :param query['dryRun'] (dict) true
, validates the deployment conditions, but does not change anything.
:type query['dryRun']: bool
- :param query['async']: Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['scaleToZero']: If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.
+ :param query['scaleToZero'] (dict) true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.
:type query['scaleToZero']: bool
- :param query['version']: If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest.
+ :param query['version'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) includeDeprecated
or includeDraft
to change this behaviour: includeDeprecated=true
: do not prefer non-deprecated versions as a latest version: if the latest version is a deprecated one, it will be shown, even if there are older non-deprecated versions.includeDraft=true
: do not prefer non-draft versions as a latest version: if the latest version is a draft, it will be shown, even if there are older non-draft versions.includeDeprecated
or includeDraft
to change this behaviour: includeDeprecated=true
: do not prefer non-deprecated versions as a latest version: if the latest version is a deprecated one, it will be shown, even if there are older non-deprecated versions.includeDraft=true
: do not prefer non-draft versions as a latest version: if the latest version is a draft, it will be shown, even if there are older non-draft versions.running
status, such that publishing becomes a simple operation where the existing deployment can be re-used. In other statuses, plug-registry may need to initiate a new build and deployment procedure.
@@ -1704,11 +1966,11 @@ async def publish(
:type version: str
:param query: URL Query parameters.
:type query: PublishQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: 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.
@@ -1731,6 +1993,10 @@ async def publish(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -1738,13 +2004,17 @@ async def publish(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "name": StringAdapter.validate_python(name),
- "version": StringAdapter.validate_python(version),
+ "name": str(name),
+ "version": str(version),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(PublishQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="POST",
@@ -1762,7 +2032,7 @@ async def publish(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"201": PostModelJobSyncResponseV2 if not select_path else Model,
"202": PostModelJobAsyncResponseV2 if not select_path else Model,
}
@@ -1779,12 +2049,12 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> RebuildModelSyncResponseV2: ...
+ ) -> RebuildModelSyncResponseV2 | RebuildModelAsyncResponseV2: ...
@overload
async def rebuild(
@@ -1794,14 +2064,14 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def rebuild(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -1809,12 +2079,26 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def rebuild(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ *,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[RebuildModelSyncResponseV2, Response, Model]:
+ ) -> RebuildModelSyncResponseV2 | RebuildModelAsyncResponseV2 | Response | Model:
"""Rebuild Model.
Rebuild and deploy a model with the original or updated base image.
@@ -1824,21 +2108,21 @@ async def rebuild(
:type version: str
:param query: URL Query parameters.
:type query: RebuildQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) true
, checks whether rebuild jobs are needed, but do not start any jobs.
+ :param query['dryRun'] (dict) true
, checks whether rebuild jobs are needed, but do not start any jobs.
:type query['dryRun']: bool
- :param query['async']: Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['upgrade']: If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['force']: If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
+ :param query['force'] (dict) true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
:type query['force']: bool
- :param query['undeploy']: If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.
+ :param query['undeploy'] (dict) true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
+ :param query['force'] (dict) true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
:type query['force']: bool
- :param query['undeploy']: If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.
+ :param query['undeploy'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: 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.
@@ -2094,6 +2419,10 @@ async def remove_versions(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -2101,12 +2430,16 @@ async def remove_versions(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "name": StringAdapter.validate_python(name),
+ "name": str(name),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(RemoveVersionsQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="DELETE",
@@ -2124,7 +2457,7 @@ async def remove_versions(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": UndeployedResponseV2 if not select_path else Model,
"202": UndeploySubmittedResponseV2 if not select_path else Model,
}
@@ -2148,14 +2481,14 @@ async def update_asset(
],
*,
content: Annotated[
- Optional[RequestContent], Field(description="A single asset file.")
+ RequestContent | None, Field(description="A single asset file.")
] = None,
- query: Optional[Union[UpdateAssetQuery, QueryParamTypes]] = None,
+ query: UpdateAssetQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostModelJobSyncResponseV2: ...
+ ) -> PostModelJobSyncResponseV2 | PostModelJobAsyncResponseV2: ...
@overload
async def update_asset(
@@ -2172,16 +2505,16 @@ async def update_asset(
],
*,
content: Annotated[
- Optional[RequestContent], Field(description="A single asset file.")
+ RequestContent | None, Field(description="A single asset file.")
] = None,
- query: Optional[Union[UpdateAssetQuery, QueryParamTypes]] = None,
+ query: UpdateAssetQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def update_asset(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -2196,14 +2529,37 @@ async def update_asset(
],
*,
content: Annotated[
- Optional[RequestContent], Field(description="A single asset file.")
+ RequestContent | None, Field(description="A single asset file.")
] = None,
- query: Optional[Union[UpdateAssetQuery, QueryParamTypes]] = None,
+ query: UpdateAssetQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def update_asset(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ wildcard: Annotated[
+ StrictStr,
+ Field(
+ description="Full path or path prefix of the asset within the archive"
+ ),
+ ],
+ *,
+ content: Annotated[
+ RequestContent | None, Field(description="A single asset file.")
+ ] = None,
+ query: UpdateAssetQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostModelJobSyncResponseV2, Response, Model]:
+ ) -> PostModelJobSyncResponseV2 | PostModelJobAsyncResponseV2 | Response | Model:
"""Update Model Asset.
The provided asset will be added to the model function's collection of existing assets, replacing any existing asset with the same name. Please note that it is not allowed to update the model.json json file with a changed value for any of the name
, version
and/or runtime
attributes. For each runtime other files are supported.
@@ -2217,11 +2573,11 @@ async def update_asset(
:type content: ContentRequest, optional
:param query: URL Query parameters.
:type query: UpdateAssetQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostModelJobSyncResponseV2: ...
+ ) -> PostModelJobSyncResponseV2 | PostModelJobAsyncResponseV2: ...
@overload
async def update_assets(
@@ -2319,22 +2683,22 @@ async def update_assets(
],
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def update_assets(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -2343,20 +2707,43 @@ async def update_assets(
],
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def update_assets(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ *,
+ content: Annotated[
+ RequestContent | None,
+ Field(
+ description="The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
+ ),
+ ] = None,
+ files: Annotated[
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostModelJobSyncResponseV2, Response, Model]:
+ ) -> PostModelJobSyncResponseV2 | PostModelJobAsyncResponseV2 | Response | Model:
"""Update Model Assets.
Update a draft model function by updating its assets. The assets for a model function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported.
@@ -2370,11 +2757,11 @@ async def update_assets(
:type files: FilesRequest, optional
:param query: URL Query parameters.
:type query: UpdateAssetsQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['scaleToZero']: Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command.
+ :param query['scaleToZero'] (dict) application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestplug.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=plugs
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostPlugJobSyncResponseV2: ...
+ ) -> PostPlugJobSyncResponseV2 | PostPlugJobAsyncResponseV2: ...
@overload
async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestplug.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=plugs
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
+ async def create(
+ self,
+ *,
+ content: Annotated[
+ RequestContent | None,
+ Field(
+ description="The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestplug.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=plugs
). For each runtime other files will be required or supported. "
+ ),
+ ] = None,
+ files: Annotated[
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestplug.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=plugs
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostPlugJobSyncResponseV2, Response, Model]:
+ ) -> PostPlugJobSyncResponseV2 | PostPlugJobAsyncResponseV2 | Response | Model:
"""Create Plug.
Creates a new plug function by uploading its assets. The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestplug.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=plugs
). For each runtime other files will be required or supported.
@@ -480,19 +514,19 @@ async def create(
:type files: FilesRequest, optional
:param query: URL Query parameters.
:type query: CreateQuery | QueryParamTypes, optional
- :param query['deprecatePrevious']: Set the cleanup policy used to automatically deprecate/delete previous versions.
+ :param query['deprecatePrevious'] (dict) true
, validates the deployment conditions, but does not change anything.
+ :param query['dryRun'] (dict) true
, validates the deployment conditions, but does not change anything.
:type query['dryRun']: bool
- :param query['async']: Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['scaleToZero']: If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.
+ :param query['scaleToZero'] (dict) true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.
:type query['scaleToZero']: bool
- :param query['version']: If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest.
+ :param query['version'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) includeDeprecated
or includeDraft
to change this behaviour: includeDeprecated=true
: do not prefer non-deprecated versions as a latest version: if the latest version is a deprecated one, it will be shown, even if there are older non-deprecated versions.includeDraft=true
: do not prefer non-draft versions as a latest version: if the latest version is a draft, it will be shown, even if there are older non-draft versions.includeDeprecated
or includeDraft
to change this behaviour: includeDeprecated=true
: do not prefer non-deprecated versions as a latest version: if the latest version is a deprecated one, it will be shown, even if there are older non-deprecated versions.includeDraft=true
: do not prefer non-draft versions as a latest version: if the latest version is a draft, it will be shown, even if there are older non-draft versions.running
status, such that publishing becomes a simple operation where the existing deployment can be re-used. In other statuses, plug-registry may need to initiate a new build and deployment procedure.
@@ -1857,11 +2143,11 @@ async def publish(
:type version: str
:param query: URL Query parameters.
:type query: PublishQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: 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.
@@ -1884,6 +2170,10 @@ async def publish(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -1891,13 +2181,17 @@ async def publish(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "name": StringAdapter.validate_python(name),
- "version": StringAdapter.validate_python(version),
+ "name": str(name),
+ "version": str(version),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(PublishQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="POST",
@@ -1915,7 +2209,7 @@ async def publish(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"201": PostPlugJobSyncResponseV2 if not select_path else Model,
"202": PostPlugJobAsyncResponseV2 if not select_path else Model,
}
@@ -1932,12 +2226,12 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> RebuildPlugSyncResponseV2: ...
+ ) -> RebuildPlugSyncResponseV2 | RebuildPlugAsyncResponseV2: ...
@overload
async def rebuild(
@@ -1947,14 +2241,14 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def rebuild(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -1962,12 +2256,26 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def rebuild(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ *,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[RebuildPlugSyncResponseV2, Response, Model]:
+ ) -> RebuildPlugSyncResponseV2 | RebuildPlugAsyncResponseV2 | Response | Model:
"""Rebuild Plug.
Rebuild and deploy a plug with the original or updated base image.
@@ -1977,21 +2285,21 @@ async def rebuild(
:type version: str
:param query: URL Query parameters.
:type query: RebuildQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) true
, checks whether rebuild jobs are needed, but do not start any jobs.
+ :param query['dryRun'] (dict) true
, checks whether rebuild jobs are needed, but do not start any jobs.
:type query['dryRun']: bool
- :param query['async']: Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['upgrade']: If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['force']: If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.
+ :param query['force'] (dict) true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.
:type query['force']: bool
- :param query['undeploy']: If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.
+ :param query['undeploy'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['force']: If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.
+ :param query['force'] (dict) true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.
:type query['force']: bool
- :param query['undeploy']: If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.
+ :param query['undeploy'] (dict) name
, version
and/or runtime
attributes. For each runtime other files are supported.
@@ -2370,11 +2750,11 @@ async def update_asset(
:type content: ContentRequest, optional
:param query: URL Query parameters.
:type query: UpdateAssetQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostPlugJobSyncResponseV2: ...
+ ) -> PostPlugJobSyncResponseV2 | PostPlugJobAsyncResponseV2: ...
@overload
async def update_assets(
@@ -2472,22 +2860,22 @@ async def update_assets(
],
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def update_assets(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -2496,20 +2884,43 @@ async def update_assets(
],
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def update_assets(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ *,
+ content: Annotated[
+ RequestContent | None,
+ Field(
+ description="The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
+ ),
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ files: Annotated[
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostPlugJobSyncResponseV2, Response, Model]:
+ ) -> PostPlugJobSyncResponseV2 | PostPlugJobAsyncResponseV2 | Response | Model:
"""Update Plug Assets.
Update a draft plug function by updating its assets. The assets for a plug function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported.
@@ -2523,11 +2934,11 @@ async def update_assets(
:type files: FilesRequest, optional
:param query: URL Query parameters.
:type query: UpdateAssetsQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['scaleToZero']: Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command.
+ :param query['scaleToZero'] (dict) version
of a runtime. Supports [version ranges](https://devhints.io/semver).
+ :param query['version'] (dict) version
of a runtime. Supports [version ranges](https://devhints.io/semver).
:type query['version']: SemanticVersionRange
- :param query['includeDeprecated']: If set to `true`, deprecated runtimes will be included in the query.
+ :param query['includeDeprecated'] (dict) functionType
of a runtime. Uses an exact match.
+ :param query['functionType'] (dict) functionType
of a runtime. Uses an exact match.
:type query['functionType']: List[FunctionType]
- :param query['archiveFormat']: If set, filters on the archiveFormat
of a runtime. Uses an exact match.
+ :param query['archiveFormat'] (dict) archiveFormat
of a runtime. Uses an exact match.
:type query['archiveFormat']: List[ArchiveFormat]
: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.
@@ -481,6 +556,10 @@ async def get_latest(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -488,12 +567,16 @@ async def get_latest(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "name": StringAdapter.validate_python(name),
+ "name": str(name),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(GetLatestQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -511,7 +594,7 @@ async def get_latest(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": RuntimeVersionResponse if not select_path else Model,
}
stream = send_args.get("stream", False)
@@ -527,10 +610,10 @@ async def get(
Any, Field(description="A version range for a runtime")
],
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> RuntimeVersionResponse: ...
@@ -542,14 +625,14 @@ async def get(
Any, Field(description="A version range for a runtime")
],
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def get(
self,
name: Annotated[StrictStr, Field(description="The name of a runtime")],
@@ -557,12 +640,26 @@ async def get(
Any, Field(description="A version range for a runtime")
],
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def get(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of a runtime")],
+ version: Annotated[
+ Any, Field(description="A version range for a runtime")
+ ],
+ *,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[RuntimeVersionResponse, Response, Model]:
+ ) -> RuntimeVersionResponse | Response | Model:
"""Get Runtime Version.
Get a representation of the default runtime version by name.
@@ -572,7 +669,7 @@ async def get(
:type version: SemanticVersionRange
:param query: URL Query parameters.
:type query: GetQuery | QueryParamTypes, optional
- :param query['includeDeprecated']: If set to `true`, deprecated runtimes will be included in the query.
+ :param query['includeDeprecated'] (dict) version
of a runtime. Supports [version ranges](https://devhints.io/semver).
+ :param query['version'] (dict) version
of a runtime. Supports [version ranges](https://devhints.io/semver).
:type query['version']: SemanticVersionRange
- :param query['latest']: If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria.
+ :param query['latest'] (dict) name
of a runtime. Supports *
and ?
wildcards and is case-insensitive.
+ :param query['name'] (dict) name
of a runtime. Supports *
and ?
wildcards and is case-insensitive.
:type query['name']: str
- :param query['functionType']: If set, filters on the functionType
of a runtime. Uses an exact match.
+ :param query['functionType'] (dict) functionType
of a runtime. Uses an exact match.
:type query['functionType']: List[FunctionType]
- :param query['archiveFormat']: If set, filters on the archiveFormat
of a runtime. Uses an exact match.
+ :param query['archiveFormat'] (dict) archiveFormat
of a runtime. Uses an exact match.
:type query['archiveFormat']: List[ArchiveFormat]
: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.
@@ -704,6 +819,10 @@ 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
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -715,6 +834,10 @@ async def list(
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(ListQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -732,7 +855,7 @@ async def list(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": RuntimeSummaryResponse if not select_path else Model,
}
stream = send_args.get("stream", False)
@@ -745,10 +868,10 @@ async def list_versions(
self,
name: Annotated[StrictStr, Field(description="The name of a runtime")],
*,
- query: Optional[Union[ListVersionsQuery, QueryParamTypes]] = None,
+ query: ListVersionsQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> RuntimeSummaryResponse: ...
@@ -757,24 +880,35 @@ async def list_versions(
self,
name: Annotated[StrictStr, Field(description="The name of a runtime")],
*,
- query: Optional[Union[ListVersionsQuery, QueryParamTypes]] = None,
+ query: ListVersionsQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def list_versions(
self,
name: Annotated[StrictStr, Field(description="The name of a runtime")],
*,
- query: Optional[Union[ListVersionsQuery, QueryParamTypes]] = None,
+ query: ListVersionsQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def list_versions(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of a runtime")],
+ *,
+ query: ListVersionsQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[RuntimeSummaryResponse, Response, Model]:
+ ) -> RuntimeSummaryResponse | Response | Model:
"""List Runtime Versions.
List the supported versions of a specific runtime.
@@ -782,15 +916,15 @@ async def list_versions(
:type name: str
:param query: URL Query parameters.
:type query: ListVersionsQuery | QueryParamTypes, optional
- :param query['version']: If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver).
+ :param query['version'] (dict) version
of a runtime. Supports [version ranges](https://devhints.io/semver).
:type query['version']: SemanticVersionRange
- :param query['latest']: If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria.
+ :param query['latest'] (dict) functionType
of a runtime. Uses an exact match.
+ :param query['functionType'] (dict) functionType
of a runtime. Uses an exact match.
:type query['functionType']: List[FunctionType]
- :param query['archiveFormat']: If set, filters on the archiveFormat
of a runtime. Uses an exact match.
+ :param query['archiveFormat'] (dict) archiveFormat
of a runtime. Uses an exact match.
:type query['archiveFormat']: List[ArchiveFormat]
: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.
@@ -813,6 +947,10 @@ async def list_versions(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -820,12 +958,16 @@ async def list_versions(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "name": StringAdapter.validate_python(name),
+ "name": str(name),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(ListVersionsQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -843,7 +985,7 @@ async def list_versions(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": RuntimeSummaryResponse if not select_path else Model,
}
stream = send_args.get("stream", False)
diff --git a/waylay_registry_api/src/waylay/services/registry/api/schemas_api.py b/waylay_registry_api/src/waylay/services/registry/api/schemas_api.py
index abc2b47f..f0484bd2 100644
--- a/waylay_registry_api/src/waylay/services/registry/api/schemas_api.py
+++ b/waylay_registry_api/src/waylay/services/registry/api/schemas_api.py
@@ -9,13 +9,28 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
import warnings
-from pydantic import Field, StrictStr, StrictBool, TypeAdapter, ConfigDict
+import enum
+from enum import Enum
+from pydantic import (
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ StrictBool,
+ StrictBytes,
+ ConfigDict,
+ TypeAdapter,
+)
from typing import (
Dict,
+ List,
Literal,
Optional,
+ Tuple,
Union,
Any,
overload,
@@ -23,13 +38,19 @@
)
from typing_extensions import (
Annotated, # >=3.9,
+ NotRequired, # >=3.11
)
from waylay.sdk.plugin import WithApiClient
from waylay.sdk.api import (
+ ApiValueError,
+ Request,
Response,
HeaderTypes,
QueryParamTypes,
+ RequestFiles,
+ RequestData,
+ RequestContent,
)
from waylay.sdk.api._models import Model
@@ -52,9 +73,9 @@
from waylay.services.registry.queries.schemas_api import GetQuery
- types_available = True
+ MODELS_AVAILABLE = True
except ImportError:
- types_available = False
+ MODELS_AVAILABLE = False
if not TYPE_CHECKING:
FunctionType = str
@@ -66,7 +87,7 @@
GetQuery = dict
-StringAdapter = TypeAdapter(str, config=ConfigDict(coerce_numbers_to_str=True))
+from waylay.sdk.api import ApiClient, RESTTimeout
class SchemasApi(WithApiClient):
@@ -84,10 +105,10 @@ async def get_by_role(
function_type: Annotated[FunctionType, Field(description="Function type")],
role: Annotated[AssetRole, Field(description="Asset role")],
*,
- query: Optional[Union[GetByRoleQuery, QueryParamTypes]] = None,
+ query: GetByRoleQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Dict[str, object]: ...
@@ -97,25 +118,37 @@ async def get_by_role(
function_type: Annotated[FunctionType, Field(description="Function type")],
role: Annotated[AssetRole, Field(description="Asset role")],
*,
- query: Optional[Union[GetByRoleQuery, QueryParamTypes]] = None,
+ query: GetByRoleQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
+ async def get_by_role(
+ self,
+ function_type: Annotated[FunctionType, Field(description="Function type")],
+ role: Annotated[AssetRole, Field(description="Asset role")],
+ *,
+ query: GetByRoleQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
async def get_by_role(
self,
function_type: Annotated[FunctionType, Field(description="Function type")],
role: Annotated[AssetRole, Field(description="Asset role")],
*,
- query: Optional[Union[GetByRoleQuery, QueryParamTypes]] = None,
+ query: GetByRoleQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[Dict[str, object], Response, Model]:
+ ) -> Dict[str, object] | Response | Model:
"""Get Asset Schema (Deprecated).
Get the JSON schema that is used to validate the asset.
@@ -150,6 +183,10 @@ async def get_by_role(
"GET /registry/v2/schemas/{functionType}/{role}/schema is deprecated.",
DeprecationWarning,
)
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -157,13 +194,17 @@ async def get_by_role(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "functionType": StringAdapter.validate_python(function_type),
- "role": StringAdapter.validate_python(role),
+ "functionType": str(function_type),
+ "role": str(role),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(GetByRoleQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -181,7 +222,7 @@ async def get_by_role(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": Dict[str, object] if not select_path else Model,
}
stream = send_args.get("stream", False)
@@ -194,10 +235,10 @@ async def get(
self,
schema_id: Annotated[StrictStr, Field(description="Schema id")],
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Dict[str, object]: ...
@@ -206,24 +247,35 @@ async def get(
self,
schema_id: Annotated[StrictStr, Field(description="Schema id")],
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
+ async def get(
+ self,
+ schema_id: Annotated[StrictStr, Field(description="Schema id")],
+ *,
+ query: GetQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
async def get(
self,
schema_id: Annotated[StrictStr, Field(description="Schema id")],
*,
- query: Optional[Union[GetQuery, QueryParamTypes]] = None,
+ query: GetQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[Dict[str, object], Response, Model]:
+ ) -> Dict[str, object] | Response | Model:
"""Get Asset Schema.
Get the JSON schema that is used to validate an asset.
@@ -252,6 +304,10 @@ 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
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -259,12 +315,16 @@ async def get(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "schemaId": StringAdapter.validate_python(schema_id),
+ "schemaId": str(schema_id),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(GetQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="GET",
@@ -282,7 +342,7 @@ async def get(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"200": Dict[str, object] if not select_path else Model,
}
stream = send_args.get("stream", False)
diff --git a/waylay_registry_api/src/waylay/services/registry/api/webscript_functions_api.py b/waylay_registry_api/src/waylay/services/registry/api/webscript_functions_api.py
index e9d3a444..c7be695a 100644
--- a/waylay_registry_api/src/waylay/services/registry/api/webscript_functions_api.py
+++ b/waylay_registry_api/src/waylay/services/registry/api/webscript_functions_api.py
@@ -9,12 +9,28 @@
"""
from __future__ import annotations # for Python 3.7–3.9
-
-from pydantic import Field, StrictStr, StrictBool, TypeAdapter, ConfigDict
+import io
+import warnings
+
+import enum
+from enum import Enum
+from pydantic import (
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ StrictBool,
+ StrictBytes,
+ ConfigDict,
+ TypeAdapter,
+)
from typing import (
Dict,
+ List,
Literal,
Optional,
+ Tuple,
Union,
Any,
overload,
@@ -22,14 +38,18 @@
)
from typing_extensions import (
Annotated, # >=3.9,
+ NotRequired, # >=3.11
)
from waylay.sdk.plugin import WithApiClient
from waylay.sdk.api import (
+ ApiValueError,
+ Request,
Response,
HeaderTypes,
QueryParamTypes,
RequestFiles,
+ RequestData,
RequestContent,
)
from waylay.sdk.api._models import Model
@@ -42,6 +62,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import (
@@ -51,6 +72,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import GetArchiveQuery
@@ -104,6 +126,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import RebuildQuery
@@ -111,6 +134,7 @@
from waylay.services.registry.models import RebuildWebscriptSyncResponseV2
from waylay.services.registry.models import RebuildWebscriptSyncResponseV2
+
from waylay.services.registry.models import RebuildWebscriptAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import (
@@ -120,6 +144,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.queries.webscript_functions_api import (
@@ -129,6 +154,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.models import FileUpload
@@ -140,6 +166,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.models import MultipartFileUpload
@@ -151,6 +178,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import VerifyQuery
@@ -158,6 +186,7 @@
from waylay.services.registry.models import VerifyWebscriptSyncResponseV2
from waylay.services.registry.models import VerifyWebscriptSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
@@ -169,6 +198,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import (
@@ -178,6 +208,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import GetArchiveQuery
@@ -231,6 +262,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import RebuildQuery
@@ -238,6 +270,7 @@
from waylay.services.registry.models import RebuildWebscriptSyncResponseV2
from waylay.services.registry.models import RebuildWebscriptSyncResponseV2
+
from waylay.services.registry.models import RebuildWebscriptAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import (
@@ -247,6 +280,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.queries.webscript_functions_api import (
@@ -256,6 +290,7 @@
from waylay.services.registry.models import UndeployedResponseV2
from waylay.services.registry.models import UndeployedResponseV2
+
from waylay.services.registry.models import UndeploySubmittedResponseV2
from waylay.services.registry.models import FileUpload
@@ -267,6 +302,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.models import MultipartFileUpload
@@ -278,6 +314,7 @@
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
from waylay.services.registry.models import PostWebscriptJobSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
from waylay.services.registry.queries.webscript_functions_api import VerifyQuery
@@ -285,11 +322,12 @@
from waylay.services.registry.models import VerifyWebscriptSyncResponseV2
from waylay.services.registry.models import VerifyWebscriptSyncResponseV2
+
from waylay.services.registry.models import PostWebscriptJobAsyncResponseV2
- types_available = True
+ MODELS_AVAILABLE = True
except ImportError:
- types_available = False
+ MODELS_AVAILABLE = False
if not TYPE_CHECKING:
MultipartFileUpload = Model
@@ -298,14 +336,12 @@
PostWebscriptJobSyncResponseV2 = Model
- PostWebscriptJobSyncResponseV2 = Model
PostWebscriptJobAsyncResponseV2 = Model
DeleteAssetQuery = dict
PostWebscriptJobSyncResponseV2 = Model
- PostWebscriptJobSyncResponseV2 = Model
PostWebscriptJobAsyncResponseV2 = Model
GetArchiveQuery = dict
@@ -316,66 +352,50 @@
GetWebscriptResponseV2 = Model
- GetWebscriptResponseV2 = Model
-
GetQuery = dict
GetWebscriptResponseV2 = Model
- GetWebscriptResponseV2 = Model
-
JobsQuery = dict
JobsForWebscriptResponseV2 = Model
- JobsForWebscriptResponseV2 = Model
-
ListVersionsQuery = dict
WebscriptVersionsResponseV2 = Model
- WebscriptVersionsResponseV2 = Model
-
ListQuery = dict
LatestWebscriptsResponseV2 = Model
- LatestWebscriptsResponseV2 = Model
-
FunctionMeta = Model
PatchMetadataQuery = dict
GetWebscriptResponseV2 = Model
- GetWebscriptResponseV2 = Model
-
PublishQuery = dict
PostWebscriptJobSyncResponseV2 = Model
- PostWebscriptJobSyncResponseV2 = Model
PostWebscriptJobAsyncResponseV2 = Model
RebuildQuery = dict
RebuildWebscriptSyncResponseV2 = Model
- RebuildWebscriptSyncResponseV2 = Model
RebuildWebscriptAsyncResponseV2 = Model
RemoveVersionQuery = dict
UndeployedResponseV2 = Model
- UndeployedResponseV2 = Model
UndeploySubmittedResponseV2 = Model
RemoveVersionsQuery = dict
UndeployedResponseV2 = Model
- UndeployedResponseV2 = Model
UndeploySubmittedResponseV2 = Model
FileUpload = Model
@@ -384,7 +404,6 @@
PostWebscriptJobSyncResponseV2 = Model
- PostWebscriptJobSyncResponseV2 = Model
PostWebscriptJobAsyncResponseV2 = Model
MultipartFileUpload = Model
@@ -393,18 +412,16 @@
PostWebscriptJobSyncResponseV2 = Model
- PostWebscriptJobSyncResponseV2 = Model
PostWebscriptJobAsyncResponseV2 = Model
VerifyQuery = dict
VerifyWebscriptSyncResponseV2 = Model
- VerifyWebscriptSyncResponseV2 = Model
PostWebscriptJobAsyncResponseV2 = Model
-StringAdapter = TypeAdapter(str, config=ConfigDict(coerce_numbers_to_str=True))
+from waylay.sdk.api import ApiClient, RESTTimeout
class WebscriptFunctionsApi(WithApiClient):
@@ -421,60 +438,84 @@ async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestwebscript.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=webscripts
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostWebscriptJobSyncResponseV2: ...
+ ) -> PostWebscriptJobSyncResponseV2 | PostWebscriptJobAsyncResponseV2: ...
@overload
async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestwebscript.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=webscripts
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def create(
self,
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestwebscript.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=webscripts
). For each runtime other files will be required or supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[CreateQuery, QueryParamTypes]] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def create(
+ self,
+ *,
+ content: Annotated[
+ RequestContent | None,
+ Field(
+ description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestwebscript.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=webscripts
). For each runtime other files will be required or supported. "
+ ),
+ ] = None,
+ files: Annotated[
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: CreateQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostWebscriptJobSyncResponseV2, Response, Model]:
+ ) -> (
+ PostWebscriptJobSyncResponseV2
+ | PostWebscriptJobAsyncResponseV2
+ | Response
+ | Model
+ ):
"""Create Webscript Version.
Creates a new webscript function by uploading its assets. The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestwebscript.json
json file contains the function metadata, and must have a runtime
attribute that is one of the supported runtimes (see GET /registry/v2/runtimes?functionType=webscripts
). For each runtime other files will be required or supported.
@@ -484,19 +525,19 @@ async def create(
:type files: FilesRequest, optional
:param query: URL Query parameters.
:type query: CreateQuery | QueryParamTypes, optional
- :param query['deprecatePrevious']: Set the cleanup policy used to automatically deprecate/delete previous versions.
+ :param query['deprecatePrevious'] (dict) true
, validates the deployment conditions, but does not change anything.
+ :param query['dryRun'] (dict) true
, validates the deployment conditions, but does not change anything.
:type query['dryRun']: bool
- :param query['async']: Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['scaleToZero']: If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.
+ :param query['scaleToZero'] (dict) true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.
:type query['scaleToZero']: bool
- :param query['version']: If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest.
+ :param query['version'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) includeDeprecated
or includeDraft
to change this behaviour: includeDeprecated=true
: do not prefer non-deprecated versions as a latest version: if the latest version is a deprecated one, it will be shown, even if there are older non-deprecated versions.includeDraft=true
: do not prefer non-draft versions as a latest version: if the latest version is a draft, it will be shown, even if there are older non-draft versions.includeDeprecated
or includeDraft
to change this behaviour: includeDeprecated=true
: do not prefer non-deprecated versions as a latest version: if the latest version is a deprecated one, it will be shown, even if there are older non-deprecated versions.includeDraft=true
: do not prefer non-draft versions as a latest version: if the latest version is a draft, it will be shown, even if there are older non-draft versions.running
status, such that publishing becomes a simple operation where the existing deployment can be re-used. In other statuses, plug-registry may need to initiate a new build and deployment procedure.
@@ -1732,11 +2009,11 @@ async def publish(
:type version: str
:param query: URL Query parameters.
:type query: PublishQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: 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.
@@ -1759,6 +2036,10 @@ async def publish(
object wraps both the http Response and any parsed data.
"""
+ should_validate = (
+ MODELS_AVAILABLE and self.api_client.config.client_side_validation
+ )
+
# set aside send args
send_args = {}
for key in ["stream", "follow_redirects", "auth"]:
@@ -1766,13 +2047,17 @@ async def publish(
send_args[key] = kwargs.pop(key)
# path parameters
path_params: Dict[str, str] = {
- "name": StringAdapter.validate_python(name),
- "version": StringAdapter.validate_python(version),
+ "name": str(name),
+ "version": str(version),
}
## named body parameters
body_args: Dict[str, Any] = {}
+ # query parameters
+ if query is not None and should_validate:
+ query = TypeAdapter(PublishQuery).validate_python(query)
+
## create httpx.Request
api_request = self.api_client.build_request(
method="POST",
@@ -1790,7 +2075,7 @@ async def publish(
## render response
if raw_response:
return response
- response_types_map: Dict[str, Optional[Union[str, Any]]] = {
+ response_types_map: Dict[str, str | Any | None] = {
"201": PostWebscriptJobSyncResponseV2 if not select_path else Model,
"202": PostWebscriptJobAsyncResponseV2 if not select_path else Model,
}
@@ -1807,12 +2092,12 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> RebuildWebscriptSyncResponseV2: ...
+ ) -> RebuildWebscriptSyncResponseV2 | RebuildWebscriptAsyncResponseV2: ...
@overload
async def rebuild(
@@ -1822,14 +2107,14 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def rebuild(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -1837,12 +2122,31 @@ async def rebuild(
str, Field(strict=True, description="The version of the function.")
],
*,
- query: Optional[Union[RebuildQuery, QueryParamTypes]] = None,
+ query: RebuildQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def rebuild(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ *,
+ query: RebuildQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[RebuildWebscriptSyncResponseV2, Response, Model]:
+ ) -> (
+ RebuildWebscriptSyncResponseV2
+ | RebuildWebscriptAsyncResponseV2
+ | Response
+ | Model
+ ):
"""Rebuild Webscript.
Rebuild and deploy a webscript with the original or updated base image.
@@ -1852,21 +2156,21 @@ async def rebuild(
:type version: str
:param query: URL Query parameters.
:type query: RebuildQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) true
, checks whether rebuild jobs are needed, but do not start any jobs.
+ :param query['dryRun'] (dict) true
, checks whether rebuild jobs are needed, but do not start any jobs.
:type query['dryRun']: bool
- :param query['async']: Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['upgrade']: If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['force']: If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
+ :param query['force'] (dict) true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
:type query['force']: bool
- :param query['undeploy']: If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.
+ :param query['undeploy'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['force']: If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
+ :param query['force'] (dict) true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.
:type query['force']: bool
- :param query['undeploy']: If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.
+ :param query['undeploy'] (dict) name
, version
and/or runtime
attributes. For each runtime other files are supported.
@@ -2245,11 +2626,11 @@ async def update_asset(
:type content: ContentRequest, optional
:param query: URL Query parameters.
:type query: UpdateAssetQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: Literal[False] = False,
- select_path: Literal[""],
- headers: Optional[HeaderTypes] = None,
+ select_path: Literal[""] = "",
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> PostWebscriptJobSyncResponseV2: ...
+ ) -> PostWebscriptJobSyncResponseV2 | PostWebscriptJobAsyncResponseV2: ...
@overload
async def update_assets(
@@ -2347,22 +2736,22 @@ async def update_assets(
],
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: Literal[True],
select_path: Literal["_not_used_"] = "_not_used_",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
) -> Response: ...
- # @validate_call
+ @overload
async def update_assets(
self,
name: Annotated[StrictStr, Field(description="The name of the function.")],
@@ -2371,20 +2760,48 @@ async def update_assets(
],
*,
content: Annotated[
- Optional[RequestContent],
+ RequestContent | None,
Field(
description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
),
] = None,
files: Annotated[
- Optional[RequestFiles], Field(description="Multipart file upload")
+ RequestFiles | None, Field(description="Multipart file upload")
] = None,
- query: Optional[Union[UpdateAssetsQuery, QueryParamTypes]] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
+ raw_response: Literal[False] = False,
+ select_path: str,
+ headers: HeaderTypes | None = None,
+ **kwargs,
+ ) -> Model: ...
+
+ async def update_assets(
+ self,
+ name: Annotated[StrictStr, Field(description="The name of the function.")],
+ version: Annotated[
+ str, Field(strict=True, description="The version of the function.")
+ ],
+ *,
+ content: Annotated[
+ RequestContent | None,
+ Field(
+ description="The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported. "
+ ),
+ ] = None,
+ files: Annotated[
+ RequestFiles | None, Field(description="Multipart file upload")
+ ] = None,
+ query: UpdateAssetsQuery | QueryParamTypes | None = None,
raw_response: StrictBool = False,
select_path: str = "",
- headers: Optional[HeaderTypes] = None,
+ headers: HeaderTypes | None = None,
**kwargs,
- ) -> Union[PostWebscriptJobSyncResponseV2, Response, Model]:
+ ) -> (
+ PostWebscriptJobSyncResponseV2
+ | PostWebscriptJobAsyncResponseV2
+ | Response
+ | Model
+ ):
"""Update Webscript Assets.
Update a draft webscript function by updating its assets. The assets for a webscript function can be provided as either application/octet-stream
, application/tar+gzip
, application/x-gzip
, application/x-tar
, application/gzip
multipart/form-data
requestname
, version
and/or runtime
attributes. For each runtime other files are supported.
@@ -2398,11 +2815,11 @@ async def update_assets(
:type files: FilesRequest, optional
:param query: URL Query parameters.
:type query: UpdateAssetsQuery | QueryParamTypes, optional
- :param query['comment']: An optional user-specified comment corresponding to the operation.
+ :param query['comment'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['chown']: If set, ownership of the draft function is transferred to the current user. (required)
+ :param query['chown'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
+ :param query['async'] (dict) false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.
:type query['async']: bool
- :param query['scaleToZero']: Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command.
+ :param query['scaleToZero'] (dict) true
, validates the deployment conditions, but does not change anything.",
alias="dryRun",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=False,
description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.",
alias="scaleToZero",
@@ -53,40 +56,37 @@ class AsyncDeployQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of AsyncDeployQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the AsyncDeployQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the AsyncDeployQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of AsyncDeployQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a AsyncDeployQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a AsyncDeployQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1.py
index 97d73157..82ac621d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,17 +29,17 @@
class AsyncDeployQueryV1(BaseModel):
"""AsyncDeployQueryV1."""
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=False,
description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.",
alias="scaleToZero",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- dry_run: Optional[StrictBool] = Field(
+ dry_run: StrictBool | None = Field(
default=None,
description="If set to true
, validates the deployment conditions, but does not change anything.",
alias="dryRun",
@@ -49,40 +52,37 @@ class AsyncDeployQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of AsyncDeployQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the AsyncDeployQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the AsyncDeployQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of AsyncDeployQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a AsyncDeployQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a AsyncDeployQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/async_deploy_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_deploy_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/async_deploy_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/async_deploy_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_false.py b/waylay_registry_types/src/waylay/services/registry/models/async_query_default_false.py
index 3da701e7..d0bac1dc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_false.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/async_query_default_false.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class AsyncQueryDefaultFalse(BaseModel):
"""AsyncQueryDefaultFalse."""
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=False,
description="If this is set to true
, the server will start the required job actions asynchronously and return a 202
Accepted response. Otherwise, the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
@@ -39,40 +42,37 @@ class AsyncQueryDefaultFalse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of AsyncQueryDefaultFalse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the AsyncQueryDefaultFalse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the AsyncQueryDefaultFalse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of AsyncQueryDefaultFalse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a AsyncQueryDefaultFalse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a AsyncQueryDefaultFalse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_falseobject.py b/waylay_registry_types/src/waylay/services/registry/models/async_query_default_falseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_falseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_true.py b/waylay_registry_types/src/waylay/services/registry/models/async_query_default_true.py
index d14fe8da..05678cfd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_true.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/async_query_default_true.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class AsyncQueryDefaultTrue(BaseModel):
"""AsyncQueryDefaultTrue."""
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
@@ -39,40 +42,37 @@ class AsyncQueryDefaultTrue(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of AsyncQueryDefaultTrue from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the AsyncQueryDefaultTrue instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the AsyncQueryDefaultTrue instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of AsyncQueryDefaultTrue from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a AsyncQueryDefaultTrue instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a AsyncQueryDefaultTrue instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_trueobject.py b/waylay_registry_types/src/waylay/services/registry/models/async_query_default_trueobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/async_query_default_trueobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_verify_query.py b/waylay_registry_types/src/waylay/services/registry/models/async_verify_query.py
index cbaecddc..63738816 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/async_verify_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/async_verify_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -26,16 +29,16 @@
class AsyncVerifyQuery(BaseModel):
"""AsyncVerifyQuery."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=None,
description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command.",
alias="scaleToZero",
@@ -48,40 +51,37 @@ class AsyncVerifyQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of AsyncVerifyQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the AsyncVerifyQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the AsyncVerifyQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of AsyncVerifyQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a AsyncVerifyQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a AsyncVerifyQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/async_verify_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/async_verify_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/async_verify_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch.py b/waylay_registry_types/src/waylay/services/registry/models/batch.py
index c018b6a8..4d520591 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/batch.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/batch.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,7 +46,7 @@ class Batch(BaseModel):
created_by: StrictStr = Field(
description="The user that initiated this job", alias="createdBy"
)
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
links: JobHALLinks = Field(alias="_links")
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Batch from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Batch instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Batch instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Batch from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Batch instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Batch instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch_args.py b/waylay_registry_types/src/waylay/services/registry/models/batch_args.py
index 82e3821f..c1d006f9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/batch_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/batch_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.function_type import FunctionType
@@ -29,7 +32,7 @@ class BatchArgs(BaseModel):
plug_name: StrictStr = Field(alias="plugName")
function_type: FunctionType = Field(alias="functionType")
- child_type: Optional[StrictStr] = Field(default=None, alias="childType")
+ child_type: StrictStr | None = Field(default=None, alias="childType")
model_config = ConfigDict(
populate_by_name=True,
@@ -38,40 +41,37 @@ class BatchArgs(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BatchArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BatchArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BatchArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BatchArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BatchArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BatchArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/batch_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/batch_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/batch_job_status.py
index dc74a5d2..885d196d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/batch_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/batch_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.batch_args import BatchArgs
@@ -34,7 +37,7 @@ class BatchJobStatus(BaseModel):
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
request: BatchArgs
- result: Optional[BatchResult] = None
+ result: BatchResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -42,7 +45,7 @@ class BatchJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
job: JobStatus
@field_validator("type")
@@ -60,40 +63,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BatchJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BatchJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BatchJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BatchJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BatchJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BatchJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/batch_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/batch_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch_result.py b/waylay_registry_types/src/waylay/services/registry/models/batch_result.py
index e4e9ee8f..094d9699 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/batch_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/batch_result.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
@@ -26,9 +29,7 @@
class BatchResult(BaseModel):
"""BatchResult."""
- job_count: Optional[Union[StrictFloat, StrictInt]] = Field(
- default=None, alias="jobCount"
- )
+ job_count: StrictFloat | StrictInt | None = Field(default=None, alias="jobCount")
model_config = ConfigDict(
populate_by_name=True,
@@ -37,40 +38,37 @@ class BatchResult(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BatchResult from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BatchResult instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BatchResult instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BatchResult from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BatchResult instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BatchResult instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batch_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/batch_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/batch_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/batchobject.py b/waylay_registry_types/src/waylay/services/registry/models/batchobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/batchobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build.py b/waylay_registry_types/src/waylay/services/registry/models/build.py
index 90f804a1..633783c9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/build.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/build.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.build_args import BuildArgs
@@ -33,11 +36,11 @@
class Build(BaseModel):
"""Build."""
- links: Optional[JobHALLinks] = Field(default=None, alias="_links")
+ links: JobHALLinks | None = Field(default=None, alias="_links")
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
- request: Optional[BuildArgs] = None
- result: Optional[BuildResult] = None
+ request: BuildArgs | None = None
+ result: BuildResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -45,9 +48,9 @@ class Build(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
- job: Optional[JobStatus] = None
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ function: FunctionRef | None = None
+ job: JobStatus | None = None
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
@field_validator("type")
@classmethod
@@ -64,40 +67,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Build from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Build instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Build instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Build from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Build instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Build instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build1.py b/waylay_registry_types/src/waylay/services/registry/models/build1.py
index f79561d9..f4dbdc4a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/build1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/build1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,7 +46,7 @@ class Build1(BaseModel):
created_by: StrictStr = Field(
description="The user that initiated this job", alias="createdBy"
)
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
links: JobAndFunctionHALLink = Field(alias="_links")
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Build1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Build1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Build1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Build1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Build1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Build1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build1object.py b/waylay_registry_types/src/waylay/services/registry/models/build1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/build1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_args.py b/waylay_registry_types/src/waylay/services/registry/models/build_args.py
index ed102564..90eda963 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/build_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/build_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -32,7 +35,7 @@ class BuildArgs(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
)
- revision: Optional[StrictStr] = Field(
+ revision: StrictStr | None = Field(
default=None,
description="The revision hash of the current (draft) function revision",
)
@@ -64,40 +67,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BuildArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BuildArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BuildArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BuildArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BuildArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BuildArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/build_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/build_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/build_job_status.py
index 04b4a2eb..a86bb6a2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/build_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/build_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.build_args import BuildArgs
@@ -34,7 +37,7 @@ class BuildJobStatus(BaseModel):
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
request: BuildArgs
- result: Optional[BuildResult] = None
+ result: BuildResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -42,7 +45,7 @@ class BuildJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
job: JobStatus
@field_validator("type")
@@ -60,40 +63,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BuildJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BuildJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BuildJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BuildJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BuildJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BuildJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/build_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/build_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_result.py b/waylay_registry_types/src/waylay/services/registry/models/build_result.py
index 8de6ad32..fe8e6684 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/build_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/build_result.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -27,12 +30,10 @@ class BuildResult(BaseModel):
"""BuildResult."""
digest: StrictStr = Field(description="SHA digest of the built image.")
- log: Optional[List[StrictStr]] = Field(
+ log: List[StrictStr] | None = Field(
default=None, description="Detailed logs of the build steps."
)
- status: Optional[StrictStr] = Field(
- default=None, description="Outcome of the build."
- )
+ status: StrictStr | None = Field(default=None, description="Outcome of the build.")
model_config = ConfigDict(
populate_by_name=True,
@@ -41,40 +42,37 @@ class BuildResult(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BuildResult from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BuildResult instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BuildResult instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BuildResult from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BuildResult instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BuildResult instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/build_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/build_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_spec.py b/waylay_registry_types/src/waylay/services/registry/models/build_spec.py
index c624a3b2..b6b46ba8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/build_spec.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/build_spec.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -35,40 +38,37 @@ class BuildSpec(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of BuildSpec from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the BuildSpec instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the BuildSpec instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of BuildSpec from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a BuildSpec instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a BuildSpec instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/build_specobject.py b/waylay_registry_types/src/waylay/services/registry/models/build_specobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/build_specobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/buildobject.py b/waylay_registry_types/src/waylay/services/registry/models/buildobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/buildobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/cleanup_result.py b/waylay_registry_types/src/waylay/services/registry/models/cleanup_result.py
index 11574c92..74fb1925 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/cleanup_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/cleanup_result.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.job_reference import JobReference
@@ -27,7 +30,7 @@
class CleanupResult(BaseModel):
"""The result data for a completed cleanup job.."""
- scheduled_job: Optional[JobReference] = Field(default=None, alias="scheduledJob")
+ scheduled_job: JobReference | None = Field(default=None, alias="scheduledJob")
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class CleanupResult(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CleanupResult from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CleanupResult instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CleanupResult instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CleanupResult from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CleanupResult instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CleanupResult instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/cleanup_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/cleanup_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/cleanup_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_version.py b/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_version.py
index 38c26765..4abe21e6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_version.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_version.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -43,17 +46,17 @@ class CompiledRuntimeVersion(BaseModel):
name: StrictStr
function_type: FunctionType = Field(alias="functionType")
archive_format: ArchiveFormat = Field(alias="archiveFormat")
- build: Optional[BuildSpec] = None
- deploy: Optional[DeploySpec] = None
- language: Optional[LanguageRelease] = None
- provided_dependencies: Optional[List[ProvidedDependency]] = Field(
+ build: BuildSpec | None = None
+ deploy: DeploySpec | None = None
+ language: LanguageRelease | None = None
+ provided_dependencies: List[ProvidedDependency] | None = Field(
default=None,
description="Description of dependencies provided by this runtime version.",
alias="providedDependencies",
)
- assets: Optional[AssetsConditions] = None
+ assets: AssetsConditions | None = None
title: StrictStr
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
@@ -75,40 +78,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CompiledRuntimeVersion from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CompiledRuntimeVersion instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CompiledRuntimeVersion instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CompiledRuntimeVersion from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CompiledRuntimeVersion instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CompiledRuntimeVersion instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_versionobject.py b/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_versionobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/compiled_runtime_versionobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/completed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/completed_event_data.py
index b74d3e0c..80f8e6da 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/completed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/completed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.any_job_result import AnyJobResult
@@ -28,7 +31,7 @@
class CompletedEventData(BaseModel):
"""CompletedEventData."""
- prev: Optional[QueueEvents] = None
+ prev: QueueEvents | None = None
return_value: AnyJobResult = Field(alias="returnValue")
model_config = ConfigDict(
@@ -38,40 +41,37 @@ class CompletedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CompletedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CompletedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CompletedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CompletedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CompletedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CompletedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/completed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/completed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/completed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/completed_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/completed_event_sse.py
index 40719ad5..38e81ce6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/completed_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/completed_event_sse.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.job_event_response_completed_event_data import (
@@ -49,40 +52,37 @@ def event_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CompletedEventSSE from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CompletedEventSSE instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CompletedEventSSE instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CompletedEventSSE from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CompletedEventSSE instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CompletedEventSSE instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/completed_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/completed_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/completed_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/content_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/content_query_v2.py
index e85cbfed..d253faad 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/content_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/content_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class ContentQueryV2(BaseModel):
"""ContentQueryV2."""
- ls: Optional[StrictBool] = Field(
+ ls: StrictBool | None = Field(
default=False,
description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime.",
)
@@ -38,40 +41,37 @@ class ContentQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ContentQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ContentQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ContentQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ContentQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ContentQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ContentQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/content_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/content_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/content_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/content_validation_listing.py b/waylay_registry_types/src/waylay/services/registry/models/content_validation_listing.py
index cab83d4d..ce1d14d6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/content_validation_listing.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/content_validation_listing.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from ..models.asset_summary_with_hal_link import AssetSummaryWithHALLink
@@ -35,40 +38,37 @@ class ContentValidationListing(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ContentValidationListing from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ContentValidationListing instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ContentValidationListing instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ContentValidationListing from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ContentValidationListing instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ContentValidationListing instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/content_validation_listingobject.py b/waylay_registry_types/src/waylay/services/registry/models/content_validation_listingobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/content_validation_listingobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2.py
index 573e4585..6b01d7e6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.deprecate_previous_policy import DeprecatePreviousPolicy
@@ -28,30 +31,30 @@
class CreateFunctionQueryV2(BaseModel):
"""CreateFunctionQueryV2."""
- deprecate_previous: Optional[DeprecatePreviousPolicy] = Field(
+ deprecate_previous: DeprecatePreviousPolicy | None = Field(
default=None, alias="deprecatePrevious"
)
- dry_run: Optional[StrictBool] = Field(
+ dry_run: StrictBool | None = Field(
default=None,
description="If set to true
, validates the deployment conditions, but does not change anything.",
alias="dryRun",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=False,
description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately.",
alias="scaleToZero",
)
- version: Optional[SemanticVersionRange] = None
- name: Optional[StrictStr] = Field(
+ version: SemanticVersionRange | None = None
+ name: StrictStr | None = Field(
default=None,
description="If set, the value will be used as the function name instead of the one specified in the manifest.",
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=False,
description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid.",
)
@@ -63,40 +66,37 @@ class CreateFunctionQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CreateFunctionQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreateFunctionQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CreateFunctionQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CreateFunctionQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreateFunctionQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreateFunctionQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/create_function_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_response.py b/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_response.py
index 5e47941f..197a3eff 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class CreateKFServingAsyncResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CreateKFServingAsyncResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreateKFServingAsyncResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CreateKFServingAsyncResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CreateKFServingAsyncResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreateKFServingAsyncResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreateKFServingAsyncResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/create_kf_serving_async_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_response.py b/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_response.py
index f60b5e2d..37bca8bd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class CreatePlugAsyncResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CreatePlugAsyncResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreatePlugAsyncResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CreatePlugAsyncResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CreatePlugAsyncResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreatePlugAsyncResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreatePlugAsyncResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/create_plug_async_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_response.py b/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_response.py
index 08eec203..111cf4af 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class CreateWebscriptAsyncResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of CreateWebscriptAsyncResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreateWebscriptAsyncResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the CreateWebscriptAsyncResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of CreateWebscriptAsyncResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreateWebscriptAsyncResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreateWebscriptAsyncResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/create_webscript_async_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/delayed_event_data.py
index 42375775..e02736c0 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/delayed_event_data.py
@@ -13,19 +13,22 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Union
+from typing import Any, ClassVar, Dict, List, Union
from pydantic import BaseModel, StrictFloat, StrictInt
class DelayedEventData(BaseModel):
"""DelayedEventData."""
- delay: Union[StrictFloat, StrictInt]
+ delay: StrictFloat | StrictInt
model_config = ConfigDict(
populate_by_name=True,
@@ -34,40 +37,37 @@ class DelayedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DelayedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DelayedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DelayedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DelayedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DelayedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DelayedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/delayed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sse.py
index d7ae4903..afd0ad89 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sse.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.job_event_response_delayed_event_data import (
@@ -49,40 +52,37 @@ def event_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DelayedEventSSE from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DelayedEventSSE instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DelayedEventSSE instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DelayedEventSSE from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DelayedEventSSE instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DelayedEventSSE instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/delayed_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy.py b/waylay_registry_types/src/waylay/services/registry/models/deploy.py
index e28eea17..1d7b0f3b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.deploy_args import DeployArgs
@@ -33,11 +36,11 @@
class Deploy(BaseModel):
"""Deploy."""
- links: Optional[JobHALLinks] = Field(default=None, alias="_links")
+ links: JobHALLinks | None = Field(default=None, alias="_links")
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
- request: Optional[DeployArgs] = None
- result: Optional[DeployResult] = None
+ request: DeployArgs | None = None
+ result: DeployResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -45,9 +48,9 @@ class Deploy(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
- job: Optional[JobStatus] = None
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ function: FunctionRef | None = None
+ job: JobStatus | None = None
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
@field_validator("type")
@classmethod
@@ -64,40 +67,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Deploy from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Deploy instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Deploy instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Deploy from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Deploy instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Deploy instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy1.py b/waylay_registry_types/src/waylay/services/registry/models/deploy1.py
index 8ea5d953..b9a0da1e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,7 +46,7 @@ class Deploy1(BaseModel):
created_by: StrictStr = Field(
description="The user that initiated this job", alias="createdBy"
)
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
links: JobAndFunctionHALLink = Field(alias="_links")
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Deploy1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Deploy1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Deploy1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Deploy1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Deploy1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Deploy1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy1object.py b/waylay_registry_types/src/waylay/services/registry/models/deploy1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_args.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_args.py
index b85665a4..400a96b9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -41,7 +44,7 @@ class DeployArgs(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
)
- revision: Optional[StrictStr] = Field(
+ revision: StrictStr | None = Field(
default=None,
description="The revision hash of the current (draft) function revision",
)
@@ -66,40 +69,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeployArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeployArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeployArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeployArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeployArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeployArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overrides.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overrides.py
index 8d13a958..d681fb08 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overrides.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overrides.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.resource_limits import ResourceLimits
@@ -27,20 +30,20 @@
class DeployArgsDeploySpecOverrides(BaseModel):
"""Overrides on the deployment specification.."""
- service: Optional[StrictStr] = None
- image: Optional[StrictStr] = None
- namespace: Optional[StrictStr] = None
- env_process: Optional[StrictStr] = Field(default=None, alias="envProcess")
- network: Optional[StrictStr] = None
- env_vars: Optional[Dict[str, StrictStr]] = Field(default=None, alias="envVars")
- constraints: Optional[List[StrictStr]] = None
- labels: Optional[Dict[str, StrictStr]] = None
- annotations: Optional[Dict[str, StrictStr]] = None
- secrets: Optional[List[StrictStr]] = None
- registry_auth: Optional[StrictStr] = Field(default=None, alias="registryAuth")
- limits: Optional[ResourceLimits] = None
- requests: Optional[ResourceLimits] = None
- read_only_root_filesystem: Optional[StrictBool] = Field(
+ service: StrictStr | None = None
+ image: StrictStr | None = None
+ namespace: StrictStr | None = None
+ env_process: StrictStr | None = Field(default=None, alias="envProcess")
+ network: StrictStr | None = None
+ env_vars: Dict[str, StrictStr] | None = Field(default=None, alias="envVars")
+ constraints: List[StrictStr] | None = None
+ labels: Dict[str, StrictStr] | None = None
+ annotations: Dict[str, StrictStr] | None = None
+ secrets: List[StrictStr] | None = None
+ registry_auth: StrictStr | None = Field(default=None, alias="registryAuth")
+ limits: ResourceLimits | None = None
+ requests: ResourceLimits | None = None
+ read_only_root_filesystem: StrictBool | None = Field(
default=None, alias="readOnlyRootFilesystem"
)
@@ -51,40 +54,37 @@ class DeployArgsDeploySpecOverrides(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeployArgsDeploySpecOverrides from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeployArgsDeploySpecOverrides instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeployArgsDeploySpecOverrides instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeployArgsDeploySpecOverrides from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeployArgsDeploySpecOverrides instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeployArgsDeploySpecOverrides instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overridesobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overridesobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_args_deploy_spec_overridesobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filter.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filter.py
index cedbe21e..987e4a6f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filter.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filter.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -26,16 +29,16 @@
class DeployAttributesFilter(BaseModel):
"""DeployAttributesFilter."""
- endpoint: Optional[StrictStr] = Field(
+ endpoint: StrictStr | None = Field(
default=None,
description="Filter on the openfaas endpoint. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- image_name: Optional[StrictStr] = Field(
+ image_name: StrictStr | None = Field(
default=None,
description="Filter on the container image name. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
alias="imageName",
)
- storage_location: Optional[StrictStr] = Field(
+ storage_location: StrictStr | None = Field(
default=None,
description="Filter on the storageLocation. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
alias="storageLocation",
@@ -48,40 +51,37 @@ class DeployAttributesFilter(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeployAttributesFilter from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeployAttributesFilter instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeployAttributesFilter instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeployAttributesFilter from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeployAttributesFilter instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeployAttributesFilter instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filterobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filterobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_attributes_filterobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_job_status.py
index ff7e0a77..052ce687 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.deploy_args import DeployArgs
@@ -34,7 +37,7 @@ class DeployJobStatus(BaseModel):
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
request: DeployArgs
- result: Optional[DeployResult] = None
+ result: DeployResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -42,7 +45,7 @@ class DeployJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
job: JobStatus
@field_validator("type")
@@ -60,40 +63,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeployJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeployJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeployJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeployJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeployJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeployJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_result.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_result.py
index 6d371f66..fcae6abd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_result.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.exposed_openfaas_deploy_spec import ExposedOpenfaasDeploySpec
@@ -36,40 +39,37 @@ class DeployResult(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeployResult from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeployResult instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeployResult instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeployResult from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeployResult instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeployResult instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_spec.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_spec.py
index 707c8c9b..873d8c9f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_spec.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_spec.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.deploy_spec_openfaas_spec import DeploySpecOpenfaasSpec
@@ -27,7 +30,7 @@
class DeploySpec(BaseModel):
"""DeploySpec."""
- openfaas_spec: Optional[DeploySpecOpenfaasSpec] = Field(
+ openfaas_spec: DeploySpecOpenfaasSpec | None = Field(
default=None, alias="openfaasSpec"
)
@@ -38,40 +41,37 @@ class DeploySpec(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeploySpec from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeploySpec instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeploySpec instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeploySpec from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeploySpec instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeploySpec instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_spec.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_spec.py
index 8f293d68..628d4c8e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_spec.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_spec.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.resource_limits import ResourceLimits
@@ -27,20 +30,20 @@
class DeploySpecOpenfaasSpec(BaseModel):
"""If specified, it overrides the properties in `default`. Non-specified properties are taken from `default`."""
- service: Optional[StrictStr] = None
- image: Optional[StrictStr] = None
- namespace: Optional[StrictStr] = None
- env_process: Optional[StrictStr] = Field(default=None, alias="envProcess")
- network: Optional[StrictStr] = None
- env_vars: Optional[Dict[str, StrictStr]] = Field(default=None, alias="envVars")
- constraints: Optional[List[StrictStr]] = None
- labels: Optional[Dict[str, StrictStr]] = None
- annotations: Optional[Dict[str, StrictStr]] = None
- secrets: Optional[List[StrictStr]] = None
- registry_auth: Optional[StrictStr] = Field(default=None, alias="registryAuth")
- limits: Optional[ResourceLimits] = None
- requests: Optional[ResourceLimits] = None
- read_only_root_filesystem: Optional[StrictBool] = Field(
+ service: StrictStr | None = None
+ image: StrictStr | None = None
+ namespace: StrictStr | None = None
+ env_process: StrictStr | None = Field(default=None, alias="envProcess")
+ network: StrictStr | None = None
+ env_vars: Dict[str, StrictStr] | None = Field(default=None, alias="envVars")
+ constraints: List[StrictStr] | None = None
+ labels: Dict[str, StrictStr] | None = None
+ annotations: Dict[str, StrictStr] | None = None
+ secrets: List[StrictStr] | None = None
+ registry_auth: StrictStr | None = Field(default=None, alias="registryAuth")
+ limits: ResourceLimits | None = None
+ requests: ResourceLimits | None = None
+ read_only_root_filesystem: StrictBool | None = Field(
default=None, alias="readOnlyRootFilesystem"
)
@@ -51,40 +54,37 @@ class DeploySpecOpenfaasSpec(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeploySpecOpenfaasSpec from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeploySpecOpenfaasSpec instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeploySpecOpenfaasSpec instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeploySpecOpenfaasSpec from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeploySpecOpenfaasSpec instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeploySpecOpenfaasSpec instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_specobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_specobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_spec_openfaas_specobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deploy_specobject.py b/waylay_registry_types/src/waylay/services/registry/models/deploy_specobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deploy_specobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deployobject.py b/waylay_registry_types/src/waylay/services/registry/models/deployobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deployobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policy.py b/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policy.py
index c1ad46a9..56e34360 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policy.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,23 +24,10 @@
class DeprecatePreviousPolicy(str, Enum):
"""DeprecatePreviousPolicy."""
- """
- allowed enum values
- """
NONE = "none"
ALL = "all"
PATCH = "patch"
MINOR = "minor"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeprecatePreviousPolicy from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of DeprecatePreviousPolicy."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of DeprecatePreviousPolicy."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policyobject.py b/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_policyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_query.py b/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_query.py
index f79ee62c..d26740ea 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.deprecate_previous_policy import DeprecatePreviousPolicy
@@ -27,7 +30,7 @@
class DeprecatePreviousQuery(BaseModel):
"""DeprecatePreviousQuery."""
- deprecate_previous: Optional[DeprecatePreviousPolicy] = Field(
+ deprecate_previous: DeprecatePreviousPolicy | None = Field(
default=None, alias="deprecatePrevious"
)
@@ -38,40 +41,37 @@ class DeprecatePreviousQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeprecatePreviousQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeprecatePreviousQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeprecatePreviousQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeprecatePreviousQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeprecatePreviousQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeprecatePreviousQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deprecate_previous_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filter.py b/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filter.py
index df70d796..f59bf722 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filter.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filter.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,10 +29,10 @@
class DeprecatedDraftFilter(BaseModel):
"""DeprecatedDraftFilter."""
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
@@ -40,40 +43,37 @@ class DeprecatedDraftFilter(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DeprecatedDraftFilter from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeprecatedDraftFilter instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DeprecatedDraftFilter instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DeprecatedDraftFilter from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeprecatedDraftFilter instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeprecatedDraftFilter instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filterobject.py b/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filterobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/deprecated_draft_filterobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/documentation.py b/waylay_registry_types/src/waylay/services/registry/models/documentation.py
index 5ad27dbb..0399e627 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/documentation.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/documentation.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.documentation_property import DocumentationProperty
@@ -27,14 +30,14 @@
class Documentation(BaseModel):
"""Documentation."""
- description: Optional[StrictStr] = None
- states: Optional[List[DocumentationProperty]] = Field(
+ description: StrictStr | None = None
+ states: List[DocumentationProperty] | None = Field(
default=None, description="Documentation of the plug states."
)
- input: Optional[List[DocumentationProperty]] = Field(
+ input: List[DocumentationProperty] | None = Field(
default=None, description="Documentation of the plug input parameters."
)
- output: Optional[List[DocumentationProperty]] = Field(
+ output: List[DocumentationProperty] | None = Field(
default=None, description="Documentation of the plug response parameters."
)
@@ -45,40 +48,37 @@ class Documentation(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Documentation from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Documentation instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Documentation instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Documentation from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Documentation instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Documentation instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/documentation_property.py b/waylay_registry_types/src/waylay/services/registry/models/documentation_property.py
index 4b0976d6..50970c4d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/documentation_property.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/documentation_property.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -36,40 +39,37 @@ class DocumentationProperty(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DocumentationProperty from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DocumentationProperty instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DocumentationProperty instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DocumentationProperty from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DocumentationProperty instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DocumentationProperty instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/documentation_propertyobject.py b/waylay_registry_types/src/waylay/services/registry/models/documentation_propertyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/documentation_propertyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/documentationobject.py b/waylay_registry_types/src/waylay/services/registry/models/documentationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/documentationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/dry_run_query.py b/waylay_registry_types/src/waylay/services/registry/models/dry_run_query.py
index 8dffe609..63698b7d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/dry_run_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/dry_run_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class DryRunQuery(BaseModel):
"""DryRunQuery."""
- dry_run: Optional[StrictBool] = Field(
+ dry_run: StrictBool | None = Field(
default=None,
description="If set to true
, validates the deployment conditions, but does not change anything.",
alias="dryRun",
@@ -39,40 +42,37 @@ class DryRunQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of DryRunQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DryRunQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the DryRunQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of DryRunQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DryRunQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DryRunQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/dry_run_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/dry_run_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/dry_run_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/entity_response.py b/waylay_registry_types/src/waylay/services/registry/models/entity_response.py
index 7b8f4713..1fdeef3d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/entity_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/entity_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -33,13 +36,13 @@
class EntityResponse(BaseModel):
"""EntityResponse."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -57,8 +60,8 @@ class EntityResponse(BaseModel):
alias="updatedAt",
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
- links: Optional[List[JobHALLinks]] = Field(
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
+ links: List[JobHALLinks] | None = Field(
default=None, description="Links to related entities.", alias="_links"
)
@@ -79,40 +82,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of EntityResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the EntityResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the EntityResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of EntityResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a EntityResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a EntityResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/entity_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/entity_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/entity_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/error_and_status_response.py b/waylay_registry_types/src/waylay/services/registry/models/error_and_status_response.py
index ae1848c7..5ccc9b2b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/error_and_status_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/error_and_status_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Union
+from typing import Any, ClassVar, Dict, List, Union
from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr
from pydantic import Field
@@ -27,7 +30,7 @@ class ErrorAndStatusResponse(BaseModel):
"""ErrorAndStatusResponse."""
error: StrictStr
- status_code: Union[StrictFloat, StrictInt] = Field(alias="statusCode")
+ status_code: StrictFloat | StrictInt = Field(alias="statusCode")
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class ErrorAndStatusResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ErrorAndStatusResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ErrorAndStatusResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ErrorAndStatusResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ErrorAndStatusResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ErrorAndStatusResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ErrorAndStatusResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/error_and_status_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/error_and_status_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/error_and_status_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/error_response.py b/waylay_registry_types/src/waylay/services/registry/models/error_response.py
index c21aad6a..6714b443 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/error_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/error_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -34,40 +37,37 @@ class ErrorResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ErrorResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ErrorResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ErrorResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ErrorResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ErrorResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ErrorResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/error_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/error_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/error_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_ack.py b/waylay_registry_types/src/waylay/services/registry/models/event_ack.py
index a6832e71..836a20e4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/event_ack.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/event_ack.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class EventAck(str, Enum):
"""EventAck."""
- """
- allowed enum values
- """
ACK = "ack"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of EventAck from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of EventAck."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of EventAck."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_ackobject.py b/waylay_registry_types/src/waylay/services/registry/models/event_ackobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/event_ackobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_close.py b/waylay_registry_types/src/waylay/services/registry/models/event_close.py
index 53fe15f8..f3a6342e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/event_close.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/event_close.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class EventClose(str, Enum):
"""EventClose."""
- """
- allowed enum values
- """
CLOSE = "close"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of EventClose from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of EventClose."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of EventClose."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_closeobject.py b/waylay_registry_types/src/waylay/services/registry/models/event_closeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/event_closeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_keep_alive.py b/waylay_registry_types/src/waylay/services/registry/models/event_keep_alive.py
index 4b504532..7c328084 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/event_keep_alive.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/event_keep_alive.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class EventKeepAlive(str, Enum):
"""EventKeepAlive."""
- """
- allowed enum values
- """
KEEP_MINUS_ALIVE = "keep-alive"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of EventKeepAlive from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of EventKeepAlive."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of EventKeepAlive."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_keep_aliveobject.py b/waylay_registry_types/src/waylay/services/registry/models/event_keep_aliveobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/event_keep_aliveobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/event_sse.py
index 6514a69a..b138cd14 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/event_sse.py
@@ -10,19 +10,31 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_event_sse import JobEventSSE
from ..models.keep_alive_event_sse import KeepAliveEventSSE
from ..models.stream_ready import StreamReady
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
EventSSE = Union[
Annotated[StreamReady, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_type_sse.py b/waylay_registry_types/src/waylay/services/registry/models/event_type_sse.py
index 719ce1d6..2436e07f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/event_type_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/event_type_sse.py
@@ -10,20 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.event_ack import EventAck
from ..models.event_close import EventClose
from ..models.event_keep_alive import EventKeepAlive
from ..models.supported_events import SupportedEvents
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
EventTypeSSE = Union[
Annotated[SupportedEvents, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_type_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/event_type_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/event_type_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sse.py b/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sse.py
index 7651cae8..2bc8e5dd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sse.py
@@ -10,20 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_event_sse import JobEventSSE
from ..models.keep_alive_event_sse import KeepAliveEventSSE
from ..models.stream_closing import StreamClosing
from ..models.stream_ready import StreamReady
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
EventWithCloseSSE = Union[
Annotated[StreamReady, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/event_with_close_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_spec.py b/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_spec.py
index f8b61510..9271fd03 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_spec.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_spec.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from ..models.resource_limits import ResourceLimits
@@ -29,10 +32,10 @@ class ExposedOpenfaasDeploySpec(BaseModel):
service: StrictStr
image: StrictStr
namespace: StrictStr
- labels: Optional[Dict[str, StrictStr]] = None
- annotations: Optional[Dict[str, StrictStr]] = None
- limits: Optional[ResourceLimits] = None
- requests: Optional[ResourceLimits] = None
+ labels: Dict[str, StrictStr] | None = None
+ annotations: Dict[str, StrictStr] | None = None
+ limits: ResourceLimits | None = None
+ requests: ResourceLimits | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -41,40 +44,37 @@ class ExposedOpenfaasDeploySpec(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ExposedOpenfaasDeploySpec from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ExposedOpenfaasDeploySpec instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ExposedOpenfaasDeploySpec instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ExposedOpenfaasDeploySpec from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ExposedOpenfaasDeploySpec instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ExposedOpenfaasDeploySpec instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_specobject.py b/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_specobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/exposed_openfaas_deploy_specobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/failed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/failed_event_data.py
index 40a4dcfc..02266098 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/failed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/failed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.queue_events import QueueEvents
@@ -27,7 +30,7 @@
class FailedEventData(BaseModel):
"""FailedEventData."""
- prev: Optional[QueueEvents] = None
+ prev: QueueEvents | None = None
failed_reason: StrictStr = Field(
description="The failure reason of the job", alias="failedReason"
)
@@ -39,40 +42,37 @@ class FailedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FailedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FailedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FailedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FailedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FailedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FailedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/failed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/failed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/failed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/failed_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/failed_event_sse.py
index d1ad8d1d..4214ecff 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/failed_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/failed_event_sse.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.job_event_response_failed_event_data import (
@@ -49,40 +52,37 @@ def event_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FailedEventSSE from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FailedEventSSE instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FailedEventSSE instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FailedEventSSE from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FailedEventSSE instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FailedEventSSE instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/failed_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/failed_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/failed_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/failure_reason.py b/waylay_registry_types/src/waylay/services/registry/models/failure_reason.py
index bff89497..4d03b2d9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/failure_reason.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/failure_reason.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -28,7 +31,7 @@ class FailureReason(BaseModel):
log: List[StrictStr] = Field(description="Log lines associated with this failure.")
events: List[StrictStr] = Field(description="Events associated with this failure.")
- cause: Optional[StrictStr] = Field(
+ cause: StrictStr | None = Field(
default=None, description="Main cause for the failure."
)
@@ -39,40 +42,37 @@ class FailureReason(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FailureReason from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FailureReason instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FailureReason instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FailureReason from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FailureReason instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FailureReason instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/failure_reasonobject.py b/waylay_registry_types/src/waylay/services/registry/models/failure_reasonobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/failure_reasonobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/file_upload.py b/waylay_registry_types/src/waylay/services/registry/models/file_upload.py
index e3e500be..38aeb297 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/file_upload.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/file_upload.py
@@ -13,19 +13,22 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBytes, StrictStr
class FileUpload(BaseModel):
"""A single asset file.."""
- file: Optional[Union[StrictBytes, StrictStr]] = None
+ file: StrictBytes | StrictStr | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -34,40 +37,37 @@ class FileUpload(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FileUpload from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FileUpload instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FileUpload instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FileUpload from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FileUpload instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FileUpload instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/file_uploadobject.py b/waylay_registry_types/src/waylay/services/registry/models/file_uploadobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/file_uploadobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1.py
index 5112c8c0..4404110d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,12 +29,12 @@
class ForceDeleteQueryV1(BaseModel):
"""ForceDeleteQueryV1."""
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=False,
description="If this is set to true
, the server will start the required job actions asynchronously and return a 202
Accepted response. Otherwise, the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.",
)
@@ -43,40 +46,37 @@ class ForceDeleteQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ForceDeleteQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ForceDeleteQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ForceDeleteQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ForceDeleteQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ForceDeleteQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ForceDeleteQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/force_delete_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_delete_query.py b/waylay_registry_types/src/waylay/services/registry/models/function_delete_query.py
index 73976cb9..b8b151f2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_delete_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_delete_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,11 +29,11 @@
class FunctionDeleteQuery(BaseModel):
"""FunctionDeleteQuery."""
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.",
)
- undeploy: Optional[StrictBool] = Field(
+ undeploy: StrictBool | None = Field(
default=None,
description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.",
)
@@ -42,40 +45,37 @@ class FunctionDeleteQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionDeleteQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionDeleteQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionDeleteQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionDeleteQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionDeleteQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionDeleteQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_delete_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_delete_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_delete_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides.py b/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides.py
index 5c5aa40d..812145e9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.function_deploy_overrides_type import FunctionDeployOverridesType
@@ -26,7 +29,7 @@
class FunctionDeployOverrides(BaseModel):
"""FunctionDeployOverrides."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class FunctionDeployOverrides(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionDeployOverrides from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionDeployOverrides instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionDeployOverrides instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionDeployOverrides from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionDeployOverrides instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionDeployOverrides instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_type.py b/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_type.py
index 5a5d251e..64458544 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_type.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.resource_limits import ResourceLimits
@@ -27,11 +30,11 @@
class FunctionDeployOverridesType(BaseModel):
"""FunctionDeployOverridesType."""
- env_vars: Optional[Dict[str, StrictStr]] = Field(default=None, alias="envVars")
- labels: Optional[Dict[str, StrictStr]] = None
- annotations: Optional[Dict[str, StrictStr]] = None
- limits: Optional[ResourceLimits] = None
- requests: Optional[ResourceLimits] = None
+ env_vars: Dict[str, StrictStr] | None = Field(default=None, alias="envVars")
+ labels: Dict[str, StrictStr] | None = None
+ annotations: Dict[str, StrictStr] | None = None
+ limits: ResourceLimits | None = None
+ requests: ResourceLimits | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -40,40 +43,37 @@ class FunctionDeployOverridesType(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionDeployOverridesType from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionDeployOverridesType instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionDeployOverridesType instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionDeployOverridesType from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionDeployOverridesType instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionDeployOverridesType instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overrides_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overridesobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overridesobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_deploy_overridesobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_entity_query.py b/waylay_registry_types/src/waylay/services/registry/models/function_entity_query.py
index aeeb2fc1..1925536c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_entity_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_entity_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -27,16 +30,16 @@
class FunctionEntityQuery(BaseModel):
"""Filter on function attributes that do not change across function versions.."""
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -47,40 +50,37 @@ class FunctionEntityQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionEntityQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionEntityQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionEntityQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionEntityQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionEntityQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionEntityQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_entity_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_entity_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_entity_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_job_args.py b/waylay_registry_types/src/waylay/services/registry/models/function_job_args.py
index cdbd5d8e..c2b9bc56 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_job_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_job_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -32,7 +35,7 @@ class FunctionJobArgs(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
)
- revision: Optional[StrictStr] = Field(
+ revision: StrictStr | None = Field(
default=None,
description="The revision hash of the current (draft) function revision",
)
@@ -54,40 +57,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionJobArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionJobArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionJobArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionJobArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionJobArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionJobArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_job_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_job_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_job_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_manifest.py b/waylay_registry_types/src/waylay/services/registry/models/function_manifest.py
index 5fd814b6..f8222f25 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_manifest.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_manifest.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -30,13 +33,13 @@
class FunctionManifest(BaseModel):
"""FunctionManifest."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -58,40 +61,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionManifest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionManifest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionManifest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionManifest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionManifest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionManifest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_manifestobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_manifestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_manifestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_meta.py b/waylay_registry_types/src/waylay/services/registry/models/function_meta.py
index 21ca514c..6524a16e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_meta.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_meta.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -26,18 +29,18 @@
class FunctionMeta(BaseModel):
"""FunctionMeta."""
- author: Optional[StrictStr] = Field(
+ author: StrictStr | None = Field(
default=None, description="The author of the function."
)
- description: Optional[StrictStr] = Field(
+ description: StrictStr | None = Field(
default=None, description="A description of the function"
)
- icon_url: Optional[StrictStr] = Field(
+ icon_url: StrictStr | None = Field(
default=None,
description="An url to an icon that represents this function.",
alias="iconURL",
)
- category: Optional[StrictStr] = Field(
+ category: StrictStr | None = Field(
default=None,
description="A category for this function (Deprecated: use tags to categorise your functions)",
)
@@ -49,40 +52,37 @@ class FunctionMeta(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionMeta from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionMeta instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionMeta instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionMeta from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionMeta instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionMeta instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_metaobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_metaobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_metaobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_name_version.py b/waylay_registry_types/src/waylay/services/registry/models/function_name_version.py
index f8cff151..b22a4bc9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_name_version.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_name_version.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -49,40 +52,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionNameVersion from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionNameVersion instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionNameVersion instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionNameVersion from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionNameVersion instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionNameVersion instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_name_versionobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_name_versionobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_name_versionobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_ref.py b/waylay_registry_types/src/waylay/services/registry/models/function_ref.py
index dd44f9d6..6c96d397 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_ref.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_ref.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -30,12 +33,12 @@ class FunctionRef(BaseModel):
function_type: FunctionType = Field(alias="functionType")
name: StrictStr = Field(description="The logical name for the function.")
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="The semantic version of the function (all versions if undefined)",
)
- runtime: Optional[StrictStr] = None
- runtime_version: Optional[Annotated[str, Field(strict=True)]] = Field(
+ runtime: StrictStr | None = None
+ runtime_version: Annotated[str, Field(strict=True)] | None = Field(
default=None,
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
@@ -47,7 +50,6 @@ def runtime_version_validate_regular_expression(cls, value):
"""Validate the regular expression."""
if value is None:
return value
-
if not re.match(r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$", value):
raise ValueError(
r"must validate the regular expression /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/"
@@ -61,40 +63,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionRef from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionRef instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionRef instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionRef from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionRef instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionRef instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_refobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_refobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_refobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_spec.py b/waylay_registry_types/src/waylay/services/registry/models/function_spec.py
index b70ff0df..e73bb8ab 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_spec.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_spec.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -50,40 +53,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionSpec from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionSpec instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionSpec instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionSpec from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionSpec instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionSpec instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_specobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_specobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_specobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_type.py b/waylay_registry_types/src/waylay/services/registry/models/function_type.py
index ef2e816b..1169390b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_type.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,22 +24,9 @@
class FunctionType(str, Enum):
"""Type of functions supported by the registry service.."""
- """
- allowed enum values
- """
PLUGS = "plugs"
WEBSCRIPTS = "webscripts"
KFSERVING = "kfserving"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionType from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of FunctionType."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of FunctionType."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_version_query.py b/waylay_registry_types/src/waylay/services/registry/models/function_version_query.py
index 670fcf4a..55198f10 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/function_version_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/function_version_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.semantic_version_range import SemanticVersionRange
@@ -29,31 +32,31 @@
class FunctionVersionQuery(BaseModel):
"""Filter on function attributes that can change across function versions. When these query parameters are used, the query is considered a _function version_ listing and no HAL links to latest (_draft_, _published_) versions are included.."""
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
model_config = ConfigDict(
populate_by_name=True,
@@ -62,40 +65,37 @@ class FunctionVersionQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of FunctionVersionQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the FunctionVersionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the FunctionVersionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of FunctionVersionQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a FunctionVersionQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a FunctionVersionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/function_version_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/function_version_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/function_version_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2.py b/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2.py
index 0adaa9b4..64c4e014 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -53,40 +56,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetContentParamsV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetContentParamsV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetContentParamsV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetContentParamsV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetContentParamsV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetContentParamsV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_content_params_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_query.py b/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_query.py
index 651a8f8b..ef5ba039 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
from ..models.semantic_version_range import SemanticVersionRange
@@ -28,18 +31,18 @@
class GetInvokableWebscriptQuery(BaseModel):
"""GetInvokableWebscriptQuery."""
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- version: Optional[SemanticVersionRange] = None
- status: Optional[List[StatusFilter]] = Field(
+ version: SemanticVersionRange | None = None
+ status: List[StatusFilter] | None = Field(
default=None, description="If set, filters on the `status` of the webscript."
)
@@ -50,40 +53,37 @@ class GetInvokableWebscriptQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetInvokableWebscriptQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetInvokableWebscriptQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetInvokableWebscriptQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetInvokableWebscriptQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetInvokableWebscriptQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetInvokableWebscriptQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_invokable_webscript_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2.py
index 35cc4617..3161de10 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.get_plug_response_v2_links import GetPlugResponseV2Links
@@ -38,40 +41,37 @@ class GetModelResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetModelResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetModelResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetModelResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetModelResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetModelResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetModelResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_model_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2.py
index 0e3d14ac..5fc8238e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.get_plug_response_v2_links import GetPlugResponseV2Links
@@ -38,40 +41,37 @@ class GetPlugResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetPlugResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetPlugResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetPlugResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetPlugResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetPlugResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetPlugResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links.py
index 63ddf38a..37087959 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.get_plug_response_v2_links_draft import GetPlugResponseV2LinksDraft
from ..models.get_plug_response_v2_links_published import (
@@ -30,9 +33,9 @@
class GetPlugResponseV2Links(BaseModel):
"""HAL links to related jobs and plugs."""
- draft: Optional[GetPlugResponseV2LinksDraft] = None
- published: Optional[GetPlugResponseV2LinksPublished] = None
- jobs: Optional[HALLink] = None
+ draft: GetPlugResponseV2LinksDraft | None = None
+ published: GetPlugResponseV2LinksPublished | None = None
+ jobs: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -41,40 +44,37 @@ class GetPlugResponseV2Links(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetPlugResponseV2Links from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetPlugResponseV2Links instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetPlugResponseV2Links instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetPlugResponseV2Links from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetPlugResponseV2Links instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetPlugResponseV2Links instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draft.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draft.py
index cd6638a3..150ee399 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draft.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draft.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool, StrictStr
@@ -37,40 +40,37 @@ class GetPlugResponseV2LinksDraft(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetPlugResponseV2LinksDraft from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetPlugResponseV2LinksDraft instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetPlugResponseV2LinksDraft instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetPlugResponseV2LinksDraft from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetPlugResponseV2LinksDraft instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetPlugResponseV2LinksDraft instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draftobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draftobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_draftobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_published.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_published.py
index afd1b632..297e022e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_published.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_published.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool, StrictStr
@@ -37,40 +40,37 @@ class GetPlugResponseV2LinksPublished(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetPlugResponseV2LinksPublished from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetPlugResponseV2LinksPublished instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetPlugResponseV2LinksPublished instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetPlugResponseV2LinksPublished from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetPlugResponseV2LinksPublished instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetPlugResponseV2LinksPublished instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_publishedobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_publishedobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_links_publishedobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_plug_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_query.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_query.py
index ed982a17..83eb48e7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class GetRuntimeByNameAndVersionQuery(BaseModel):
"""GetRuntimeByNameAndVersionQuery."""
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=True,
description="If set to `true`, deprecated runtimes will be included in the query.",
alias="includeDeprecated",
@@ -39,40 +42,37 @@ class GetRuntimeByNameAndVersionQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetRuntimeByNameAndVersionQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetRuntimeByNameAndVersionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetRuntimeByNameAndVersionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetRuntimeByNameAndVersionQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetRuntimeByNameAndVersionQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetRuntimeByNameAndVersionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_and_version_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_query.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_query.py
index 89dac404..6d56ac82 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -29,18 +32,18 @@
class GetRuntimeByNameQuery(BaseModel):
"""GetRuntimeByNameQuery."""
- version: Optional[SemanticVersionRange] = None
- include_deprecated: Optional[StrictBool] = Field(
+ version: SemanticVersionRange | None = None
+ include_deprecated: StrictBool | None = Field(
default=False,
description="If set to `true`, deprecated runtimes will be included in the query.",
alias="includeDeprecated",
)
- function_type: Optional[List[FunctionType]] = Field(
+ function_type: List[FunctionType] | None = Field(
default=None,
description="If set, filters on the functionType
of a runtime. Uses an exact match.",
alias="functionType",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="If set, filters on the archiveFormat
of a runtime. Uses an exact match.",
alias="archiveFormat",
@@ -53,40 +56,37 @@ class GetRuntimeByNameQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetRuntimeByNameQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetRuntimeByNameQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetRuntimeByNameQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetRuntimeByNameQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetRuntimeByNameQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetRuntimeByNameQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_by_name_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_query.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_query.py
index 3552a9be..c26fd385 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,11 +29,11 @@
class GetRuntimeExampleQuery(BaseModel):
"""GetRuntimeExampleQuery."""
- ls: Optional[StrictBool] = Field(
+ ls: StrictBool | None = Field(
default=False,
description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime.",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=True,
description="If set to `true`, deprecated runtimes will be included in the query.",
alias="includeDeprecated",
@@ -43,40 +46,37 @@ class GetRuntimeExampleQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetRuntimeExampleQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetRuntimeExampleQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetRuntimeExampleQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetRuntimeExampleQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetRuntimeExampleQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetRuntimeExampleQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_example_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_query.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_query.py
index 05a17ed9..2a0a7aa2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -30,19 +33,19 @@
class GetRuntimeVersionsQuery(BaseModel):
"""GetRuntimeVersionsQuery."""
- version: Optional[SemanticVersionRange] = None
- latest: Optional[LatestVersionLevel] = None
- include_deprecated: Optional[StrictBool] = Field(
+ version: SemanticVersionRange | None = None
+ latest: LatestVersionLevel | None = None
+ include_deprecated: StrictBool | None = Field(
default=False,
description="If set to `true`, deprecated runtimes will be included in the query.",
alias="includeDeprecated",
)
- function_type: Optional[List[FunctionType]] = Field(
+ function_type: List[FunctionType] | None = Field(
default=None,
description="If set, filters on the functionType
of a runtime. Uses an exact match.",
alias="functionType",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="If set, filters on the archiveFormat
of a runtime. Uses an exact match.",
alias="archiveFormat",
@@ -55,40 +58,37 @@ class GetRuntimeVersionsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetRuntimeVersionsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetRuntimeVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetRuntimeVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetRuntimeVersionsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetRuntimeVersionsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetRuntimeVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_runtime_versions_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2.py
index 0dda2830..2c233586 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.get_webscript_response_v2_links import GetWebscriptResponseV2Links
@@ -38,40 +41,37 @@ class GetWebscriptResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetWebscriptResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetWebscriptResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetWebscriptResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetWebscriptResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetWebscriptResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetWebscriptResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_links.py b/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_links.py
index 66ab535d..38764f3e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_links.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,8 +29,8 @@
class GetWebscriptResponseV2Links(BaseModel):
"""HAL links to related actions.."""
- invoke: Optional[HALLink] = None
- jobs: Optional[HALLink] = None
+ invoke: HALLink | None = None
+ jobs: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class GetWebscriptResponseV2Links(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of GetWebscriptResponseV2Links from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetWebscriptResponseV2Links instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the GetWebscriptResponseV2Links instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of GetWebscriptResponseV2Links from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetWebscriptResponseV2Links instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetWebscriptResponseV2Links instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/get_webscript_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/hal_link.py
index 6b4f0b33..e5ebfade 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -34,40 +37,37 @@ class HALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of HALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the HALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the HALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of HALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a HALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a HALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response.py b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response.py
index dbe1c2f6..eb57ba57 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.invokable_webscript_response_entity import (
@@ -40,40 +43,37 @@ class InvokableWebscriptResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of InvokableWebscriptResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the InvokableWebscriptResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the InvokableWebscriptResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of InvokableWebscriptResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a InvokableWebscriptResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a InvokableWebscriptResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity.py b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity.py
index 40357e5c..ffddb366 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from ..models.invokable_webscript_response_entity_webscript import (
InvokableWebscriptResponseEntityWebscript,
@@ -32,7 +35,7 @@ class InvokableWebscriptResponseEntity(BaseModel):
status: Status
draft: StrictBool
webscript: InvokableWebscriptResponseEntityWebscript
- secret: Optional[StrictStr] = None
+ secret: StrictStr | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -41,40 +44,37 @@ class InvokableWebscriptResponseEntity(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of InvokableWebscriptResponseEntity from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the InvokableWebscriptResponseEntity instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the InvokableWebscriptResponseEntity instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of InvokableWebscriptResponseEntity from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a InvokableWebscriptResponseEntity instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a InvokableWebscriptResponseEntity instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscript.py b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscript.py
index 19e6ab8e..3df82b2f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscript.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscript.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -51,40 +54,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of InvokableWebscriptResponseEntityWebscript from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the InvokableWebscriptResponseEntityWebscript instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the InvokableWebscriptResponseEntityWebscript instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of InvokableWebscriptResponseEntityWebscript from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a InvokableWebscriptResponseEntityWebscript instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a InvokableWebscriptResponseEntityWebscript instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscriptobject.py b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscriptobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entity_webscriptobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entityobject.py b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entityobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_response_entityobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/invokable_webscript_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_link.py
index f2ca809c..2c0ed785 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class InvokeHALLink(BaseModel):
"""InvokeHALLink."""
- invoke: Optional[HALLink] = None
+ invoke: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class InvokeHALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of InvokeHALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the InvokeHALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the InvokeHALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of InvokeHALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a InvokeHALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a InvokeHALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/invoke_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_link.py
index 804d3ff0..2997a4ba 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.hal_link import HALLink
@@ -27,7 +30,7 @@
class InvokeInternalHALLink(BaseModel):
"""InvokeInternalHALLink."""
- invoke_internal: Optional[HALLink] = Field(default=None, alias="invoke-internal")
+ invoke_internal: HALLink | None = Field(default=None, alias="invoke-internal")
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class InvokeInternalHALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of InvokeInternalHALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the InvokeInternalHALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the InvokeInternalHALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of InvokeInternalHALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a InvokeInternalHALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a InvokeInternalHALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/invoke_internal_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_link.py
index b13ffefa..a56440d9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_link.py
@@ -10,20 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_hal_links import JobHALLinks
from ..models.model1 import Model1
from ..models.plug1 import Plug1
from ..models.webscript1 import Webscript1
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobAndFunctionHALLink = Union[
Annotated[Plug1, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_and_function_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_cause.py b/waylay_registry_types/src/waylay/services/registry/models/job_cause.py
index 45f5bfc1..e51f70ab 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_cause.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_cause.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -32,16 +35,16 @@ class JobCause(BaseModel):
reason: StrictStr = Field(
description="Human readable message describing the cause."
)
- backoff: Optional[StrictBool] = Field(
+ backoff: StrictBool | None = Field(
default=None,
description="If true
, recent failures of the job prevented the re-execution. Use forceVersion
or upgrade
parameter to force a rebuild.",
)
- new_value: Optional[StrictStr] = Field(
+ new_value: StrictStr | None = Field(
default=None,
description="The new configuration value that causes the change.",
alias="newValue",
)
- old_value: Optional[StrictStr] = Field(
+ old_value: StrictStr | None = Field(
default=None,
description="The old configuration value used by the last succeeded job.",
alias="oldValue",
@@ -54,40 +57,37 @@ class JobCause(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobCause from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobCause instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobCause instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobCause from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobCause instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobCause instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_causeobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_causeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_causeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_causes.py b/waylay_registry_types/src/waylay/services/registry/models/job_causes.py
index e5972fdb..119711b3 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_causes.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_causes.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.job_cause import JobCause
@@ -26,11 +29,11 @@
class JobCauses(BaseModel):
"""The motivations for including or excluding a job in response to a rebuild request.."""
- build: Optional[JobCause] = None
- deploy: Optional[JobCause] = None
- verify: Optional[JobCause] = None
- undeploy: Optional[JobCause] = None
- scale: Optional[JobCause] = None
+ build: JobCause | None = None
+ deploy: JobCause | None = None
+ verify: JobCause | None = None
+ undeploy: JobCause | None = None
+ scale: JobCause | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -39,40 +42,37 @@ class JobCauses(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobCauses from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobCauses instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobCauses instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobCauses from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobCauses instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobCauses instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_causesobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_causesobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_causesobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_data.py
index 7a35a33d..2153ee2c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.active_event_data import ActiveEventData
@@ -39,40 +42,37 @@ class JobEventPayloadActiveEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventPayloadActiveEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventPayloadActiveEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventPayloadActiveEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventPayloadActiveEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventPayloadActiveEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventPayloadActiveEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_active_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_data.py
index 90e93197..a3beae66 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.completed_event_data import CompletedEventData
@@ -39,40 +42,37 @@ class JobEventPayloadCompletedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventPayloadCompletedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventPayloadCompletedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventPayloadCompletedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventPayloadCompletedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventPayloadCompletedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventPayloadCompletedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_completed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_data.py
index 7f3d9315..cc32e247 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.delayed_event_data import DelayedEventData
@@ -39,40 +42,37 @@ class JobEventPayloadDelayedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventPayloadDelayedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventPayloadDelayedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventPayloadDelayedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventPayloadDelayedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventPayloadDelayedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventPayloadDelayedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_delayed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_data.py
index bd31f3a0..22c2c41b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.failed_event_data import FailedEventData
@@ -39,40 +42,37 @@ class JobEventPayloadFailedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventPayloadFailedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventPayloadFailedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventPayloadFailedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventPayloadFailedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventPayloadFailedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventPayloadFailedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_failed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_data.py
index 7afc979c..2854b7cc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.job_reference import JobReference
@@ -38,40 +41,37 @@ class JobEventPayloadWaitingChildrenEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventPayloadWaitingChildrenEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventPayloadWaitingChildrenEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventPayloadWaitingChildrenEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventPayloadWaitingChildrenEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventPayloadWaitingChildrenEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventPayloadWaitingChildrenEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_children_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_data.py
index 5ebfd702..66f49a9e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.job_reference import JobReference
@@ -39,40 +42,37 @@ class JobEventPayloadWaitingEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventPayloadWaitingEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventPayloadWaitingEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventPayloadWaitingEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventPayloadWaitingEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventPayloadWaitingEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventPayloadWaitingEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_payload_waiting_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_data.py
index 69d444e5..8b5d89ca 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.active_event_data import ActiveEventData
@@ -43,40 +46,37 @@ class JobEventResponseActiveEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventResponseActiveEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventResponseActiveEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventResponseActiveEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventResponseActiveEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventResponseActiveEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventResponseActiveEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_active_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_data.py
index 8b6b9e35..c4062efb 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.completed_event_data import CompletedEventData
@@ -43,40 +46,37 @@ class JobEventResponseCompletedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventResponseCompletedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventResponseCompletedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventResponseCompletedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventResponseCompletedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventResponseCompletedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventResponseCompletedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_completed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_data.py
index c2afcce5..92958c9a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.delayed_event_data import DelayedEventData
@@ -43,40 +46,37 @@ class JobEventResponseDelayedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventResponseDelayedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventResponseDelayedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventResponseDelayedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventResponseDelayedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventResponseDelayedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventResponseDelayedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_delayed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_data.py
index 38a25672..fbf17127 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.failed_event_data import FailedEventData
@@ -43,40 +46,37 @@ class JobEventResponseFailedEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventResponseFailedEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventResponseFailedEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventResponseFailedEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventResponseFailedEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventResponseFailedEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventResponseFailedEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_failed_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_data.py
index abd032ab..3234b9f9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -42,40 +45,37 @@ class JobEventResponseWaitingChildrenEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventResponseWaitingChildrenEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventResponseWaitingChildrenEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventResponseWaitingChildrenEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventResponseWaitingChildrenEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventResponseWaitingChildrenEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventResponseWaitingChildrenEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_children_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_data.py
index d3d8ef65..ab102b14 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,40 +46,37 @@ class JobEventResponseWaitingEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventResponseWaitingEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventResponseWaitingEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventResponseWaitingEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventResponseWaitingEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventResponseWaitingEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventResponseWaitingEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_response_waiting_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_sse.py
index eda8f3c4..17b75eec 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_event_sse.py
@@ -10,8 +10,13 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.active_event_sse import ActiveEventSSE
from ..models.completed_event_sse import CompletedEventSSE
from ..models.delayed_event_sse import DelayedEventSSE
@@ -20,12 +25,19 @@
from ..models.waiting_event_sse import WaitingEventSSE
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobEventSSE = Union[
Annotated[ActiveEventSSE, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_link.py
index 062e7458..b430fdd7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_link.py
@@ -10,20 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_events_hal_link import JobEventsHALLink
from ..models.model import Model
from ..models.plug import Plug
from ..models.webscript import Webscript
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobEventsAndFunctionHALLink = Union[
Annotated[Plug, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_events_and_function_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_query.py b/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_query.py
index 0c704d89..7f3d7c1c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.job_type import JobType
@@ -27,9 +30,9 @@
class JobEventsFilterQuery(BaseModel):
"""JobEventsFilterQuery."""
- type: Optional[JobType] = None
- id: Optional[StrictStr] = Field(default=None, description="The id of the job.")
- children: Optional[StrictBool] = Field(
+ type: JobType | None = None
+ id: StrictStr | None = Field(default=None, description="The id of the job.")
+ children: StrictBool | None = Field(
default=None,
description="If set to true
, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to false
.",
)
@@ -41,40 +44,37 @@ class JobEventsFilterQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventsFilterQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventsFilterQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventsFilterQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventsFilterQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventsFilterQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventsFilterQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_events_filter_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_link.py
index 8ea1208b..bb80a0d5 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class JobEventsHALLink(BaseModel):
"""HAL links to related actions.."""
- event: Optional[HALLink] = None
+ event: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class JobEventsHALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobEventsHALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobEventsHALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobEventsHALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobEventsHALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobEventsHALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobEventsHALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_events_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_hal_links.py b/waylay_registry_types/src/waylay/services/registry/models/job_hal_links.py
index 93d8a164..4b70196c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_hal_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_hal_links.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,8 +29,8 @@
class JobHALLinks(BaseModel):
"""HAL links to related actions.."""
- event: Optional[HALLink] = None
- job: Optional[HALLink] = None
+ event: HALLink | None = None
+ job: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class JobHALLinks(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobHALLinks from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobHALLinks instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobHALLinks instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobHALLinks from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobHALLinks instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobHALLinks instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_hal_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_hal_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_hal_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_query.py b/waylay_registry_types/src/waylay/services/registry/models/job_query.py
index 0c4d755f..77eb83b7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel
from pydantic import Field
from typing_extensions import Annotated
@@ -31,26 +34,25 @@
class JobQuery(BaseModel):
"""JobQuery."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- type: Optional[List[JobTypeSchema]] = Field(
+ type: List[JobTypeSchema] | None = Field(
default=None, description="Filter on job type"
)
- state: Optional[List[JobStateResult]] = Field(
+ state: List[JobStateResult] | None = Field(
default=None, description="Filter on job state"
)
- function_type: Optional[List[FunctionType]] = Field(
+ function_type: List[FunctionType] | None = Field(
default=None, description="Filter on function type", alias="functionType"
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
model_config = ConfigDict(
populate_by_name=True,
@@ -59,40 +61,37 @@ class JobQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_reference.py b/waylay_registry_types/src/waylay/services/registry/models/job_reference.py
index e58df53b..7b7679ae 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_reference.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_reference.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from ..models.job_type import JobType
@@ -27,7 +30,7 @@ class JobReference(BaseModel):
"""JobReference."""
type: JobType
- id: Optional[StrictStr] = None
+ id: StrictStr | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class JobReference(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobReference from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobReference instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobReference instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobReference from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobReference instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobReference instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_reference_params.py b/waylay_registry_types/src/waylay/services/registry/models/job_reference_params.py
index be48740e..30f480db 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_reference_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_reference_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.job_type import JobType
@@ -36,40 +39,37 @@ class JobReferenceParams(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobReferenceParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobReferenceParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobReferenceParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobReferenceParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobReferenceParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobReferenceParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_reference_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_reference_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_reference_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_referenceobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_referenceobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_referenceobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_response.py b/waylay_registry_types/src/waylay/services/registry/models/job_response.py
index 67b57425..894301b3 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.any_job_status import AnyJobStatus
@@ -38,40 +41,37 @@ class JobResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state.py b/waylay_registry_types/src/waylay/services/registry/models/job_state.py
index b1563f15..54951126 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state.py
@@ -10,8 +10,13 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_state_active import JobStateActive
from ..models.job_state_delayed import JobStateDelayed
from ..models.job_state_finished import JobStateFinished
@@ -19,12 +24,19 @@
from ..models.job_state_waiting_children import JobStateWaitingChildren
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobState = Union[
Annotated[JobStateFinished, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_active.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_active.py
index a645176f..97f92f48 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_active.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_active.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateActive(str, Enum):
"""The job is running.."""
- """
- allowed enum values
- """
ACTIVE = "active"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateActive from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateActive."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateActive."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_activeobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_activeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_activeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_completed.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_completed.py
index 26800253..82ebc558 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_completed.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_completed.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateCompleted(str, Enum):
"""The job has completed successfully.."""
- """
- allowed enum values
- """
COMPLETED = "completed"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateCompleted from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateCompleted."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateCompleted."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_completedobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_completedobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_completedobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_delayed.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_delayed.py
index 4d8710b3..b53462f4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_delayed.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_delayed.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateDelayed(str, Enum):
"""The job has been delayed for retry after a failure.."""
- """
- allowed enum values
- """
DELAYED = "delayed"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateDelayed from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateDelayed."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateDelayed."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_delayedobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_delayedobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_delayedobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_failed.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_failed.py
index e4590d34..2583d90e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_failed.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_failed.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateFailed(str, Enum):
"""The job failed in execution.."""
- """
- allowed enum values
- """
FAILED = "failed"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateFailed from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateFailed."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateFailed."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_failedobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_failedobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_failedobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_finished.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_finished.py
index 7398384b..daf89e32 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_finished.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_finished.py
@@ -10,18 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_state_completed import JobStateCompleted
from ..models.job_state_failed import JobStateFailed
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobStateFinished = Union[
Annotated[JobStateCompleted, ""], Annotated[JobStateFailed, ""]
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_finishedobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_finishedobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_finishedobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_result.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_result.py
index 36854f92..98bfec29 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_result.py
@@ -10,18 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_state import JobState
from ..models.job_state_unknown import JobStateUnknown
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobStateResult = Union[Annotated[JobState, ""], Annotated[JobStateUnknown, ""]]
"""All reported job states."""
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_unknown.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_unknown.py
index b0ead6a8..106a7bd7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_unknown.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_unknown.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateUnknown(str, Enum):
"""The job state is unknown (undocument or inconsistent).."""
- """
- allowed enum values
- """
UNKNOWN = "unknown"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateUnknown from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateUnknown."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateUnknown."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_unknownobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_unknownobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_unknownobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting.py
index 02427d7c..acda51bd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateWaiting(str, Enum):
"""The job has been queued for execution, but might be waiting because of rate limiting.."""
- """
- allowed enum values
- """
WAITING = "waiting"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateWaiting from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateWaiting."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateWaiting."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_children.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_children.py
index a42eeb56..612f322a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_children.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_children.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobStateWaitingChildren(str, Enum):
"""The job is waiting for child jobs to be completed.."""
- """
- allowed enum values
- """
WAITING_MINUS_CHILDREN = "waiting-children"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStateWaitingChildren from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobStateWaitingChildren."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobStateWaitingChildren."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_childrenobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_childrenobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_waiting_childrenobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_state_waitingobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_state_waitingobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_state_waitingobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_stateobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_stateobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_stateobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status.py b/waylay_registry_types/src/waylay/services/registry/models/job_status.py
index c4e13baf..f7ebade1 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr
from pydantic import Field
from ..models.job_status_progress import JobStatusProgress
@@ -31,12 +34,12 @@ class JobStatus(BaseModel):
id: StrictStr
name: StrictStr
progress: JobStatusProgress
- attempts_made: Union[StrictFloat, StrictInt] = Field(alias="attemptsMade")
- finished_on: Optional[datetime] = Field(default=None, alias="finishedOn")
- processed_on: Optional[datetime] = Field(default=None, alias="processedOn")
- failed_reason: Optional[StrictStr] = Field(default=None, alias="failedReason")
- parent: Optional[ParentKeys] = None
- delay: Optional[Union[StrictFloat, StrictInt]] = None
+ attempts_made: StrictFloat | StrictInt = Field(alias="attemptsMade")
+ finished_on: datetime | None = Field(default=None, alias="finishedOn")
+ processed_on: datetime | None = Field(default=None, alias="processedOn")
+ failed_reason: StrictStr | None = Field(default=None, alias="failedReason")
+ parent: ParentKeys | None = None
+ delay: StrictFloat | StrictInt | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -45,40 +48,37 @@ class JobStatus(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_links.py b/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_links.py
index 82443f91..96e6c0cf 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_links.py
@@ -10,20 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_status_hal_link import JobStatusHALLink
from ..models.model2 import Model2
from ..models.plug2 import Plug2
from ..models.webscript2 import Webscript2
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobStatusAndEntityHALLinks = Union[
Annotated[Plug2, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status_and_entity_hal_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_link.py
index a18a9da7..ed4ff3ee 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class JobStatusHALLink(BaseModel):
"""HAL links to related actions.."""
- job: Optional[HALLink] = None
+ job: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class JobStatusHALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobStatusHALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobStatusHALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobStatusHALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobStatusHALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobStatusHALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobStatusHALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status_progress.py b/waylay_registry_types/src/waylay/services/registry/models/job_status_progress.py
index 527f9356..11fa6378 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status_progress.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_status_progress.py
@@ -10,17 +10,36 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
-from typing import Union
+from typing import Any, Dict, Optional, Union
+from pydantic import (
+ BaseModel,
+ Field,
+ StrictFloat,
+ StrictInt,
+ StrictStr,
+ ValidationError,
+ field_validator,
+)
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobStatusProgress = Union[Annotated[float, ""], Annotated[object, ""]]
"""JobStatusProgress."""
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_status_progressobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_status_progressobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_status_progressobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_submitted_response.py b/waylay_registry_types/src/waylay/services/registry/models/job_submitted_response.py
index 425e963d..892ff7aa 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_submitted_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_submitted_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -37,40 +40,37 @@ class JobSubmittedResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobSubmittedResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobSubmittedResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobSubmittedResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobSubmittedResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobSubmittedResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobSubmittedResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_submitted_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_submitted_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_submitted_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type.py b/waylay_registry_types/src/waylay/services/registry/models/job_type.py
index 034ce3da..6eaf2607 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class JobType(str, Enum):
"""JobType."""
- """
- allowed enum values
- """
BUILD = "build"
DEPLOY = "deploy"
VERIFY = "verify"
@@ -35,15 +33,5 @@ class JobType(str, Enum):
CLEANUP = "cleanup"
OTHER = "other"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobType from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobType."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobType."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_batch.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_batch.py
index a52f50b1..384e1fa2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_batch.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_batch.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobTypeBatch(str, Enum):
"""A job that groups other jobs as a parent.."""
- """
- allowed enum values
- """
BATCH = "batch"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobTypeBatch from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobTypeBatch."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobTypeBatch."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_batchobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_batchobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_batchobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_build.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_build.py
index 6110242c..166c78f2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_build.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_build.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobTypeBuild(str, Enum):
"""Build."""
- """
- allowed enum values
- """
BUILD = "build"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobTypeBuild from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobTypeBuild."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobTypeBuild."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_buildobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_buildobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_buildobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_deploy.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_deploy.py
index b096d98a..ffe82c91 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_deploy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_deploy.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobTypeDeploy(str, Enum):
"""A job that deploys a function image to the openfaas runtime.."""
- """
- allowed enum values
- """
DEPLOY = "deploy"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobTypeDeploy from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobTypeDeploy."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobTypeDeploy."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_deployobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_deployobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_deployobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_scale.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_scale.py
index fc5d9c66..4a273afc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_scale.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_scale.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobTypeScale(str, Enum):
"""A job that scales a function to a target.."""
- """
- allowed enum values
- """
SCALE = "scale"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobTypeScale from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobTypeScale."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobTypeScale."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_scaleobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_scaleobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_scaleobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_schema.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_schema.py
index 148c59d9..2c76ca76 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_schema.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_schema.py
@@ -10,8 +10,13 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.job_type_batch import JobTypeBatch
from ..models.job_type_build import JobTypeBuild
from ..models.job_type_deploy import JobTypeDeploy
@@ -20,12 +25,19 @@
from ..models.job_type_verify import JobTypeVerify
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
JobTypeSchema = Union[
Annotated[JobTypeBuild, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_schemaobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_schemaobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_schemaobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_undeploy.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_undeploy.py
index 949b9282..d98dd510 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_undeploy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_undeploy.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobTypeUndeploy(str, Enum):
"""A job that undeploys a deployed function and removes it from the registry.."""
- """
- allowed enum values
- """
UNDEPLOY = "undeploy"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobTypeUndeploy from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobTypeUndeploy."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobTypeUndeploy."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_undeployobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_undeployobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_undeployobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_verify.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_verify.py
index 26976c2f..b95a9087 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_verify.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/job_type_verify.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class JobTypeVerify(str, Enum):
"""A job that checks the health of a deployed function.."""
- """
- allowed enum values
- """
VERIFY = "verify"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobTypeVerify from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of JobTypeVerify."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of JobTypeVerify."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_type_verifyobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_type_verifyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_type_verifyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/job_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/job_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/job_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2.py
index f62b7972..df51ab61 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.any_job_for_function import AnyJobForFunction
@@ -33,7 +36,7 @@ class JobsForModelResponseV2(BaseModel):
description="Listing of jobs related to the function deployment. This includes active jobs, and the most recently failed job (per type) that was archived on the entity."
)
function: FunctionRef
- links: Optional[JobsForModelResponseV2Links] = Field(default=None, alias="_links")
+ links: JobsForModelResponseV2Links | None = Field(default=None, alias="_links")
model_config = ConfigDict(
populate_by_name=True,
@@ -42,40 +45,37 @@ class JobsForModelResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsForModelResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsForModelResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsForModelResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsForModelResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsForModelResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsForModelResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_links.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_links.py
index d8c118f5..8af0d20b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_links.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class JobsForModelResponseV2Links(BaseModel):
"""Link to the function entity.."""
- model: Optional[HALLink] = None
+ model: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class JobsForModelResponseV2Links(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsForModelResponseV2Links from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsForModelResponseV2Links instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsForModelResponseV2Links instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsForModelResponseV2Links from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsForModelResponseV2Links instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsForModelResponseV2Links instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_model_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2.py
index 9f64fbbd..f9656c15 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.any_job_for_function import AnyJobForFunction
@@ -33,7 +36,7 @@ class JobsForPlugResponseV2(BaseModel):
description="Listing of jobs related to the function deployment. This includes active jobs, and the most recently failed job (per type) that was archived on the entity."
)
function: FunctionRef
- links: Optional[JobsForPlugResponseV2Links] = Field(default=None, alias="_links")
+ links: JobsForPlugResponseV2Links | None = Field(default=None, alias="_links")
model_config = ConfigDict(
populate_by_name=True,
@@ -42,40 +45,37 @@ class JobsForPlugResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsForPlugResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsForPlugResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsForPlugResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsForPlugResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsForPlugResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsForPlugResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_links.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_links.py
index 8a9a2c3a..e99cc368 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_links.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class JobsForPlugResponseV2Links(BaseModel):
"""Link to the function entity.."""
- plug: Optional[HALLink] = None
+ plug: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class JobsForPlugResponseV2Links(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsForPlugResponseV2Links from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsForPlugResponseV2Links instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsForPlugResponseV2Links instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsForPlugResponseV2Links from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsForPlugResponseV2Links instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsForPlugResponseV2Links instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_plug_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2.py
index 6b5e4585..b02c5663 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.any_job_for_function import AnyJobForFunction
@@ -35,9 +38,7 @@ class JobsForWebscriptResponseV2(BaseModel):
description="Listing of jobs related to the function deployment. This includes active jobs, and the most recently failed job (per type) that was archived on the entity."
)
function: FunctionRef
- links: Optional[JobsForWebscriptResponseV2Links] = Field(
- default=None, alias="_links"
- )
+ links: JobsForWebscriptResponseV2Links | None = Field(default=None, alias="_links")
model_config = ConfigDict(
populate_by_name=True,
@@ -46,40 +47,37 @@ class JobsForWebscriptResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsForWebscriptResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsForWebscriptResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsForWebscriptResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsForWebscriptResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsForWebscriptResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsForWebscriptResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_links.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_links.py
index 366f6d68..b1803863 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_links.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_links.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class JobsForWebscriptResponseV2Links(BaseModel):
"""Link to the function entity.."""
- webscript: Optional[HALLink] = None
+ webscript: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class JobsForWebscriptResponseV2Links(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsForWebscriptResponseV2Links from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsForWebscriptResponseV2Links instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsForWebscriptResponseV2Links instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsForWebscriptResponseV2Links from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsForWebscriptResponseV2Links instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsForWebscriptResponseV2Links instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_linksobject.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_linksobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2_linksobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_for_webscript_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_link.py
index 05fd1fad..82313557 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class JobsHALLink(BaseModel):
"""JobsHALLink."""
- jobs: Optional[HALLink] = None
+ jobs: HALLink | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class JobsHALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsHALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsHALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsHALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsHALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsHALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsHALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_response.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_response.py
index 2e680388..3f50b0e4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/jobs_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.any_job_status_summary import AnyJobStatusSummary
@@ -27,7 +30,7 @@
class JobsResponse(BaseModel):
"""Jobs Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
jobs: List[AnyJobStatusSummary] = Field(
@@ -41,40 +44,37 @@ class JobsResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of JobsResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the JobsResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of JobsResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/jobs_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/jobs_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/jobs_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sse.py
index c9d14f13..4cdea48a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sse.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.event_keep_alive import EventKeepAlive
@@ -28,7 +31,7 @@ class KeepAliveEventSSE(BaseModel):
"""A message that acknowledges that the stream is still alive.."""
event: EventKeepAlive
- data: Optional[StrictStr] = Field(
+ data: StrictStr | None = Field(
default=None,
description="A text message acknowledging that events will be forwarded.",
)
@@ -40,40 +43,37 @@ class KeepAliveEventSSE(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KeepAliveEventSSE from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KeepAliveEventSSE instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KeepAliveEventSSE instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KeepAliveEventSSE from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KeepAliveEventSSE instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KeepAliveEventSSE instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/keep_alive_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_response.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_response.py
index 9ef378bc..153bebf4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -35,40 +38,37 @@ class KFServingDeleteMultipleResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingDeleteMultipleResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingDeleteMultipleResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingDeleteMultipleResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingDeleteMultipleResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingDeleteMultipleResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingDeleteMultipleResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_response.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_response.py
index 67281549..03b96fdc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class KFServingDeleteMultipleWithJobResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingDeleteMultipleWithJobResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingDeleteMultipleWithJobResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingDeleteMultipleWithJobResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingDeleteMultipleWithJobResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingDeleteMultipleWithJobResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingDeleteMultipleWithJobResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_multiple_with_job_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1.py
index 738d64b9..c2762556 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,74 +34,72 @@
class KFServingDeleteQueryV1(BaseModel):
"""KFServingDeleteQueryV1."""
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=False,
description="If this is set to true
, the server will start the required job actions asynchronously and return a 202
Accepted response. Otherwise, the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -109,40 +110,37 @@ class KFServingDeleteQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingDeleteQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingDeleteQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingDeleteQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingDeleteQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingDeleteQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingDeleteQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2.py
index f3d93708..bff299b7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -26,19 +29,19 @@
class KFServingDeleteQueryV2(BaseModel):
"""KFServingDeleteQueryV2."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.",
)
- undeploy: Optional[StrictBool] = Field(
+ undeploy: StrictBool | None = Field(
default=None,
description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
@@ -51,40 +54,37 @@ class KFServingDeleteQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingDeleteQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingDeleteQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingDeleteQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingDeleteQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingDeleteQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingDeleteQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_response.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_response.py
index d968d85e..ebb38eb8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -49,40 +52,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingDeleteResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingDeleteResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingDeleteResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingDeleteResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingDeleteResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingDeleteResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_response.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_response.py
index e9d93a59..8bc7bf3b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -52,40 +55,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingDeleteWithJobResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingDeleteWithJobResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingDeleteWithJobResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingDeleteWithJobResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingDeleteWithJobResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingDeleteWithJobResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_delete_with_job_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2.py
index 0588b813..86317bc8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,12 +29,12 @@
class KFServingLatestVersionQueryV2(BaseModel):
"""Named Model latest version query.."""
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
@@ -44,40 +47,37 @@ class KFServingLatestVersionQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingLatestVersionQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingLatestVersionQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingLatestVersionQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingLatestVersionQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingLatestVersionQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingLatestVersionQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_version_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1.py
index cfebb38a..8d6ce110 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,69 +34,67 @@
class KFServingLatestVersionsQueryV1(BaseModel):
"""Model listing query."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -104,40 +105,37 @@ class KFServingLatestVersionsQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingLatestVersionsQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingLatestVersionsQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingLatestVersionsQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingLatestVersionsQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingLatestVersionsQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingLatestVersionsQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2.py
index af67e7f4..9b8d93d8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2.py
@@ -10,18 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.latest_function_versions_query import LatestFunctionVersionsQuery
from ..models.latest_functions_query import LatestFunctionsQuery
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
KFServingLatestVersionsQueryV2 = Union[
Annotated[LatestFunctionVersionsQuery, ""], Annotated[LatestFunctionsQuery, ""]
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_latest_versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifest.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifest.py
index f91a3e2e..433dedc0 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifest.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifest.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -30,13 +33,13 @@
class KFServingManifest(BaseModel):
"""KFServingManifest."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -58,40 +61,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingManifest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingManifest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingManifest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingManifest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingManifest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingManifest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifestobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_manifestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_response.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_response.py
index 0f304e7b..40fc1615 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.kf_serving_response import KFServingResponse
from ..models.paging_response import PagingResponse
@@ -28,7 +31,7 @@ class KFServingModelsResponse(BaseModel):
"""Successful Response."""
models: List[KFServingResponse]
- paging: Optional[PagingResponse] = None
+ paging: PagingResponse | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -37,40 +40,37 @@ class KFServingModelsResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingModelsResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingModelsResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingModelsResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingModelsResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingModelsResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingModelsResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_models_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_response.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_response.py
index 3669dfff..855558aa 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -33,13 +36,13 @@
class KFServingResponse(BaseModel):
"""Successful Response."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -57,8 +60,8 @@ class KFServingResponse(BaseModel):
alias="updatedAt",
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
- links: Optional[List[JobHALLinks]] = Field(
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
+ links: List[JobHALLinks] | None = Field(
default=None, description="Links to related entities.", alias="_links"
)
@@ -79,40 +82,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1.py
index 640db062..d4912f69 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,59 +34,57 @@
class KFServingVersionsQueryV1(BaseModel):
"""Named model versions query."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -94,40 +95,37 @@ class KFServingVersionsQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KFServingVersionsQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KFServingVersionsQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KFServingVersionsQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KFServingVersionsQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KFServingVersionsQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KFServingVersionsQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kf_serving_versions_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2.py
index 4f244c38..cae09531 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -48,7 +51,7 @@ class KfservingResponseV2(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this function is deprecated and removed from regular listings."
@@ -65,40 +68,37 @@ class KfservingResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of KfservingResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the KfservingResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the KfservingResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of KfservingResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a KfservingResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a KfservingResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/kfserving_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/language_release.py b/waylay_registry_types/src/waylay/services/registry/models/language_release.py
index c60f11af..08d0a425 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/language_release.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/language_release.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -33,7 +36,7 @@ class LanguageRelease(BaseModel):
description="Release version of the language or framework."
)
title: StrictStr = Field(description="Display title.")
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -42,40 +45,37 @@ class LanguageRelease(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LanguageRelease from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LanguageRelease instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LanguageRelease instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LanguageRelease from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LanguageRelease instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LanguageRelease instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/language_releaseobject.py b/waylay_registry_types/src/waylay/services/registry/models/language_releaseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/language_releaseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_query.py b/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_query.py
index 2dda877e..6676b983 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_query.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
-from pydantic import BaseModel, StrictBool, StrictStr
+from typing import Any, ClassVar, Dict, List, Optional, Union
+from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
from ..models.archive_format import ArchiveFormat
@@ -31,83 +34,81 @@
class LatestFunctionVersionsQuery(BaseModel):
"""Latest function versions listing query.."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- name_version: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
+ name_version: List[Annotated[str, Field(strict=True)]] | None = Field(
default=None,
description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered.",
alias="nameVersion",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
- latest: Optional[StrictBool] = Field(
+ latest: StrictBool | None = Field(
default=None,
description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter.",
)
@@ -119,40 +120,37 @@ class LatestFunctionVersionsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestFunctionVersionsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestFunctionVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestFunctionVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestFunctionVersionsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestFunctionVersionsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestFunctionVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_function_versions_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_functions_query.py b/waylay_registry_types/src/waylay/services/registry/models/latest_functions_query.py
index b4eb229f..b3fff330 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_functions_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_functions_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -28,44 +31,42 @@
class LatestFunctionsQuery(BaseModel):
"""Request to list latest function versions per named function. A request that only uses these query parameters will include links to the _latest_ draft/published versions.."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -76,40 +77,37 @@ class LatestFunctionsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestFunctionsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestFunctionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestFunctionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestFunctionsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestFunctionsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestFunctionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_functions_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_functions_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_functions_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2.py
index 75f27b82..73d17eb6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.latest_models_response_v2_entities_inner import (
@@ -29,13 +32,13 @@
class LatestModelsResponseV2(BaseModel):
"""Models Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[LatestModelsResponseV2EntitiesInner] = Field(
@@ -49,40 +52,37 @@ class LatestModelsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestModelsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestModelsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestModelsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestModelsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestModelsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestModelsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_inner.py b/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_inner.py
index 13215564..57504b78 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_inner.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_inner.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.alt_version_hal_link import AltVersionHALLink
@@ -50,7 +53,7 @@ class LatestModelsResponseV2EntitiesInner(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this function is deprecated and removed from regular listings."
@@ -67,40 +70,37 @@ class LatestModelsResponseV2EntitiesInner(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestModelsResponseV2EntitiesInner from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestModelsResponseV2EntitiesInner instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestModelsResponseV2EntitiesInner instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestModelsResponseV2EntitiesInner from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestModelsResponseV2EntitiesInner instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestModelsResponseV2EntitiesInner instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_innerobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_innerobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2_entities_innerobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_models_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_query.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_query.py
index 1ea2bbc6..2b1c61fd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -33,70 +36,68 @@
class LatestPlugQuery(BaseModel):
"""LatestPlugQuery."""
- tags: Optional[TagsFilter] = None
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ tags: TagsFilter | None = None
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
type: PlugType
@@ -108,40 +109,37 @@ class LatestPlugQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestPlugQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestPlugQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestPlugQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestPlugQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestPlugQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestPlugQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2.py
index faa4a4ec..5ccb2d5a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
from ..models.plug_type import PlugType
@@ -27,13 +30,13 @@
class LatestPlugVersionQueryV2(BaseModel):
"""Latest named plug version listing query."""
- type: Optional[PlugType] = None
- include_draft: Optional[StrictBool] = Field(
+ type: PlugType | None = None
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
@@ -46,40 +49,37 @@ class LatestPlugVersionQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestPlugVersionQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestPlugVersionQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestPlugVersionQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestPlugVersionQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestPlugVersionQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestPlugVersionQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_version_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query.py
index 2b00f6fa..76148009 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
-from pydantic import BaseModel, StrictBool, StrictStr
+from typing import Any, ClassVar, Dict, List, Optional, Union
+from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
from ..models.archive_format import ArchiveFormat
@@ -33,85 +36,83 @@
class LatestPlugVersionsQuery(BaseModel):
"""Plug versions listing query.."""
- tags: Optional[TagsFilter] = None
- type: Optional[PlugType] = None
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ tags: TagsFilter | None = None
+ type: PlugType | None = None
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- name_version: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
+ name_version: List[Annotated[str, Field(strict=True)]] | None = Field(
default=None,
description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered.",
alias="nameVersion",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
- latest: Optional[StrictBool] = Field(
+ latest: StrictBool | None = Field(
default=None,
description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter.",
)
@@ -123,40 +124,37 @@ class LatestPlugVersionsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestPlugVersionsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestPlugVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestPlugVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestPlugVersionsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestPlugVersionsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestPlugVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2.py
index eb2cf8b2..d5c91764 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2.py
@@ -10,18 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.latest_plug_versions_query import LatestPlugVersionsQuery
from ..models.latest_plugs_query import LatestPlugsQuery
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
LatestPlugVersionsQueryV2 = Union[
Annotated[LatestPlugVersionsQuery, ""], Annotated[LatestPlugsQuery, ""]
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plug_versions_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_query.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_query.py
index 23a3679c..514525f5 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -29,45 +32,43 @@
class LatestPlugsQuery(BaseModel):
"""Latest plug versions listing query with latest links. A request that only uses these query parameters will include links to the _latest_ draft/published versions of the plug.."""
- type: Optional[PlugType] = None
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ type: PlugType | None = None
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -78,40 +79,37 @@ class LatestPlugsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestPlugsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestPlugsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestPlugsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestPlugsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestPlugsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestPlugsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2.py
index 1b5bd298..2b76007e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.latest_plugs_response_v2_entities_inner import (
@@ -29,13 +32,13 @@
class LatestPlugsResponseV2(BaseModel):
"""Plugs Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[LatestPlugsResponseV2EntitiesInner] = Field(
@@ -49,40 +52,37 @@ class LatestPlugsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestPlugsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestPlugsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestPlugsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestPlugsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestPlugsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestPlugsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_inner.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_inner.py
index 85cb2c84..83abaca0 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_inner.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_inner.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.alt_version_hal_link import AltVersionHALLink
@@ -50,7 +53,7 @@ class LatestPlugsResponseV2EntitiesInner(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this plug is removed from regular listings, as a result of a DELETE
with force=false
."
@@ -67,40 +70,37 @@ class LatestPlugsResponseV2EntitiesInner(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestPlugsResponseV2EntitiesInner from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestPlugsResponseV2EntitiesInner instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestPlugsResponseV2EntitiesInner instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestPlugsResponseV2EntitiesInner from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestPlugsResponseV2EntitiesInner instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestPlugsResponseV2EntitiesInner instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_innerobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_innerobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2_entities_innerobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_plugs_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_version_level.py b/waylay_registry_types/src/waylay/services/registry/models/latest_version_level.py
index 573b20cd..54af4641 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_version_level.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_version_level.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,24 +24,11 @@
class LatestVersionLevel(str, Enum):
"""Level of latest versions that should be included.."""
- """
- allowed enum values
- """
MAJOR = "major"
MINOR = "minor"
PATCH = "patch"
TRUE = "true"
FALSE = "false"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestVersionLevel from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of LatestVersionLevel."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of LatestVersionLevel."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_version_levelobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_version_levelobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_version_levelobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2.py
index cbc5aee4..288e48f0 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.latest_webscripts_response_v2_entities_inner import (
@@ -29,13 +32,13 @@
class LatestWebscriptsResponseV2(BaseModel):
"""Webscripts Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[LatestWebscriptsResponseV2EntitiesInner] = Field(
@@ -49,40 +52,37 @@ class LatestWebscriptsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestWebscriptsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestWebscriptsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestWebscriptsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestWebscriptsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestWebscriptsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestWebscriptsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_inner.py b/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_inner.py
index d3d7ab50..2c08a045 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_inner.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_inner.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -50,7 +53,7 @@ class LatestWebscriptsResponseV2EntitiesInner(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this function is deprecated and removed from regular listings."
@@ -59,7 +62,7 @@ class LatestWebscriptsResponseV2EntitiesInner(BaseModel):
description="If true
this function is a draft function and it's assets are still mutable."
)
webscript: WebscriptManifest
- secret: Optional[StrictStr] = Field(
+ secret: StrictStr | None = Field(
default=None,
description="The secret for this webscript deployment. This is null
when allowHmac=false
in the webscript specificaton.",
)
@@ -71,40 +74,37 @@ class LatestWebscriptsResponseV2EntitiesInner(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LatestWebscriptsResponseV2EntitiesInner from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LatestWebscriptsResponseV2EntitiesInner instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LatestWebscriptsResponseV2EntitiesInner instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LatestWebscriptsResponseV2EntitiesInner from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LatestWebscriptsResponseV2EntitiesInner instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LatestWebscriptsResponseV2EntitiesInner instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_innerobject.py b/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_innerobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2_entities_innerobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/latest_webscripts_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object.py
index 34daaee6..90bbd650 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.legacy_configuration_object_format import LegacyConfigurationObjectFormat
@@ -30,9 +33,9 @@ class LegacyConfigurationObject(BaseModel):
name: StrictStr
type: PlugPropertyDataType
- mandatory: Optional[StrictBool] = None
- format: Optional[LegacyConfigurationObjectFormat] = None
- default_value: Optional[Any] = Field(default=None, alias="defaultValue")
+ mandatory: StrictBool | None = None
+ format: LegacyConfigurationObjectFormat | None = None
+ default_value: Any | None = Field(default=None, alias="defaultValue")
model_config = ConfigDict(
populate_by_name=True,
@@ -41,45 +44,37 @@ class LegacyConfigurationObject(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyConfigurationObject from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyConfigurationObject instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyConfigurationObject instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- # set to None if default_value (nullable) is None
- # and model_fields_set contains the field
- if self.default_value is None and "default_value" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["defaultValue"] = None
-
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyConfigurationObject from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyConfigurationObject instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyConfigurationObject instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_format.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_format.py
index dafe71b1..63739dc6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_format.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_format.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.plug_property_format_type import PlugPropertyFormatType
@@ -26,8 +29,8 @@
class LegacyConfigurationObjectFormat(BaseModel):
"""LegacyConfigurationObjectFormat."""
- type: Optional[PlugPropertyFormatType] = None
- values: Optional[List[Any]] = None
+ type: PlugPropertyFormatType | None = None
+ values: List[Any] | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class LegacyConfigurationObjectFormat(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyConfigurationObjectFormat from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyConfigurationObjectFormat instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyConfigurationObjectFormat instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyConfigurationObjectFormat from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyConfigurationObjectFormat instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyConfigurationObjectFormat instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_formatobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_formatobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_object_formatobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_objectobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_objectobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_objectobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_object.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_object.py
index c455516f..e9a5859e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_object.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_object.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.legacy_configuration_object_format import LegacyConfigurationObjectFormat
@@ -30,10 +33,10 @@ class LegacyConfigurationResponseObject(BaseModel):
name: StrictStr
type: PlugPropertyDataType
- mandatory: Optional[StrictBool] = None
- format: Optional[LegacyConfigurationObjectFormat] = None
- default_value: Optional[Any] = Field(default=None, alias="defaultValue")
- sensitive: Optional[StrictBool] = None
+ mandatory: StrictBool | None = None
+ format: LegacyConfigurationObjectFormat | None = None
+ default_value: Any | None = Field(default=None, alias="defaultValue")
+ sensitive: StrictBool | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -42,45 +45,37 @@ class LegacyConfigurationResponseObject(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyConfigurationResponseObject from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyConfigurationResponseObject instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyConfigurationResponseObject instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- # set to None if default_value (nullable) is None
- # and model_fields_set contains the field
- if self.default_value is None and "default_value" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["defaultValue"] = None
-
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyConfigurationResponseObject from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyConfigurationResponseObject instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyConfigurationResponseObject instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_objectobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_objectobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_configuration_response_objectobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_response.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_response.py
index 01ae8261..250e7955 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -35,40 +38,37 @@ class LegacyCreateDebugResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyCreateDebugResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyCreateDebugResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyCreateDebugResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyCreateDebugResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyCreateDebugResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyCreateDebugResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_create_debug_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifest.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifest.py
index c5e03782..ca23b352 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifest.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifest.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -30,18 +33,18 @@
class LegacyDebugPlugManifest(BaseModel):
"""LegacyDebugPlugManifest."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
tenant: StrictStr
- dependencies: Optional[Dict[str, StrictStr]] = None
+ dependencies: Dict[str, StrictStr] | None = None
script: StrictStr
@field_validator("version")
@@ -61,40 +64,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyDebugPlugManifest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyDebugPlugManifest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyDebugPlugManifest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyDebugPlugManifest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyDebugPlugManifest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyDebugPlugManifest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifestobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_manifestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_request.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_request.py
index 65dcd643..88686e14 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_request.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_request.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from ..models.function_meta import FunctionMeta
from ..models.plug_type import PlugType
@@ -27,10 +30,10 @@
class LegacyDebugPlugRequest(BaseModel):
"""LegacyDebugPlugRequest."""
- type: Optional[PlugType] = None
+ type: PlugType | None = None
script: StrictStr
- dependencies: Optional[Dict[str, StrictStr]] = None
- metadata: Optional[FunctionMeta] = None
+ dependencies: Dict[str, StrictStr] | None = None
+ metadata: FunctionMeta | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -39,40 +42,37 @@ class LegacyDebugPlugRequest(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyDebugPlugRequest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyDebugPlugRequest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyDebugPlugRequest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyDebugPlugRequest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyDebugPlugRequest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyDebugPlugRequest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_requestobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_requestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_debug_plug_requestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation.py
index b79cfb81..58f13d72 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.documentation_property import DocumentationProperty
@@ -38,40 +41,37 @@ class LegacyDocumentation(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyDocumentation from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyDocumentation instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyDocumentation instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyDocumentation from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyDocumentation instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyDocumentation instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_request.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_request.py
index 95021a62..e4e96be4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_request.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_request.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.documentation_property import DocumentationProperty
@@ -27,7 +30,7 @@
class LegacyDocumentationRequest(BaseModel):
"""LegacyDocumentationRequest."""
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
supported_states: List[DocumentationProperty] = Field(alias="supportedStates")
configuration: List[DocumentationProperty]
raw_data: List[DocumentationProperty] = Field(alias="rawData")
@@ -39,40 +42,37 @@ class LegacyDocumentationRequest(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyDocumentationRequest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyDocumentationRequest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyDocumentationRequest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyDocumentationRequest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyDocumentationRequest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyDocumentationRequest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_requestobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_requestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentation_requestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentationobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_documentationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_documentationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_function_meta.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_function_meta.py
index cd4c5cfb..b7859ab8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_function_meta.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_function_meta.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.tag import Tag
@@ -27,12 +30,12 @@
class LegacyFunctionMeta(BaseModel):
"""LegacyFunctionMeta."""
- author: Optional[StrictStr] = None
- description: Optional[StrictStr] = None
- category: Optional[StrictStr] = None
- tags: Optional[List[Tag]] = None
- icon_url: Optional[StrictStr] = Field(default=None, alias="iconURL")
- friendly_name: Optional[StrictStr] = Field(default=None, alias="friendlyName")
+ author: StrictStr | None = None
+ description: StrictStr | None = None
+ category: StrictStr | None = None
+ tags: List[Tag] | None = None
+ icon_url: StrictStr | None = Field(default=None, alias="iconURL")
+ friendly_name: StrictStr | None = Field(default=None, alias="friendlyName")
model_config = ConfigDict(
populate_by_name=True,
@@ -41,40 +44,37 @@ class LegacyFunctionMeta(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyFunctionMeta from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyFunctionMeta instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyFunctionMeta instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyFunctionMeta from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyFunctionMeta instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyFunctionMeta instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_function_metaobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_function_metaobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_function_metaobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_query.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_query.py
index 102e599c..45002e9b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,17 +29,17 @@
class LegacyPlugCreateQuery(BaseModel):
"""LegacyPlugCreateQuery."""
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=False,
description="If this is set to true
, the server will start the required job actions asynchronously and return a 202
Accepted response. Otherwise, the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- dry_run: Optional[StrictBool] = Field(
+ dry_run: StrictBool | None = Field(
default=None,
description="If set to true, only validates the incoming request.",
alias="dryRun",
)
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=None,
description="If set to true, scales the function to zero after successful deployment.",
alias="scaleToZero",
@@ -49,40 +52,37 @@ class LegacyPlugCreateQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugCreateQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugCreateQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugCreateQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugCreateQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugCreateQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugCreateQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_request.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_request.py
index 036962b8..ea2a8c81 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_request.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_request.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -34,9 +37,9 @@ class LegacyPlugCreateRequest(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
script: StrictStr
- dependencies: Optional[Dict[str, StrictStr]] = None
+ dependencies: Dict[str, StrictStr] | None = None
metadata: LegacyPlugRequestMetadata
- type: Optional[PlugType] = None
+ type: PlugType | None = None
@field_validator("version")
@classmethod
@@ -55,40 +58,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugCreateRequest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugCreateRequest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugCreateRequest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugCreateRequest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugCreateRequest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugCreateRequest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_requestobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_requestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_requestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_response.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_response.py
index 7d5ee2fb..a1f79cdb 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Union
+from typing import Any, ClassVar, Dict, List, Union
from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr
from pydantic import Field
from ..models.legacy_plug_script_response import LegacyPlugScriptResponse
@@ -27,7 +30,7 @@
class LegacyPlugCreateResponse(BaseModel):
"""LegacyPlugCreateResponse."""
- status_code: Union[StrictFloat, StrictInt] = Field(alias="statusCode")
+ status_code: StrictFloat | StrictInt = Field(alias="statusCode")
uri: StrictStr
entity: LegacyPlugScriptResponse
@@ -38,40 +41,37 @@ class LegacyPlugCreateResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugCreateResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugCreateResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugCreateResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugCreateResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugCreateResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugCreateResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_create_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_request.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_request.py
index c9d15d82..56c04925 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_request.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_request.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.legacy_plug_request_metadata_documentation import (
@@ -30,16 +33,14 @@
class LegacyPlugMetaRequest(BaseModel):
"""LegacyPlugMetaRequest."""
- author: Optional[StrictStr] = None
- description: Optional[StrictStr] = None
- category: Optional[StrictStr] = None
- tags: Optional[List[Tag]] = None
- icon_url: Optional[StrictStr] = Field(default=None, alias="iconURL")
- friendly_name: Optional[StrictStr] = Field(default=None, alias="friendlyName")
- documentation: Optional[LegacyPlugRequestMetadataDocumentation] = None
- documentation_url: Optional[StrictStr] = Field(
- default=None, alias="documentationURL"
- )
+ author: StrictStr | None = None
+ description: StrictStr | None = None
+ category: StrictStr | None = None
+ tags: List[Tag] | None = None
+ icon_url: StrictStr | None = Field(default=None, alias="iconURL")
+ friendly_name: StrictStr | None = Field(default=None, alias="friendlyName")
+ documentation: LegacyPlugRequestMetadataDocumentation | None = None
+ documentation_url: StrictStr | None = Field(default=None, alias="documentationURL")
model_config = ConfigDict(
populate_by_name=True,
@@ -48,40 +49,37 @@ class LegacyPlugMetaRequest(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugMetaRequest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugMetaRequest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugMetaRequest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugMetaRequest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugMetaRequest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugMetaRequest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_requestobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_requestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_meta_requestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_query.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_query.py
index 75b84d84..08abd3ab 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -32,72 +35,70 @@
class LegacyPlugQuery(BaseModel):
"""LegacyPlugQuery."""
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- include_draft: Optional[StrictBool] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- tags: Optional[TagsFilter] = None
+ tags: TagsFilter | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -106,40 +107,37 @@ class LegacyPlugQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request.py
index 64b3934c..20b902dd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -34,7 +37,7 @@ class LegacyPlugRequest(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
script: StrictStr
- dependencies: Optional[Dict[str, StrictStr]] = None
+ dependencies: Dict[str, StrictStr] | None = None
metadata: LegacyPlugRequestMetadata
type: PlugType
@@ -55,40 +58,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugRequest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugRequest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugRequest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugRequest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugRequest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugRequest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata.py
index 5d506978..854de423 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.legacy_configuration_object import LegacyConfigurationObject
@@ -35,26 +38,24 @@
class LegacyPlugRequestMetadata(BaseModel):
"""LegacyPlugRequestMetadata."""
- required_properties: Optional[List[LegacyRequiredPropertiesInner]] = Field(
+ required_properties: List[LegacyRequiredPropertiesInner] | None = Field(
default=None, alias="requiredProperties"
)
- supported_states: Optional[List[StrictStr]] = Field(
+ supported_states: List[StrictStr] | None = Field(
default=None, alias="supportedStates"
)
- raw_data: Optional[List[LegacyPlugRequestMetadataRawDataInner]] = Field(
+ raw_data: List[LegacyPlugRequestMetadataRawDataInner] | None = Field(
default=None, alias="rawData"
)
- configuration: Optional[List[LegacyConfigurationObject]] = None
- author: Optional[StrictStr] = None
- description: Optional[StrictStr] = None
- category: Optional[StrictStr] = None
- tags: Optional[List[Tag]] = None
- icon_url: Optional[StrictStr] = Field(default=None, alias="iconURL")
- friendly_name: Optional[StrictStr] = Field(default=None, alias="friendlyName")
- documentation: Optional[LegacyPlugRequestMetadataDocumentation] = None
- documentation_url: Optional[StrictStr] = Field(
- default=None, alias="documentationURL"
- )
+ configuration: List[LegacyConfigurationObject] | None = None
+ author: StrictStr | None = None
+ description: StrictStr | None = None
+ category: StrictStr | None = None
+ tags: List[Tag] | None = None
+ icon_url: StrictStr | None = Field(default=None, alias="iconURL")
+ friendly_name: StrictStr | None = Field(default=None, alias="friendlyName")
+ documentation: LegacyPlugRequestMetadataDocumentation | None = None
+ documentation_url: StrictStr | None = Field(default=None, alias="documentationURL")
model_config = ConfigDict(
populate_by_name=True,
@@ -63,40 +64,37 @@ class LegacyPlugRequestMetadata(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugRequestMetadata from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugRequestMetadata instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugRequestMetadata instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugRequestMetadata from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugRequestMetadata instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugRequestMetadata instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation.py
index 248553a7..9a54cae2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation.py
@@ -10,20 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.documentation import Documentation
from ..models.legacy_plug_request_metadata_documentation_any_of import (
LegacyPlugRequestMetadataDocumentationAnyOf,
)
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
LegacyPlugRequestMetadataDocumentation = Union[
Annotated[LegacyPlugRequestMetadataDocumentationAnyOf, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_of.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_of.py
index 95df3cd5..4e973638 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_of.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_of.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.documentation_property import DocumentationProperty
@@ -27,13 +30,11 @@
class LegacyPlugRequestMetadataDocumentationAnyOf(BaseModel):
"""LegacyPlugRequestMetadataDocumentationAnyOf."""
- supported_states: Optional[List[DocumentationProperty]] = Field(
+ supported_states: List[DocumentationProperty] | None = Field(
default=None, alias="supportedStates"
)
- configuration: Optional[List[DocumentationProperty]] = None
- raw_data: Optional[List[DocumentationProperty]] = Field(
- default=None, alias="rawData"
- )
+ configuration: List[DocumentationProperty] | None = None
+ raw_data: List[DocumentationProperty] | None = Field(default=None, alias="rawData")
model_config = ConfigDict(
populate_by_name=True,
@@ -42,40 +43,37 @@ class LegacyPlugRequestMetadataDocumentationAnyOf(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugRequestMetadataDocumentationAnyOf from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugRequestMetadataDocumentationAnyOf instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugRequestMetadataDocumentationAnyOf instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugRequestMetadataDocumentationAnyOf from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugRequestMetadataDocumentationAnyOf instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugRequestMetadataDocumentationAnyOf instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_ofobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_ofobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentation_any_ofobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentationobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_documentationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_inner.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_inner.py
index 1625b0cb..c0372a20 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_inner.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_inner.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.plug_property_data_type import PlugPropertyDataType
@@ -28,7 +31,7 @@ class LegacyPlugRequestMetadataRawDataInner(BaseModel):
"""LegacyPlugRequestMetadataRawDataInner."""
parameter: StrictStr
- data_type: Optional[PlugPropertyDataType] = Field(default=None, alias="dataType")
+ data_type: PlugPropertyDataType | None = Field(default=None, alias="dataType")
model_config = ConfigDict(
populate_by_name=True,
@@ -37,40 +40,37 @@ class LegacyPlugRequestMetadataRawDataInner(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugRequestMetadataRawDataInner from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugRequestMetadataRawDataInner instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugRequestMetadataRawDataInner instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugRequestMetadataRawDataInner from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugRequestMetadataRawDataInner instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugRequestMetadataRawDataInner instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_innerobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_innerobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadata_raw_data_innerobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadataobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_request_metadataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_requestobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_requestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_requestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response.py
index ba044781..334d5f03 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -38,21 +41,19 @@ class LegacyPlugResponse(BaseModel):
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
- author: Optional[StrictStr] = None
- category: Optional[StrictStr] = None
- icon_url: Optional[StrictStr] = Field(default=None, alias="iconURL")
- documentation_url: Optional[StrictStr] = Field(
- default=None, alias="documentationURL"
- )
+ author: StrictStr | None = None
+ category: StrictStr | None = None
+ icon_url: StrictStr | None = Field(default=None, alias="iconURL")
+ documentation_url: StrictStr | None = Field(default=None, alias="documentationURL")
is_deprecated: StrictBool = Field(alias="isDeprecated")
- description: Optional[StrictStr] = None
- states: Optional[List[StrictStr]] = None
- raw_data: Optional[List[Dict[str, Any]]] = Field(default=None, alias="rawData")
+ description: StrictStr | None = None
+ states: List[StrictStr] | None = None
+ raw_data: List[Dict[str, Any]] | None = Field(default=None, alias="rawData")
media_type: MediaType = Field(alias="mediaType")
- configuration: Optional[List[LegacyConfigurationResponseObject]] = None
+ configuration: List[LegacyConfigurationResponseObject] | None = None
commands: List[StrictStr]
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
metadata: LegacyPlugResponseMetadata
@field_validator("version")
@@ -72,40 +73,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadata.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadata.py
index d9aa522e..c1d7952e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadata.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadata.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.legacy_documentation import LegacyDocumentation
@@ -28,13 +31,13 @@
class LegacyPlugResponseMetadata(BaseModel):
"""LegacyPlugResponseMetadata."""
- documentation: Optional[LegacyDocumentation] = None
- author: Optional[StrictStr] = None
- description: Optional[StrictStr] = None
- category: Optional[StrictStr] = None
- tags: Optional[List[Tag]] = None
- icon_url: Optional[StrictStr] = Field(default=None, alias="iconURL")
- friendly_name: Optional[StrictStr] = Field(default=None, alias="friendlyName")
+ documentation: LegacyDocumentation | None = None
+ author: StrictStr | None = None
+ description: StrictStr | None = None
+ category: StrictStr | None = None
+ tags: List[Tag] | None = None
+ icon_url: StrictStr | None = Field(default=None, alias="iconURL")
+ friendly_name: StrictStr | None = Field(default=None, alias="friendlyName")
model_config = ConfigDict(
populate_by_name=True,
@@ -43,40 +46,37 @@ class LegacyPlugResponseMetadata(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugResponseMetadata from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugResponseMetadata instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugResponseMetadata instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugResponseMetadata from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugResponseMetadata instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugResponseMetadata instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadataobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_response_metadataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta.py
index c3a84503..7455418c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.legacy_plug_script_meta_raw_data_inner import (
@@ -31,15 +34,15 @@
class LegacyPlugScriptMeta(BaseModel):
"""LegacyPlugScriptMeta."""
- author: Optional[StrictStr] = None
- description: Optional[StrictStr] = None
- category: Optional[StrictStr] = None
- tags: Optional[List[Tag]] = None
- icon_url: Optional[StrictStr] = Field(default=None, alias="iconURL")
- friendly_name: Optional[StrictStr] = Field(default=None, alias="friendlyName")
+ author: StrictStr | None = None
+ description: StrictStr | None = None
+ category: StrictStr | None = None
+ tags: List[Tag] | None = None
+ icon_url: StrictStr | None = Field(default=None, alias="iconURL")
+ friendly_name: StrictStr | None = Field(default=None, alias="friendlyName")
supported_states: List[StrictStr] = Field(alias="supportedStates")
raw_data: List[LegacyPlugScriptMetaRawDataInner] = Field(alias="rawData")
- required_properties: Optional[List[LegacyRequiredPropertiesInner]] = Field(
+ required_properties: List[LegacyRequiredPropertiesInner] | None = Field(
default=None, alias="requiredProperties"
)
@@ -50,40 +53,37 @@ class LegacyPlugScriptMeta(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugScriptMeta from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugScriptMeta instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugScriptMeta instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugScriptMeta from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugScriptMeta instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugScriptMeta instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_inner.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_inner.py
index 9c24bd38..0b3a0167 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_inner.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_inner.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -27,7 +30,7 @@ class LegacyPlugScriptMetaRawDataInner(BaseModel):
"""LegacyPlugScriptMetaRawDataInner."""
parameter: StrictStr
- data_type: Optional[StrictStr] = Field(default=None, alias="dataType")
+ data_type: StrictStr | None = Field(default=None, alias="dataType")
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class LegacyPlugScriptMetaRawDataInner(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugScriptMetaRawDataInner from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugScriptMetaRawDataInner instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugScriptMetaRawDataInner instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugScriptMetaRawDataInner from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugScriptMetaRawDataInner instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugScriptMetaRawDataInner instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_innerobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_innerobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_meta_raw_data_innerobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_metaobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_metaobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_metaobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_response.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_response.py
index 77dd0820..a69c0bb3 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -55,40 +58,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyPlugScriptResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyPlugScriptResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyPlugScriptResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyPlugScriptResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyPlugScriptResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyPlugScriptResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_plug_script_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_inner.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_inner.py
index 8c065203..7abb363a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_inner.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_inner.py
@@ -10,17 +10,29 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.legacy_required_property_object import LegacyRequiredPropertyObject
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
LegacyRequiredPropertiesInner = Union[
Annotated[str, ""], Annotated[LegacyRequiredPropertyObject, ""]
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_innerobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_innerobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_properties_innerobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_object.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_object.py
index fe681c4d..f3e9bbee 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_object.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_object.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool, StrictStr
from ..models.plug_property_data_type import PlugPropertyDataType
@@ -38,40 +41,37 @@ class LegacyRequiredPropertyObject(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LegacyRequiredPropertyObject from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LegacyRequiredPropertyObject instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LegacyRequiredPropertyObject instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LegacyRequiredPropertyObject from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LegacyRequiredPropertyObject instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LegacyRequiredPropertyObject instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_objectobject.py b/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_objectobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/legacy_required_property_objectobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/limit_query.py b/waylay_registry_types/src/waylay/services/registry/models/limit_query.py
index 23005e54..8e1bcb49 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/limit_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/limit_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel
from pydantic import Field
from typing_extensions import Annotated
@@ -27,12 +30,11 @@
class LimitQuery(BaseModel):
"""LimitQuery."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
@@ -44,40 +46,37 @@ class LimitQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of LimitQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the LimitQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the LimitQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of LimitQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a LimitQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a LimitQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/limit_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/limit_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/limit_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/media_type.py b/waylay_registry_types/src/waylay/services/registry/models/media_type.py
index ae537561..8b5dfd35 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/media_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/media_type.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,23 +24,10 @@
class MediaType(str, Enum):
"""MediaType."""
- """
- allowed enum values
- """
APPLICATION_SLASH_JAVASCRIPT = "application/javascript"
APPLICATION_SLASH_JAVA_MINUS_VM = "application/java-vm"
TEXT_SLASH_X_MINUS_PYTHON = "text/x-python"
TEXT_SLASH_X_MINUS_GOLANG = "text/x-golang"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of MediaType from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of MediaType."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of MediaType."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/media_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/media_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/media_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/message_and_status_response.py b/waylay_registry_types/src/waylay/services/registry/models/message_and_status_response.py
index 25115508..53868166 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/message_and_status_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/message_and_status_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Union
+from typing import Any, ClassVar, Dict, List, Union
from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr
from pydantic import Field
@@ -27,7 +30,7 @@ class MessageAndStatusResponse(BaseModel):
"""MessageAndStatusResponse."""
message: StrictStr
- status_code: Union[StrictFloat, StrictInt] = Field(alias="statusCode")
+ status_code: StrictFloat | StrictInt = Field(alias="statusCode")
model_config = ConfigDict(
populate_by_name=True,
@@ -36,40 +39,37 @@ class MessageAndStatusResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of MessageAndStatusResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the MessageAndStatusResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the MessageAndStatusResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of MessageAndStatusResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a MessageAndStatusResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a MessageAndStatusResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/message_and_status_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/message_and_status_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/message_and_status_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/message_response.py b/waylay_registry_types/src/waylay/services/registry/models/message_response.py
index 3080ef26..88675b00 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/message_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/message_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -34,40 +37,37 @@ class MessageResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of MessageResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the MessageResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the MessageResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of MessageResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a MessageResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a MessageResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/message_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/message_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/message_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model.py b/waylay_registry_types/src/waylay/services/registry/models/model.py
index f30f7d43..5c7b477c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/model.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/model.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class Model(BaseModel):
"""Model."""
- event: Optional[HALLink] = None
+ event: HALLink | None = None
model: HALLink
model_config = ConfigDict(
@@ -36,40 +39,37 @@ class Model(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Model from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Model instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Model instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Model from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Model instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Model instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model1.py b/waylay_registry_types/src/waylay/services/registry/models/model1.py
index 6ec10ca6..5101fd61 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/model1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/model1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,8 +29,8 @@
class Model1(BaseModel):
"""Model1."""
- event: Optional[HALLink] = None
- job: Optional[HALLink] = None
+ event: HALLink | None = None
+ job: HALLink | None = None
model: HALLink
model_config = ConfigDict(
@@ -37,40 +40,37 @@ class Model1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Model1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Model1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Model1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Model1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Model1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Model1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model1object.py b/waylay_registry_types/src/waylay/services/registry/models/model1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/model1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model2.py b/waylay_registry_types/src/waylay/services/registry/models/model2.py
index e872316e..4bd21618 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/model2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/model2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class Model2(BaseModel):
"""Model2."""
- job: Optional[HALLink] = None
+ job: HALLink | None = None
model: HALLink
model_config = ConfigDict(
@@ -36,40 +39,37 @@ class Model2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Model2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Model2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Model2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Model2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Model2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Model2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model2object.py b/waylay_registry_types/src/waylay/services/registry/models/model2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/model2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2.py
index 3ce4f0f2..5e18d8e1 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.kfserving_response_v2 import KfservingResponseV2
@@ -27,13 +30,13 @@
class ModelVersionsResponseV2(BaseModel):
"""Model Versions Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[KfservingResponseV2] = Field(
@@ -47,40 +50,37 @@ class ModelVersionsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ModelVersionsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ModelVersionsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ModelVersionsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ModelVersionsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ModelVersionsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ModelVersionsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/model_versions_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/modelobject.py b/waylay_registry_types/src/waylay/services/registry/models/modelobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/modelobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/multipart_file_upload.py b/waylay_registry_types/src/waylay/services/registry/models/multipart_file_upload.py
index e05b9693..719d1516 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/multipart_file_upload.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/multipart_file_upload.py
@@ -13,19 +13,22 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBytes, StrictStr
class MultipartFileUpload(BaseModel):
"""A multi-part upload containing one or more file assets.."""
- filename: Optional[List[Union[StrictBytes, StrictStr]]] = None
+ filename: List[StrictBytes | StrictStr] | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -34,40 +37,37 @@ class MultipartFileUpload(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of MultipartFileUpload from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the MultipartFileUpload instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the MultipartFileUpload instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of MultipartFileUpload from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a MultipartFileUpload instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a MultipartFileUpload instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/multipart_file_uploadobject.py b/waylay_registry_types/src/waylay/services/registry/models/multipart_file_uploadobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/multipart_file_uploadobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/name.py b/waylay_registry_types/src/waylay/services/registry/models/name.py
index 461be04a..293a3d45 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/name.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/name.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -35,40 +38,37 @@ class Name(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Name from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Name instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Name instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Name from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Name instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Name instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/name_and_version.py b/waylay_registry_types/src/waylay/services/registry/models/name_and_version.py
index 3b2e6091..256d5e58 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/name_and_version.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/name_and_version.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -49,40 +52,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NameAndVersion from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NameAndVersion instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NameAndVersion instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NameAndVersion from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NameAndVersion instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NameAndVersion instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/name_and_versionobject.py b/waylay_registry_types/src/waylay/services/registry/models/name_and_versionobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/name_and_versionobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_query.py b/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_query.py
index b8180fb9..85c3c3c7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,61 +34,59 @@
class NamedFunctionVersionsQuery(BaseModel):
"""Named function versions listing query.."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -96,40 +97,37 @@ class NamedFunctionVersionsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedFunctionVersionsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedFunctionVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedFunctionVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedFunctionVersionsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedFunctionVersionsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedFunctionVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_function_versions_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2.py
index dd438007..4367a6b8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,61 +34,59 @@
class NamedKFServingVersionsQueryV2(BaseModel):
"""Named Model versions query.."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -96,40 +97,37 @@ class NamedKFServingVersionsQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedKFServingVersionsQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedKFServingVersionsQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedKFServingVersionsQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedKFServingVersionsQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedKFServingVersionsQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedKFServingVersionsQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_kf_serving_versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference.py
index 7d225448..9ec3edb6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.named_parameters_typeof_as_job_reference_job_status import (
@@ -38,40 +41,37 @@ class NamedParametersTypeofAsJobReference(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedParametersTypeofAsJobReference from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedParametersTypeofAsJobReference instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedParametersTypeofAsJobReference instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedParametersTypeofAsJobReference from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedParametersTypeofAsJobReference instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedParametersTypeofAsJobReference instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_status.py
index 2441d67d..1d5a7a91 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -31,13 +34,13 @@
class NamedParametersTypeofAsJobReferenceJobStatus(BaseModel):
"""NamedParametersTypeofAsJobReferenceJobStatus."""
- links: Optional[JobHALLinks] = Field(default=None, alias="_links")
- type: Optional[Any] = Field(description="The type of the background task.")
+ links: JobHALLinks | None = Field(default=None, alias="_links")
+ type: Any | None = Field(description="The type of the background task.")
state: JobStateResult
- request: Optional[Any] = Field(
+ request: Any | None = Field(
default=None, description="The request that initiated this job."
)
- result: Optional[Any] = Field(
+ result: Any | None = Field(
default=None, description="The result of the job if completed."
)
created_at: datetime = Field(
@@ -47,9 +50,9 @@ class NamedParametersTypeofAsJobReferenceJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
- job: Optional[JobStatus] = None
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ function: FunctionRef | None = None
+ job: JobStatus | None = None
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
model_config = ConfigDict(
populate_by_name=True,
@@ -58,55 +61,37 @@ class NamedParametersTypeofAsJobReferenceJobStatus(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedParametersTypeofAsJobReferenceJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
-
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
-
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
+ * Excludes `None` fields that were not set at model initialization.
"""
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
- )
- # set to None if type (nullable) is None
- # and model_fields_set contains the field
- if self.type is None and "type" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["type"] = None
-
- # set to None if request (nullable) is None
- # and model_fields_set contains the field
- if self.request is None and "request" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["request"] = None
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- # set to None if result (nullable) is None
- # and model_fields_set contains the field
- if self.result is None and "result" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["result"] = None
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedParametersTypeofAsJobReferenceJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- return _dict
+ def to_json(self) -> str:
+ """Convert the NamedParametersTypeofAsJobReferenceJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedParametersTypeofAsJobReferenceJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedParametersTypeofAsJobReferenceJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedParametersTypeofAsJobReferenceJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_reference_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_referenceobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_referenceobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_as_job_referenceobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy.py
index 5c88b0eb..3d6594de 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.legacy_plug_meta_request import LegacyPlugMetaRequest
@@ -29,7 +32,7 @@ class NamedParametersTypeofFromLegacy(BaseModel):
"""NamedParametersTypeofFromLegacy."""
metadata: LegacyPlugMetaRequest
- current_interface: Optional[PlugInterface] = Field(
+ current_interface: PlugInterface | None = Field(
default=None, alias="currentInterface"
)
@@ -40,40 +43,37 @@ class NamedParametersTypeofFromLegacy(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedParametersTypeofFromLegacy from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedParametersTypeofFromLegacy instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedParametersTypeofFromLegacy instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedParametersTypeofFromLegacy from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedParametersTypeofFromLegacy instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedParametersTypeofFromLegacy instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentation.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentation.py
index 9c376144..25c55f49 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentation.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentation.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.legacy_plug_request_metadata_documentation import (
@@ -30,10 +33,10 @@
class NamedParametersTypeofFromLegacyDocumentation(BaseModel):
"""NamedParametersTypeofFromLegacyDocumentation."""
- legacy_documentation: Optional[LegacyPlugRequestMetadataDocumentation] = Field(
+ legacy_documentation: LegacyPlugRequestMetadataDocumentation | None = Field(
default=None, alias="legacyDocumentation"
)
- current_interface: Optional[PlugInterface] = Field(
+ current_interface: PlugInterface | None = Field(
default=None, alias="currentInterface"
)
@@ -44,40 +47,37 @@ class NamedParametersTypeofFromLegacyDocumentation(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedParametersTypeofFromLegacyDocumentation from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedParametersTypeofFromLegacyDocumentation instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedParametersTypeofFromLegacyDocumentation instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedParametersTypeofFromLegacyDocumentation from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedParametersTypeofFromLegacyDocumentation instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedParametersTypeofFromLegacyDocumentation instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentationobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacy_documentationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacyobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_from_legacyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacy.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacy.py
index b2579516..89d7a6e4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacy.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.legacy_plug_request_metadata_documentation import (
LegacyPlugRequestMetadataDocumentation,
@@ -28,7 +31,7 @@
class NamedParametersTypeofIsNotLegacy(BaseModel):
"""NamedParametersTypeofIsNotLegacy."""
- documentation: Optional[LegacyPlugRequestMetadataDocumentation] = None
+ documentation: LegacyPlugRequestMetadataDocumentation | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -37,40 +40,37 @@ class NamedParametersTypeofIsNotLegacy(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedParametersTypeofIsNotLegacy from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedParametersTypeofIsNotLegacy instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedParametersTypeofIsNotLegacy instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedParametersTypeofIsNotLegacy from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedParametersTypeofIsNotLegacy instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedParametersTypeofIsNotLegacy instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacyobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_parameters_typeof_is_not_legacyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2.py
index 45581f05..fe785b01 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -32,62 +35,60 @@
class NamedPlugVersionsQueryV2(BaseModel):
"""Named plug version listing query."""
- tags: Optional[TagsFilter] = None
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ tags: TagsFilter | None = None
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -98,40 +99,37 @@ class NamedPlugVersionsQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedPlugVersionsQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedPlugVersionsQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedPlugVersionsQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedPlugVersionsQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedPlugVersionsQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedPlugVersionsQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_plug_versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_versions_filter.py b/waylay_registry_types/src/waylay/services/registry/models/named_versions_filter.py
index 31a08e24..eb41164f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_versions_filter.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_versions_filter.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
-from pydantic import BaseModel
+from typing import Any, ClassVar, Dict, List, Optional
+from pydantic import BaseModel, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -27,7 +30,7 @@
class NamedVersionsFilter(BaseModel):
"""NamedVersionsFilter."""
- name_version: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
+ name_version: List[Annotated[str, Field(strict=True)]] | None = Field(
default=None,
description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered.",
alias="nameVersion",
@@ -40,40 +43,37 @@ class NamedVersionsFilter(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedVersionsFilter from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedVersionsFilter instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedVersionsFilter instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedVersionsFilter from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedVersionsFilter instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedVersionsFilter instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_versions_filterobject.py b/waylay_registry_types/src/waylay/services/registry/models/named_versions_filterobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_versions_filterobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2.py
index 64dc2621..3a504734 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,61 +34,59 @@
class NamedWebscriptVersionsQueryV2(BaseModel):
"""Webscript named versions listing query.."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -96,40 +97,37 @@ class NamedWebscriptVersionsQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of NamedWebscriptVersionsQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the NamedWebscriptVersionsQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the NamedWebscriptVersionsQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of NamedWebscriptVersionsQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a NamedWebscriptVersionsQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a NamedWebscriptVersionsQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/named_webscript_versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/nameobject.py b/waylay_registry_types/src/waylay/services/registry/models/nameobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/nameobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/active_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/object.py
similarity index 100%
rename from waylay_registry_types/src/waylay/services/registry/models/active_event_dataobject.py
rename to waylay_registry_types/src/waylay/services/registry/models/object.py
diff --git a/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_args.py b/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_args.py
index 9e990b79..6b5babbd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -42,40 +45,37 @@ class OpenfaasDeployArgs(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of OpenfaasDeployArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the OpenfaasDeployArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the OpenfaasDeployArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of OpenfaasDeployArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a OpenfaasDeployArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a OpenfaasDeployArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/openfaas_deploy_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_ref.py b/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_ref.py
index 54aa4590..e32b57f1 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_ref.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_ref.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -38,40 +41,37 @@ class OpenfaasFunctionRef(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of OpenfaasFunctionRef from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the OpenfaasFunctionRef instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the OpenfaasFunctionRef instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of OpenfaasFunctionRef from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a OpenfaasFunctionRef instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a OpenfaasFunctionRef instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_refobject.py b/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_refobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/openfaas_function_refobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/operation.py b/waylay_registry_types/src/waylay/services/registry/models/operation.py
index 7140d65d..d98a53a2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/operation.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/operation.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.job_type import JobType
@@ -38,40 +41,37 @@ class Operation(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Operation from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Operation instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Operation instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Operation from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Operation instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Operation instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/operation_status.py b/waylay_registry_types/src/waylay/services/registry/models/operation_status.py
index 634363ce..0eeb8ab1 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/operation_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/operation_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from ..models.job_type import JobType
from ..models.operation_status_error import OperationStatusError
@@ -32,7 +35,7 @@ class OperationStatus(BaseModel):
name: StrictStr
type: JobType
done: StrictBool
- error: Optional[OperationStatusError] = None
+ error: OperationStatusError | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -41,40 +44,37 @@ class OperationStatus(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of OperationStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the OperationStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the OperationStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of OperationStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a OperationStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a OperationStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/operation_status_error.py b/waylay_registry_types/src/waylay/services/registry/models/operation_status_error.py
index 10109f08..b242668e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/operation_status_error.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/operation_status_error.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
@@ -27,7 +30,7 @@ class OperationStatusError(BaseModel):
name: StrictStr
message: StrictStr
- stack: Optional[StrictStr] = None
+ stack: StrictStr | None = None
code: StrictStr
model_config = ConfigDict(
@@ -37,40 +40,37 @@ class OperationStatusError(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of OperationStatusError from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the OperationStatusError instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the OperationStatusError instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of OperationStatusError from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a OperationStatusError instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a OperationStatusError instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/operation_status_errorobject.py b/waylay_registry_types/src/waylay/services/registry/models/operation_status_errorobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/operation_status_errorobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/operation_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/operation_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/operation_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/operationobject.py b/waylay_registry_types/src/waylay/services/registry/models/operationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/operationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/paging_query.py b/waylay_registry_types/src/waylay/services/registry/models/paging_query.py
index bc9893b2..eae7681f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/paging_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/paging_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel
from pydantic import Field
from typing_extensions import Annotated
@@ -27,21 +30,19 @@
class PagingQuery(BaseModel):
"""PagingQuery."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
@@ -53,40 +54,37 @@ class PagingQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PagingQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PagingQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PagingQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PagingQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PagingQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PagingQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/paging_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/paging_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/paging_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/paging_response.py b/waylay_registry_types/src/waylay/services/registry/models/paging_response.py
index 6d27d570..ec877360 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/paging_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/paging_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
@@ -26,14 +29,14 @@
class PagingResponse(BaseModel):
"""PagingResponse."""
- count: Optional[Union[StrictFloat, StrictInt]] = Field(
+ count: StrictFloat | StrictInt | None = Field(
default=None,
description="The total count of matching items, from which this result is one page.",
)
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
@@ -44,40 +47,37 @@ class PagingResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PagingResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PagingResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PagingResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PagingResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PagingResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PagingResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/paging_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/paging_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/paging_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/parent_keys.py b/waylay_registry_types/src/waylay/services/registry/models/parent_keys.py
index 9bda2d32..32379e82 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/parent_keys.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/parent_keys.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -34,40 +37,37 @@ class ParentKeys(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ParentKeys from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ParentKeys instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ParentKeys instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ParentKeys from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ParentKeys instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ParentKeys instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/parent_keysobject.py b/waylay_registry_types/src/waylay/services/registry/models/parent_keysobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/parent_keysobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/patch_interface_query.py b/waylay_registry_types/src/waylay/services/registry/models/patch_interface_query.py
index a896263e..1efc0367 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/patch_interface_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/patch_interface_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -26,7 +29,7 @@
class PatchInterfaceQuery(BaseModel):
"""PatchInterfaceQuery."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
@@ -38,40 +41,37 @@ class PatchInterfaceQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PatchInterfaceQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchInterfaceQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PatchInterfaceQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PatchInterfaceQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchInterfaceQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchInterfaceQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/patch_interface_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/patch_interface_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/patch_interface_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_query.py b/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_query.py
index 0de39bfa..53fd3c90 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -26,7 +29,7 @@
class PatchMetadataQuery(BaseModel):
"""PatchMetadataQuery."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
@@ -38,40 +41,37 @@ class PatchMetadataQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PatchMetadataQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchMetadataQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PatchMetadataQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PatchMetadataQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchMetadataQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchMetadataQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/patch_metadata_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1.py b/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1.py
index d674a7ca..9d4db66a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from ..models.user_plug_meta import UserPlugMeta
@@ -35,40 +38,37 @@ class PatchPlugRequestV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PatchPlugRequestV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchPlugRequestV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PatchPlugRequestV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PatchPlugRequestV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchPlugRequestV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchPlugRequestV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/patch_plug_request_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug.py b/waylay_registry_types/src/waylay/services/registry/models/plug.py
index cdcbb256..b4fdbcad 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class Plug(BaseModel):
"""Plug."""
- event: Optional[HALLink] = None
+ event: HALLink | None = None
plug: HALLink
model_config = ConfigDict(
@@ -36,40 +39,37 @@ class Plug(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Plug from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Plug instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Plug instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Plug from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Plug instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Plug instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug1.py b/waylay_registry_types/src/waylay/services/registry/models/plug1.py
index 7da5c095..464e5fac 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,8 +29,8 @@
class Plug1(BaseModel):
"""Plug1."""
- event: Optional[HALLink] = None
- job: Optional[HALLink] = None
+ event: HALLink | None = None
+ job: HALLink | None = None
plug: HALLink
model_config = ConfigDict(
@@ -37,40 +40,37 @@ class Plug1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Plug1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Plug1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Plug1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Plug1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Plug1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Plug1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug1object.py b/waylay_registry_types/src/waylay/services/registry/models/plug1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug2.py b/waylay_registry_types/src/waylay/services/registry/models/plug2.py
index 4cf25250..3b3fba58 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class Plug2(BaseModel):
"""Plug2."""
- job: Optional[HALLink] = None
+ job: HALLink | None = None
plug: HALLink
model_config = ConfigDict(
@@ -36,40 +39,37 @@ class Plug2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Plug2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Plug2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Plug2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Plug2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Plug2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Plug2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug2object.py b/waylay_registry_types/src/waylay/services/registry/models/plug2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_query.py b/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_query.py
index 9c638e73..cd719a81 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class PlugDeleteForceQuery(BaseModel):
"""PlugDeleteForceQuery."""
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.",
)
@@ -38,40 +41,37 @@ class PlugDeleteForceQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugDeleteForceQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugDeleteForceQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugDeleteForceQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugDeleteForceQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugDeleteForceQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugDeleteForceQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_force_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_query.py b/waylay_registry_types/src/waylay/services/registry/models/plug_delete_query.py
index a5c20c53..7d6e5eef 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_delete_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,11 +29,11 @@
class PlugDeleteQuery(BaseModel):
"""PlugDeleteQuery."""
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.",
)
- undeploy: Optional[StrictBool] = Field(
+ undeploy: StrictBool | None = Field(
default=None,
description="If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.",
)
@@ -42,40 +45,37 @@ class PlugDeleteQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugDeleteQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugDeleteQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugDeleteQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugDeleteQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugDeleteQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugDeleteQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_delete_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_delete_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_interface.py b/waylay_registry_types/src/waylay/services/registry/models/plug_interface.py
index 86c87baf..56e12c52 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_interface.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_interface.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.plug_property import PlugProperty
@@ -27,14 +30,14 @@
class PlugInterface(BaseModel):
"""PlugInterface."""
- states: Optional[List[StrictStr]] = Field(
+ states: List[StrictStr] | None = Field(
default=None,
description="The states of a plug as implemented in the plug code.",
)
- input: Optional[List[PlugProperty]] = Field(
+ input: List[PlugProperty] | None = Field(
default=None, description="The named input parameters of a plug"
)
- output: Optional[List[PlugProperty]] = Field(
+ output: List[PlugProperty] | None = Field(
default=None, description="The named output parameters of a plug"
)
@@ -45,40 +48,37 @@ class PlugInterface(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugInterface from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugInterface instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugInterface instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugInterface from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugInterface instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugInterface instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_interfaceobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_interfaceobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_interfaceobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_response.py b/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_response.py
index a64b0a36..3949916c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.plug_response import PlugResponse
@@ -27,14 +30,14 @@
class PlugListingAndQueryResponse(BaseModel):
"""Successful Response."""
- count: Optional[Union[StrictFloat, StrictInt]] = Field(
+ count: StrictFloat | StrictInt | None = Field(
default=None,
description="The total count of matching items, from which this result is one page.",
)
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
plugs: List[PlugResponse]
@@ -46,40 +49,37 @@ class PlugListingAndQueryResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugListingAndQueryResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugListingAndQueryResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugListingAndQueryResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugListingAndQueryResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugListingAndQueryResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugListingAndQueryResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_and_query_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_response.py b/waylay_registry_types/src/waylay/services/registry/models/plug_listing_response.py
index cce178a2..447c7a71 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_listing_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from ..models.plug_response import PlugResponse
@@ -35,40 +38,37 @@ class PlugListingResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugListingResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugListingResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugListingResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugListingResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugListingResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugListingResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_listing_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_listing_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_manifest.py b/waylay_registry_types/src/waylay/services/registry/models/plug_manifest.py
index 986d3bf9..70ee5a0a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_manifest.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_manifest.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -32,13 +35,13 @@
class PlugManifest(BaseModel):
"""PlugManifest."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: PlugMeta
@@ -62,40 +65,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugManifest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugManifest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugManifest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugManifest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugManifest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugManifest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_manifestobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_manifestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_manifestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_meta.py b/waylay_registry_types/src/waylay/services/registry/models/plug_meta.py
index 18df8b7e..858d3d9f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_meta.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_meta.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.documentation import Documentation
@@ -28,35 +31,35 @@
class PlugMeta(BaseModel):
"""PlugMeta."""
- author: Optional[StrictStr] = Field(
+ author: StrictStr | None = Field(
default=None, description="The author of the function."
)
- description: Optional[StrictStr] = Field(
+ description: StrictStr | None = Field(
default=None, description="A description of the function"
)
- icon_url: Optional[StrictStr] = Field(
+ icon_url: StrictStr | None = Field(
default=None,
description="An url to an icon that represents this function.",
alias="iconURL",
)
- category: Optional[StrictStr] = Field(
+ category: StrictStr | None = Field(
default=None,
description="A category for this function (Deprecated: use tags to categorise your functions)",
)
- documentation_url: Optional[StrictStr] = Field(
+ documentation_url: StrictStr | None = Field(
default=None,
description="External url that document this function.",
alias="documentationURL",
)
- tags: Optional[List[Tag]] = Field(
+ tags: List[Tag] | None = Field(
default=None, description="Tags associated with this function."
)
- friendly_name: Optional[StrictStr] = Field(
+ friendly_name: StrictStr | None = Field(
default=None,
description="Display title for this function.",
alias="friendlyName",
)
- documentation: Optional[Documentation] = None
+ documentation: Documentation | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -65,40 +68,37 @@ class PlugMeta(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugMeta from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugMeta instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugMeta instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugMeta from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugMeta instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugMeta instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_metaobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_metaobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_metaobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property.py
index d7b9cf19..6c166498 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_property.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.plug_property_data_type import PlugPropertyDataType
@@ -29,12 +32,12 @@ class PlugProperty(BaseModel):
"""Interface specification of a plug property.."""
name: StrictStr = Field(description="The name of a plug input or output property.")
- data_type: Optional[PlugPropertyDataType] = Field(default=None, alias="dataType")
- mandatory: Optional[StrictBool] = Field(
+ data_type: PlugPropertyDataType | None = Field(default=None, alias="dataType")
+ mandatory: StrictBool | None = Field(
default=None, description="If true
this property is required."
)
- format: Optional[PlugPropertyFormat] = None
- default_value: Optional[Any] = Field(default=None, alias="defaultValue")
+ format: PlugPropertyFormat | None = None
+ default_value: Any | None = Field(default=None, alias="defaultValue")
model_config = ConfigDict(
populate_by_name=True,
@@ -43,45 +46,37 @@ class PlugProperty(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugProperty from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugProperty instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugProperty instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- # set to None if default_value (nullable) is None
- # and model_fields_set contains the field
- if self.default_value is None and "default_value" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["defaultValue"] = None
-
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugProperty from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugProperty instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugProperty instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_type.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_type.py
index b6b5f4db..cd34c4e9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_type.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class PlugPropertyDataType(str, Enum):
"""Datatype supported in plug input or output properties.."""
- """
- allowed enum values
- """
STRING = "string"
INTEGER = "integer"
LONG = "long"
@@ -34,15 +32,5 @@ class PlugPropertyDataType(str, Enum):
BOOLEAN = "boolean"
OBJECT = "object"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugPropertyDataType from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of PlugPropertyDataType."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of PlugPropertyDataType."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property_data_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property_format.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property_format.py
index 428cbb1f..0ff8f62c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property_format.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_property_format.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from pydantic import Field
from ..models.plug_property_format_type import PlugPropertyFormatType
@@ -27,8 +30,8 @@
class PlugPropertyFormat(BaseModel):
"""PlugPropertyFormat."""
- type: Optional[PlugPropertyFormatType] = None
- values: Optional[List[Any]] = Field(
+ type: PlugPropertyFormatType | None = None
+ values: List[Any] | None = Field(
default=None,
description='The enumerated value domain when type="enum"
',
)
@@ -40,40 +43,37 @@ class PlugPropertyFormat(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugPropertyFormat from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugPropertyFormat instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugPropertyFormat instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugPropertyFormat from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugPropertyFormat instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugPropertyFormat instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_type.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_type.py
index da728b8e..640f1672 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_type.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class PlugPropertyFormatType(str, Enum):
"""Value domain for a plug input or output property.."""
- """
- allowed enum values
- """
ENUM = "enum"
RESOURCE = "resource"
VAULT = "vault"
@@ -35,15 +33,5 @@ class PlugPropertyFormatType(str, Enum):
DATE = "date"
TEMPLATE = "template"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugPropertyFormatType from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of PlugPropertyFormatType."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of PlugPropertyFormatType."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property_format_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_property_formatobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_property_formatobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_property_formatobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_propertyobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_propertyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_propertyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_response.py b/waylay_registry_types/src/waylay/services/registry/models/plug_response.py
index d83661f9..879a4418 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -33,13 +36,13 @@
class PlugResponse(BaseModel):
"""PlugResponse."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -57,8 +60,8 @@ class PlugResponse(BaseModel):
alias="updatedAt",
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
- links: Optional[List[JobHALLinks]] = Field(
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
+ links: List[JobHALLinks] | None = Field(
default=None, description="Links to related entities.", alias="_links"
)
is_deprecated: StrictBool = Field(alias="isDeprecated")
@@ -80,40 +83,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2.py
index b73a7619..d9c8cabe 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -48,7 +51,7 @@ class PlugResponseV2(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this plug is removed from regular listings, as a result of a DELETE
with force=false
."
@@ -65,40 +68,37 @@ class PlugResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_type.py b/waylay_registry_types/src/waylay/services/registry/models/plug_type.py
index 3cb2fef4..242f8240 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_type.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_type.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,22 +24,9 @@
class PlugType(str, Enum):
"""PlugType."""
- """
- allowed enum values
- """
SENSOR = "sensor"
ACTUATOR = "actuator"
TRANSFORMER = "transformer"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugType from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of PlugType."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of PlugType."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_type_query.py b/waylay_registry_types/src/waylay/services/registry/models/plug_type_query.py
index 224668f7..53d57761 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_type_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_type_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.plug_type import PlugType
@@ -26,7 +29,7 @@
class PlugTypeQuery(BaseModel):
"""PlugTypeQuery."""
- type: Optional[PlugType] = None
+ type: PlugType | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class PlugTypeQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugTypeQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugTypeQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugTypeQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugTypeQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugTypeQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugTypeQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_type_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_type_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_type_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_typeobject.py b/waylay_registry_types/src/waylay/services/registry/models/plug_typeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_typeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2.py
index 47a7deb7..fb4f83c8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.plug_response_v2 import PlugResponseV2
@@ -27,13 +30,13 @@
class PlugVersionsResponseV2(BaseModel):
"""Plugs Versions Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[PlugResponseV2] = Field(
@@ -47,40 +50,37 @@ class PlugVersionsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PlugVersionsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PlugVersionsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PlugVersionsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PlugVersionsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PlugVersionsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PlugVersionsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plug_versions_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/plugobject.py b/waylay_registry_types/src/waylay/services/registry/models/plugobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/plugobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2.py
index d93f8aa9..c59504cb 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class PostModelJobAsyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PostModelJobAsyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PostModelJobAsyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PostModelJobAsyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PostModelJobAsyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PostModelJobAsyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PostModelJobAsyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_async_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2.py
index ed557e13..25c47589 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.kfserving_response_v2 import KfservingResponseV2
@@ -36,40 +39,37 @@ class PostModelJobSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PostModelJobSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PostModelJobSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PostModelJobSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PostModelJobSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PostModelJobSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PostModelJobSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/post_model_job_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2.py
index 5a2f1cb2..a25bc99d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class PostPlugJobAsyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PostPlugJobAsyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PostPlugJobAsyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PostPlugJobAsyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PostPlugJobAsyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PostPlugJobAsyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PostPlugJobAsyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_async_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2.py
index e6e79fae..f0038c24 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.plug_response_v2 import PlugResponseV2
@@ -36,40 +39,37 @@ class PostPlugJobSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PostPlugJobSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PostPlugJobSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PostPlugJobSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PostPlugJobSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PostPlugJobSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PostPlugJobSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/post_plug_job_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2.py
index 6dae1669..a2207948 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_hal_links import JobHALLinks
@@ -39,40 +42,37 @@ class PostWebscriptJobAsyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PostWebscriptJobAsyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PostWebscriptJobAsyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PostWebscriptJobAsyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PostWebscriptJobAsyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PostWebscriptJobAsyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PostWebscriptJobAsyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_async_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2.py
index deb934c0..86e34ead 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.webscript_response_v2 import WebscriptResponseV2
@@ -36,40 +39,37 @@ class PostWebscriptJobSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PostWebscriptJobSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PostWebscriptJobSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PostWebscriptJobSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PostWebscriptJobSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PostWebscriptJobSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PostWebscriptJobSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/post_webscript_job_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/provided_dependency.py b/waylay_registry_types/src/waylay/services/registry/models/provided_dependency.py
index a83d6e4e..92c07d87 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/provided_dependency.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/provided_dependency.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -27,28 +30,26 @@ class ProvidedDependency(BaseModel):
"""Library dependency that is provided by this runtime.."""
name: StrictStr = Field(description="Name of a provided dependency.")
- title: Optional[StrictStr] = Field(
- default=None, description="Optional display title."
- )
- description: Optional[StrictStr] = Field(
+ title: StrictStr | None = Field(default=None, description="Optional display title.")
+ description: StrictStr | None = Field(
default=None, description="Optional description."
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None, description="Versions specification of a provided dependency"
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=False,
description="If true, this provided dependency is scheduled for removal (or incompatible upgrade) in a next runtime version.",
)
- removed: Optional[StrictBool] = Field(
+ removed: StrictBool | None = Field(
default=False,
description="If true, this dependency has been removed from the runtime (version)",
)
- globals: Optional[List[StrictStr]] = Field(
+ globals: List[StrictStr] | None = Field(
default=None,
description="Global variables that expose this library to the user code. As the usage of these globals is deprecated, any usage of such global will pose issues in an next runtime version.",
)
- native: Optional[StrictBool] = Field(
+ native: StrictBool | None = Field(
default=None,
description="If true, the library is provided natively by the runtime: e.g. node for javascript.",
)
@@ -60,40 +61,37 @@ class ProvidedDependency(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ProvidedDependency from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ProvidedDependency instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ProvidedDependency instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ProvidedDependency from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ProvidedDependency instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ProvidedDependency instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/provided_dependencyobject.py b/waylay_registry_types/src/waylay/services/registry/models/provided_dependencyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/provided_dependencyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/publish_function_query.py b/waylay_registry_types/src/waylay/services/registry/models/publish_function_query.py
index 324f6f28..34e990c7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/publish_function_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/publish_function_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.deprecate_previous_policy import DeprecatePreviousPolicy
@@ -27,14 +30,14 @@
class PublishFunctionQuery(BaseModel):
"""PublishFunctionQuery."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- deprecate_previous: Optional[DeprecatePreviousPolicy] = Field(
+ deprecate_previous: DeprecatePreviousPolicy | None = Field(
default=None, alias="deprecatePrevious"
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
@@ -47,40 +50,37 @@ class PublishFunctionQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of PublishFunctionQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PublishFunctionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the PublishFunctionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of PublishFunctionQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PublishFunctionQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PublishFunctionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/publish_function_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/publish_function_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/publish_function_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/queue_events.py b/waylay_registry_types/src/waylay/services/registry/models/queue_events.py
index 7fd9e775..19c1fd29 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/queue_events.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/queue_events.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class QueueEvents(str, Enum):
"""QueueEvents."""
- """
- allowed enum values
- """
COMPLETED = "completed"
FAILED = "failed"
ACTIVE = "active"
@@ -43,15 +41,5 @@ class QueueEvents(str, Enum):
RETRIES_MINUS_EXHAUSTED = "retries-exhausted"
STALLED = "stalled"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of QueueEvents from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of QueueEvents."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of QueueEvents."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/queue_eventsobject.py b/waylay_registry_types/src/waylay/services/registry/models/queue_eventsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/queue_eventsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_response.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_response.py
index a7127d61..8a0921fc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.job_causes import JobCauses
@@ -36,40 +39,37 @@ class RebuildComputedResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildComputedResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildComputedResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildComputedResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildComputedResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildComputedResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildComputedResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_computed_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2.py
index 66ec7f06..c8f0e184 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_causes import JobCauses
@@ -41,40 +44,37 @@ class RebuildModelAsyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildModelAsyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildModelAsyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildModelAsyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildModelAsyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildModelAsyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildModelAsyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_async_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2.py
index fb1771da..fb4cfc7b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.job_causes import JobCauses
from ..models.kfserving_response_v2 import KfservingResponseV2
@@ -38,40 +41,37 @@ class RebuildModelSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildModelSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildModelSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildModelSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildModelSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildModelSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildModelSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_model_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2.py
index f075da62..36ad9e5e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_causes import JobCauses
@@ -41,40 +44,37 @@ class RebuildPlugAsyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildPlugAsyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildPlugAsyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildPlugAsyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildPlugAsyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildPlugAsyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildPlugAsyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_async_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2.py
index 3c096b06..18e9ab1a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.job_causes import JobCauses
from ..models.plug_response_v2 import PlugResponseV2
@@ -38,40 +41,37 @@ class RebuildPlugSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildPlugSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildPlugSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildPlugSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildPlugSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildPlugSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildPlugSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_plug_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_policy.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_policy.py
index 2e7a0e2f..e47b6bfa 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_policy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_policy.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,23 +24,10 @@
class RebuildPolicy(str, Enum):
"""The policy to select a new runtime version when a rebuild is issued.."""
- """
- allowed enum values
- """
PATCH = "patch"
MINOR = "minor"
MAJOR = "major"
SAME = "same"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildPolicy from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of RebuildPolicy."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of RebuildPolicy."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_policyobject.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_policyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_policyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_params.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_params.py
index 30e9b699..718fa615 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -28,28 +31,28 @@
class RebuildQueryParams(BaseModel):
"""RebuildQueryParams."""
- upgrade: Optional[RebuildPolicy] = None
- dry_run: Optional[StrictBool] = Field(
+ upgrade: RebuildPolicy | None = None
+ dry_run: StrictBool | None = Field(
default=None,
description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs.",
alias="dryRun",
)
- force_version: Optional[Annotated[str, Field(strict=True)]] = Field(
+ force_version: Annotated[str, Field(strict=True)] | None = Field(
default=None,
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="forceVersion",
)
- ignore_checks: Optional[StrictBool] = Field(
+ ignore_checks: StrictBool | None = Field(
default=None,
description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option",
alias="ignoreChecks",
)
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=None,
description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command.",
alias="scaleToZero",
)
- skip_rebuild: Optional[StrictBool] = Field(
+ skip_rebuild: StrictBool | None = Field(
default=None,
description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function.",
alias="skipRebuild",
@@ -61,7 +64,6 @@ def force_version_validate_regular_expression(cls, value):
"""Validate the regular expression."""
if value is None:
return value
-
if not re.match(r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$", value):
raise ValueError(
r"must validate the regular expression /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/"
@@ -75,40 +77,37 @@ def force_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildQueryParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildQueryParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildQueryParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildQueryParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildQueryParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildQueryParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2.py
index 998ca191..57db8576 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -28,37 +31,37 @@
class RebuildQueryV2(BaseModel):
"""RebuildQueryV2."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- dry_run: Optional[StrictBool] = Field(
+ dry_run: StrictBool | None = Field(
default=None,
description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs.",
alias="dryRun",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- upgrade: Optional[RebuildPolicy] = None
- force_version: Optional[Annotated[str, Field(strict=True)]] = Field(
+ upgrade: RebuildPolicy | None = None
+ force_version: Annotated[str, Field(strict=True)] | None = Field(
default=None,
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="forceVersion",
)
- ignore_checks: Optional[StrictBool] = Field(
+ ignore_checks: StrictBool | None = Field(
default=None,
description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option",
alias="ignoreChecks",
)
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=None,
description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command.",
alias="scaleToZero",
)
- skip_rebuild: Optional[StrictBool] = Field(
+ skip_rebuild: StrictBool | None = Field(
default=None,
description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function.",
alias="skipRebuild",
@@ -70,7 +73,6 @@ def force_version_validate_regular_expression(cls, value):
"""Validate the regular expression."""
if value is None:
return value
-
if not re.match(r"^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$", value):
raise ValueError(
r"must validate the regular expression /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/"
@@ -84,40 +86,37 @@ def force_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_response.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_response.py
index a2f13d3b..4d8fe455 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_causes import JobCauses
@@ -39,40 +42,37 @@ class RebuildSubmittedResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildSubmittedResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildSubmittedResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildSubmittedResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildSubmittedResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildSubmittedResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildSubmittedResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_submitted_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2.py
index a7da6bcc..fc6b4982 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.job_causes import JobCauses
@@ -41,40 +44,37 @@ class RebuildWebscriptAsyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildWebscriptAsyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildWebscriptAsyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildWebscriptAsyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildWebscriptAsyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildWebscriptAsyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildWebscriptAsyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_async_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2.py
index 55261d47..01004ce6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.job_causes import JobCauses
from ..models.webscript_response_v2 import WebscriptResponseV2
@@ -38,40 +41,37 @@ class RebuildWebscriptSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RebuildWebscriptSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildWebscriptSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RebuildWebscriptSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RebuildWebscriptSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildWebscriptSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildWebscriptSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/rebuild_webscript_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2.py
index f3bda3b3..9d51fe63 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -26,20 +29,20 @@
class RemoveFunctionQueryV2(BaseModel):
"""RemoveFunctionQueryV2."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_.",
)
- undeploy: Optional[StrictBool] = Field(
+ undeploy: StrictBool | None = Field(
default=None,
description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.",
)
@@ -51,40 +54,37 @@ class RemoveFunctionQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RemoveFunctionQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveFunctionQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RemoveFunctionQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RemoveFunctionQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveFunctionQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveFunctionQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/remove_function_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2.py
index 41f76bc2..9ba232cd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -26,20 +29,20 @@
class RemovePlugQueryV2(BaseModel):
"""RemovePlugQueryV2."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
)
- force: Optional[StrictBool] = Field(
+ force: StrictBool | None = Field(
default=None,
description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings.",
)
- undeploy: Optional[StrictBool] = Field(
+ undeploy: StrictBool | None = Field(
default=None,
description="If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only.",
)
@@ -51,40 +54,37 @@ class RemovePlugQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RemovePlugQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemovePlugQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RemovePlugQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RemovePlugQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemovePlugQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemovePlugQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/remove_plug_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/request_operation.py b/waylay_registry_types/src/waylay/services/registry/models/request_operation.py
index cfcc19c2..c9c89225 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/request_operation.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/request_operation.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class RequestOperation(str, Enum):
"""A modifying operation on the function.."""
- """
- allowed enum values
- """
CREATE = "create"
METADATA_MINUS_UPDATE = "metadata-update"
ASSETS_MINUS_UPDATE = "assets-update"
@@ -35,15 +33,5 @@ class RequestOperation(str, Enum):
DEPRECATE = "deprecate"
UNDEPLOY = "undeploy"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RequestOperation from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of RequestOperation."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of RequestOperation."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/request_operationobject.py b/waylay_registry_types/src/waylay/services/registry/models/request_operationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/request_operationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/resource_limits.py b/waylay_registry_types/src/waylay/services/registry/models/resource_limits.py
index dd171cd6..d7ee27e0 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/resource_limits.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/resource_limits.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -35,40 +38,37 @@ class ResourceLimits(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ResourceLimits from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ResourceLimits instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ResourceLimits instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ResourceLimits from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ResourceLimits instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ResourceLimits instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/resource_limitsobject.py b/waylay_registry_types/src/waylay/services/registry/models/resource_limitsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/resource_limitsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/root_page_response.py b/waylay_registry_types/src/waylay/services/registry/models/root_page_response.py
index 782abb71..ec4feb3f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/root_page_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/root_page_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -53,40 +56,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RootPageResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RootPageResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RootPageResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RootPageResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RootPageResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RootPageResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/root_page_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/root_page_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/root_page_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_attributes.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_attributes.py
index 1ef4fcfc..537bf2e9 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_attributes.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_attributes.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -55,40 +58,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeAttributes from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeAttributes instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeAttributes instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeAttributes from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeAttributes instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeAttributes instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_attributesobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_attributesobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_attributesobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_info.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_info.py
index 2fe20601..c54543bc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_info.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_info.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -39,40 +42,37 @@ class RuntimeInfo(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeInfo from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeInfo instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeInfo instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeInfo from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeInfo instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeInfo instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_infoobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_infoobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_infoobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_name_query.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_name_query.py
index feefeeb7..b0074fab 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_name_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_name_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -28,16 +31,16 @@
class RuntimeNameQuery(BaseModel):
"""RuntimeNameQuery."""
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="If set, filters on the name
of a runtime. Supports *
and ?
wildcards and is case-insensitive.",
)
- function_type: Optional[List[FunctionType]] = Field(
+ function_type: List[FunctionType] | None = Field(
default=None,
description="If set, filters on the functionType
of a runtime. Uses an exact match.",
alias="functionType",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="If set, filters on the archiveFormat
of a runtime. Uses an exact match.",
alias="archiveFormat",
@@ -50,40 +53,37 @@ class RuntimeNameQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeNameQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeNameQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeNameQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeNameQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeNameQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeNameQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_name_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_name_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_name_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_params.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_params.py
index 9465dbc9..8e901c99 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
@@ -34,40 +37,37 @@ class RuntimeParams(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_query.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_query.py
index 574e6baf..50060363 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -30,23 +33,23 @@
class RuntimeQuery(BaseModel):
"""RuntimeQuery."""
- version: Optional[SemanticVersionRange] = None
- latest: Optional[LatestVersionLevel] = None
- include_deprecated: Optional[StrictBool] = Field(
+ version: SemanticVersionRange | None = None
+ latest: LatestVersionLevel | None = None
+ include_deprecated: StrictBool | None = Field(
default=False,
description="If set to `true`, deprecated runtimes will be included in the query.",
alias="includeDeprecated",
)
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="If set, filters on the name
of a runtime. Supports *
and ?
wildcards and is case-insensitive.",
)
- function_type: Optional[List[FunctionType]] = Field(
+ function_type: List[FunctionType] | None = Field(
default=None,
description="If set, filters on the functionType
of a runtime. Uses an exact match.",
alias="functionType",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="If set, filters on the archiveFormat
of a runtime. Uses an exact match.",
alias="archiveFormat",
@@ -59,40 +62,37 @@ class RuntimeQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_reference.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_reference.py
index 60e8d565..5a243ed8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_reference.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_reference.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -49,40 +52,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeReference from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeReference instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeReference instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeReference from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeReference instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeReference instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_referenceobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_referenceobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_referenceobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_specification.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_specification.py
index a4cd79e7..d68d4a0f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_specification.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_specification.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
from ..models.assets_conditions import AssetsConditions
@@ -31,16 +34,16 @@
class RuntimeSpecification(BaseModel):
"""Runtime (version) specification that says * what assets are required/allowed to build the function * what build parameters are used * what deployment parameters are used * which dependencies are provided by the runtime."""
- build: Optional[BuildSpec] = None
- deploy: Optional[DeploySpec] = None
- language: Optional[LanguageRelease] = None
- provided_dependencies: Optional[List[ProvidedDependency]] = Field(
+ build: BuildSpec | None = None
+ deploy: DeploySpec | None = None
+ language: LanguageRelease | None = None
+ provided_dependencies: List[ProvidedDependency] | None = Field(
default=None,
description="Description of dependencies provided by this runtime version.",
alias="providedDependencies",
)
- assets: Optional[AssetsConditions] = None
- deprecated: Optional[StrictBool] = Field(
+ assets: AssetsConditions | None = None
+ deprecated: StrictBool | None = Field(
default=None,
description="If true, this runtime should no longer be used for new functions.",
)
@@ -52,40 +55,37 @@ class RuntimeSpecification(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeSpecification from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeSpecification instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeSpecification instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeSpecification from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeSpecification instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeSpecification instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_specificationobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_specificationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_specificationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary.py
index 8e270838..d2acca66 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -31,7 +34,7 @@ class RuntimeSummary(BaseModel):
name: StrictStr
title: StrictStr
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
function_type: FunctionType = Field(alias="functionType")
archive_format: ArchiveFormat = Field(alias="archiveFormat")
versions: List[RuntimeVersionInfo]
@@ -43,40 +46,37 @@ class RuntimeSummary(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeSummary from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeSummary instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeSummary instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeSummary from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeSummary instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeSummary instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrs.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrs.py
index 141030dc..99df7f67 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrs.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrs.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.archive_format import ArchiveFormat
@@ -30,7 +33,7 @@ class RuntimeSummaryAttrs(BaseModel):
name: StrictStr
title: StrictStr
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
function_type: FunctionType = Field(alias="functionType")
archive_format: ArchiveFormat = Field(alias="archiveFormat")
@@ -41,40 +44,37 @@ class RuntimeSummaryAttrs(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeSummaryAttrs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeSummaryAttrs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeSummaryAttrs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeSummaryAttrs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeSummaryAttrs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeSummaryAttrs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrsobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_attrsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_response.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_response.py
index 10962b33..0763006f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from ..models.runtime_summary import RuntimeSummary
@@ -35,40 +38,37 @@ class RuntimeSummaryResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeSummaryResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeSummaryResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeSummaryResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeSummaryResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeSummaryResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeSummaryResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_summary_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_summaryobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_summaryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_summaryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_params.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_params.py
index f063c796..f16aa622 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.semantic_version_range import SemanticVersionRange
@@ -41,40 +44,37 @@ class RuntimeVersionAndPathParams(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionAndPathParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionAndPathParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionAndPathParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionAndPathParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionAndPathParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionAndPathParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_and_path_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_info.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_info.py
index ab2ecce5..f368cf76 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_info.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_info.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -37,7 +40,7 @@ class RuntimeVersionInfo(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
title: StrictStr
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
@field_validator("version")
@classmethod
@@ -56,40 +59,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionInfo from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionInfo instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionInfo instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionInfo from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionInfo instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionInfo instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_infoobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_infoobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_infoobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_params.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_params.py
index 9b6248c6..c964e84d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.semantic_version_range import SemanticVersionRange
@@ -36,40 +39,37 @@ class RuntimeVersionParams(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_query.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_query.py
index 8462792a..a3d14376 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
from ..models.latest_version_level import LatestVersionLevel
@@ -28,9 +31,9 @@
class RuntimeVersionQuery(BaseModel):
"""RuntimeVersionQuery."""
- version: Optional[SemanticVersionRange] = None
- latest: Optional[LatestVersionLevel] = None
- include_deprecated: Optional[StrictBool] = Field(
+ version: SemanticVersionRange | None = None
+ latest: LatestVersionLevel | None = None
+ include_deprecated: StrictBool | None = Field(
default=False,
description="If set to `true`, deprecated runtimes will be included in the query.",
alias="includeDeprecated",
@@ -43,40 +46,37 @@ class RuntimeVersionQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_response.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_response.py
index b5b094d6..44bfa74f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from ..models.compiled_runtime_version import CompiledRuntimeVersion
@@ -35,40 +38,37 @@ class RuntimeVersionResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specification.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specification.py
index 3ec344d9..5525da59 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specification.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specification.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -32,21 +35,21 @@
class RuntimeVersionSpecification(BaseModel):
"""RuntimeVersionSpecification."""
- build: Optional[BuildSpec] = None
- deploy: Optional[DeploySpec] = None
- language: Optional[LanguageRelease] = None
- provided_dependencies: Optional[List[ProvidedDependency]] = Field(
+ build: BuildSpec | None = None
+ deploy: DeploySpec | None = None
+ language: LanguageRelease | None = None
+ provided_dependencies: List[ProvidedDependency] | None = Field(
default=None,
description="Description of dependencies provided by this runtime version.",
alias="providedDependencies",
)
- assets: Optional[AssetsConditions] = None
- deprecated: Optional[StrictBool] = Field(
+ assets: AssetsConditions | None = None
+ deprecated: StrictBool | None = Field(
default=None,
description="If true, this runtime should no longer be used for new functions.",
)
title: StrictStr
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
@@ -68,40 +71,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionSpecification from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionSpecification instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionSpecification instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionSpecification from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionSpecification instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionSpecification instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specificationobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specificationobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_specificationobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_status.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_status.py
index 42c1b5bb..8d6866c6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -40,40 +43,37 @@ class RuntimeVersionStatus(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summary.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summary.py
index 92e6e170..8090eb37 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summary.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summary.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -39,7 +42,7 @@ class RuntimeVersionSummary(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
title: StrictStr
- description: Optional[StrictStr] = None
+ description: StrictStr | None = None
name: StrictStr
function_type: FunctionType = Field(alias="functionType")
archive_format: ArchiveFormat = Field(alias="archiveFormat")
@@ -61,40 +64,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of RuntimeVersionSummary from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RuntimeVersionSummary instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the RuntimeVersionSummary instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of RuntimeVersionSummary from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RuntimeVersionSummary instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RuntimeVersionSummary instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summaryobject.py b/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summaryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/runtime_version_summaryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale.py b/waylay_registry_types/src/waylay/services/registry/models/scale.py
index 855da5f7..ad05c605 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/scale.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/scale.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -32,11 +35,11 @@
class Scale(BaseModel):
"""Scale."""
- links: Optional[JobHALLinks] = Field(default=None, alias="_links")
+ links: JobHALLinks | None = Field(default=None, alias="_links")
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
- request: Optional[ScaleArgs] = None
- result: Optional[Dict[str, Any]] = Field(
+ request: ScaleArgs | None = None
+ result: Dict[str, Any] | None = Field(
default=None, description="The result data for a completed scale job."
)
created_at: datetime = Field(
@@ -46,9 +49,9 @@ class Scale(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
- job: Optional[JobStatus] = None
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ function: FunctionRef | None = None
+ job: JobStatus | None = None
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
@field_validator("type")
@classmethod
@@ -65,40 +68,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Scale from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Scale instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Scale instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Scale from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Scale instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Scale instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale1.py b/waylay_registry_types/src/waylay/services/registry/models/scale1.py
index ae379a59..13e01f60 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/scale1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/scale1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,7 +46,7 @@ class Scale1(BaseModel):
created_by: StrictStr = Field(
description="The user that initiated this job", alias="createdBy"
)
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
links: JobAndFunctionHALLink = Field(alias="_links")
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Scale1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Scale1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Scale1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Scale1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Scale1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Scale1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale1object.py b/waylay_registry_types/src/waylay/services/registry/models/scale1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/scale1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale_args.py b/waylay_registry_types/src/waylay/services/registry/models/scale_args.py
index f6499c74..edcce22c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/scale_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/scale_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -36,13 +39,11 @@ class ScaleArgs(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
)
- revision: Optional[StrictStr] = Field(
+ revision: StrictStr | None = Field(
default=None,
description="The revision hash of the current (draft) function revision",
)
- replicas: Union[StrictFloat, StrictInt] = Field(
- description="Number of target replicas"
- )
+ replicas: StrictFloat | StrictInt = Field(description="Number of target replicas")
@field_validator("runtime_version")
@classmethod
@@ -61,40 +62,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
-
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ScaleArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ScaleArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ScaleArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ScaleArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ScaleArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ScaleArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/scale_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/scale_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/scale_job_status.py
index c4a1c461..9e3fe19a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/scale_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/scale_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -33,7 +36,7 @@ class ScaleJobStatus(BaseModel):
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
request: ScaleArgs
- result: Optional[Dict[str, Any]] = Field(
+ result: Dict[str, Any] | None = Field(
default=None, description="The result data for a completed scale job."
)
created_at: datetime = Field(
@@ -43,7 +46,7 @@ class ScaleJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
job: JobStatus
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of ScaleJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ScaleJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the ScaleJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of ScaleJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ScaleJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ScaleJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scale_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/scale_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/scale_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/scaleobject.py b/waylay_registry_types/src/waylay/services/registry/models/scaleobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/scaleobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_params.py b/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_params.py
index b9fa0914..21a959ce 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -35,40 +38,37 @@ class SchemaByIdParams(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SchemaByIdParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the SchemaByIdParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the SchemaByIdParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of SchemaByIdParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a SchemaByIdParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a SchemaByIdParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/schema_by_id_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/schema_params.py b/waylay_registry_types/src/waylay/services/registry/models/schema_params.py
index 799753f8..a8943ae0 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/schema_params.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/schema_params.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.asset_role import AssetRole
@@ -38,40 +41,37 @@ class SchemaParams(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SchemaParams from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the SchemaParams instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the SchemaParams instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of SchemaParams from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a SchemaParams instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a SchemaParams instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/schema_paramsobject.py b/waylay_registry_types/src/waylay/services/registry/models/schema_paramsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/schema_paramsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/semantic_version_range.py b/waylay_registry_types/src/waylay/services/registry/models/semantic_version_range.py
index bf830a4a..2318da09 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/semantic_version_range.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/semantic_version_range.py
@@ -10,17 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
+from pydantic import Field
from typing_extensions import Annotated
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
SemanticVersionRange = Union[
Annotated[str, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/semantic_version_rangeobject.py b/waylay_registry_types/src/waylay/services/registry/models/semantic_version_rangeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/semantic_version_rangeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status.py b/waylay_registry_types/src/waylay/services/registry/models/status.py
index 8b2e424a..266f484c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/status.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class Status(str, Enum):
"""Status for a deployed function.."""
- """
- allowed enum values
- """
REGISTERED = "registered"
RUNNING = "running"
PENDING = "pending"
@@ -36,15 +34,5 @@ class Status(str, Enum):
UNDEPLOYING = "undeploying"
UNDEPLOYED = "undeployed"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Status from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of Status."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of Status."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_any.py b/waylay_registry_types/src/waylay/services/registry/models/status_any.py
index 26f857b1..5cd6913f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/status_any.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/status_any.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,20 +24,7 @@
class StatusAny(str, Enum):
"""Includes *all* statuses (including `undeployed`) as a filter."""
- """
- allowed enum values
- """
ANY = "any"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of StatusAny from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of StatusAny."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of StatusAny."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_anyobject.py b/waylay_registry_types/src/waylay/services/registry/models/status_anyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/status_anyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_filter.py b/waylay_registry_types/src/waylay/services/registry/models/status_filter.py
index 3ab7393a..92aafbc4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/status_filter.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/status_filter.py
@@ -10,19 +10,32 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
+from pydantic import Field
from typing_extensions import Annotated
from ..models.status_any import StatusAny
from ..models.status_include import StatusInclude
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
StatusFilter = Union[
Annotated[StatusInclude, ""],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_filterobject.py b/waylay_registry_types/src/waylay/services/registry/models/status_filterobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/status_filterobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_include.py b/waylay_registry_types/src/waylay/services/registry/models/status_include.py
index 38a58df3..0d7d21c4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/status_include.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/status_include.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class StatusInclude(str, Enum):
"""Inlude a status as a filter.."""
- """
- allowed enum values
- """
REGISTERED = "registered"
RUNNING = "running"
PENDING = "pending"
@@ -35,15 +33,5 @@ class StatusInclude(str, Enum):
UNDEPLOYING = "undeploying"
UNDEPLOYED = "undeployed"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of StatusInclude from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of StatusInclude."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of StatusInclude."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_includeobject.py b/waylay_registry_types/src/waylay/services/registry/models/status_includeobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/status_includeobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_response.py b/waylay_registry_types/src/waylay/services/registry/models/status_response.py
index bafa5423..8845254e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/status_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/status_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Union
+from typing import Any, ClassVar, Dict, List, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
@@ -26,7 +29,7 @@
class StatusResponse(BaseModel):
"""StatusResponse."""
- status_code: Union[StrictFloat, StrictInt] = Field(alias="statusCode")
+ status_code: StrictFloat | StrictInt = Field(alias="statusCode")
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class StatusResponse(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of StatusResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the StatusResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the StatusResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of StatusResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a StatusResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a StatusResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/status_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/status_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/status_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/stream_closing.py b/waylay_registry_types/src/waylay/services/registry/models/stream_closing.py
index b8cf5ea4..a66bfc4d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/stream_closing.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/stream_closing.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.event_close import EventClose
@@ -39,40 +42,37 @@ class StreamClosing(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of StreamClosing from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the StreamClosing instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the StreamClosing instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of StreamClosing from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a StreamClosing instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a StreamClosing instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/stream_closingobject.py b/waylay_registry_types/src/waylay/services/registry/models/stream_closingobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/stream_closingobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/stream_ready.py b/waylay_registry_types/src/waylay/services/registry/models/stream_ready.py
index d3854ab7..5b60bb19 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/stream_ready.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/stream_ready.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.event_ack import EventAck
@@ -39,40 +42,37 @@ class StreamReady(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of StreamReady from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the StreamReady instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the StreamReady instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of StreamReady from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a StreamReady instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a StreamReady instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/stream_readyobject.py b/waylay_registry_types/src/waylay/services/registry/models/stream_readyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/stream_readyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/supported_events.py b/waylay_registry_types/src/waylay/services/registry/models/supported_events.py
index d672cc56..fff1cee6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/supported_events.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/supported_events.py
@@ -11,6 +11,7 @@
from __future__ import annotations
import json
+import pprint
import re # noqa: F401
from enum import Enum
@@ -23,9 +24,6 @@
class SupportedEvents(str, Enum):
"""SupportedEvents."""
- """
- allowed enum values
- """
COMPLETED = "completed"
FAILED = "failed"
ACTIVE = "active"
@@ -33,15 +31,5 @@ class SupportedEvents(str, Enum):
WAITING = "waiting"
WAITING_MINUS_CHILDREN = "waiting-children"
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of SupportedEvents from a JSON string."""
- return cls(json.loads(json_str))
-
- def to_json(self) -> str:
- """Get the JSON representation of SupportedEvents."""
- return self.value
-
- def to_dict(self) -> str:
- """Get the dict representation of SupportedEvents."""
- return self.value
+ def __str__(self) -> str:
+ return str(self.value)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/supported_eventsobject.py b/waylay_registry_types/src/waylay/services/registry/models/supported_eventsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/supported_eventsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tag.py b/waylay_registry_types/src/waylay/services/registry/models/tag.py
index c395ee29..6d8e315b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/tag.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/tag.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -36,40 +39,37 @@ class Tag(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Tag from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Tag instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Tag instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Tag from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Tag instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Tag instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tag_query.py b/waylay_registry_types/src/waylay/services/registry/models/tag_query.py
index 1685409c..d573e5b2 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/tag_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/tag_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -26,11 +29,11 @@
class TagQuery(BaseModel):
"""TagQuery."""
- name: Optional[StrictStr] = Field(
+ name: StrictStr | None = Field(
default=None,
description="If set, filters on the name
of a tag. Supports *
and ?
wildcards and is case-insensitive.",
)
- color: Optional[StrictStr] = Field(
+ color: StrictStr | None = Field(
default=None,
description="If set, filters on the color
of a tag. Uses an exact match.",
)
@@ -42,40 +45,37 @@ class TagQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of TagQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the TagQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the TagQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of TagQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a TagQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a TagQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tag_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/tag_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/tag_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tagobject.py b/waylay_registry_types/src/waylay/services/registry/models/tagobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/tagobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tags_filter.py b/waylay_registry_types/src/waylay/services/registry/models/tags_filter.py
index fffd5328..8c246b41 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/tags_filter.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/tags_filter.py
@@ -10,18 +10,28 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
-from typing import List
+from typing import List, Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from typing import (
Union,
- List, # >=3.8
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
TagsFilter = Union[Annotated[List[str], ""], Annotated[str, ""]]
"""TagsFilter."""
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tags_filterobject.py b/waylay_registry_types/src/waylay/services/registry/models/tags_filterobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/tags_filterobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tags_query.py b/waylay_registry_types/src/waylay/services/registry/models/tags_query.py
index fab421e9..8747610a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/tags_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/tags_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.tags_filter import TagsFilter
@@ -26,7 +29,7 @@
class TagsQuery(BaseModel):
"""TagsQuery."""
- tags: Optional[TagsFilter] = None
+ tags: TagsFilter | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class TagsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of TagsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the TagsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the TagsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of TagsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a TagsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a TagsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/tags_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/tags_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/tags_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/timestamp_absolute.py b/waylay_registry_types/src/waylay/services/registry/models/timestamp_absolute.py
index f4f00528..550aae2b 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/timestamp_absolute.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/timestamp_absolute.py
@@ -10,16 +10,29 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
from datetime import date, datetime
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
+from pydantic import Field
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
TimestampAbsolute = Union[
Annotated[datetime, "An ISO8601 date-time expression."],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/timestamp_absoluteobject.py b/waylay_registry_types/src/waylay/services/registry/models/timestamp_absoluteobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/timestamp_absoluteobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/timestamp_age.py b/waylay_registry_types/src/waylay/services/registry/models/timestamp_age.py
index e2fb72e1..6a39fd36 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/timestamp_age.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/timestamp_age.py
@@ -10,17 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
+from pydantic import Field
from typing_extensions import Annotated
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
TimestampAge = Union[
Annotated[str, "An ISO8601 period expression"],
diff --git a/waylay_registry_types/src/waylay/services/registry/models/timestamp_ageobject.py b/waylay_registry_types/src/waylay/services/registry/models/timestamp_ageobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/timestamp_ageobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/timestamp_spec.py b/waylay_registry_types/src/waylay/services/registry/models/timestamp_spec.py
index cab383a2..855aa92f 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/timestamp_spec.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/timestamp_spec.py
@@ -10,18 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.timestamp_absolute import TimestampAbsolute
from ..models.timestamp_age import TimestampAge
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
TimestampSpec = Union[Annotated[TimestampAge, ""], Annotated[TimestampAbsolute, ""]]
"""A timestamp specification.."""
diff --git a/waylay_registry_types/src/waylay/services/registry/models/timestamp_specobject.py b/waylay_registry_types/src/waylay/services/registry/models/timestamp_specobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/timestamp_specobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy.py
index 8b3122fa..4d16e46e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeploy.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -33,11 +36,11 @@
class Undeploy(BaseModel):
"""Undeploy."""
- links: Optional[JobHALLinks] = Field(default=None, alias="_links")
+ links: JobHALLinks | None = Field(default=None, alias="_links")
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
- request: Optional[UndeployArgs] = None
- result: Optional[UndeployResult] = None
+ request: UndeployArgs | None = None
+ result: UndeployResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -45,9 +48,9 @@ class Undeploy(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
- job: Optional[JobStatus] = None
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ function: FunctionRef | None = None
+ job: JobStatus | None = None
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
@field_validator("type")
@classmethod
@@ -64,40 +67,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Undeploy from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Undeploy instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Undeploy instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Undeploy from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Undeploy instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Undeploy instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy1.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy1.py
index 5c4212e1..01cd9be1 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeploy1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,7 +46,7 @@ class Undeploy1(BaseModel):
created_by: StrictStr = Field(
description="The user that initiated this job", alias="createdBy"
)
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
links: JobAndFunctionHALLink = Field(alias="_links")
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Undeploy1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Undeploy1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Undeploy1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Undeploy1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Undeploy1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Undeploy1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy1object.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_args.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_args.py
index ee2af00d..256220b6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeploy_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -36,7 +39,7 @@ class UndeployArgs(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
)
- revision: Optional[StrictStr] = Field(
+ revision: StrictStr | None = Field(
default=None,
description="The revision hash of the current (draft) function revision",
)
@@ -63,40 +66,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UndeployArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UndeployArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UndeployArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UndeployArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UndeployArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UndeployArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_status.py
index 97db1547..bbb4dbfc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -34,7 +37,7 @@ class UndeployJobStatus(BaseModel):
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
request: UndeployArgs
- result: Optional[UndeployResult] = None
+ result: UndeployResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -42,7 +45,7 @@ class UndeployJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
job: JobStatus
@field_validator("type")
@@ -60,40 +63,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UndeployJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UndeployJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UndeployJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UndeployJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UndeployJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UndeployJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_result.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_result.py
index 5366c91e..5f05b591 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeploy_result.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictBool
@@ -36,40 +39,37 @@ class UndeployResult(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UndeployResult from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UndeployResult instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UndeployResult instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UndeployResult from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UndeployResult instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UndeployResult instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2.py
index a705766c..05aedd58 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
-from pydantic import BaseModel, StrictStr
+from typing import Any, ClassVar, Dict, List
+from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
from ..models.job_hal_links import JobHALLinks
@@ -41,40 +44,37 @@ class UndeploySubmittedResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UndeploySubmittedResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UndeploySubmittedResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UndeploySubmittedResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UndeploySubmittedResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UndeploySubmittedResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UndeploySubmittedResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeploy_submitted_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2.py
index dfa888d3..6f26fd60 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List
-from pydantic import BaseModel, StrictStr
+from typing import Any, ClassVar, Dict, List
+from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -39,40 +42,37 @@ class UndeployedResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UndeployedResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UndeployedResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UndeployedResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UndeployedResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UndeployedResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UndeployedResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeployed_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/undeployobject.py b/waylay_registry_types/src/waylay/services/registry/models/undeployobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/undeployobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_error.py b/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_error.py
index 2fe41084..2eb2b6ab 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_error.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_error.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.invokable_webscript_response_entity import (
@@ -42,40 +45,37 @@ class UnhealthyInvokableWebscriptError(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UnhealthyInvokableWebscriptError from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UnhealthyInvokableWebscriptError instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UnhealthyInvokableWebscriptError instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UnhealthyInvokableWebscriptError from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UnhealthyInvokableWebscriptError instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UnhealthyInvokableWebscriptError instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_errorobject.py b/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_errorobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/unhealthy_invokable_webscript_errorobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_comment.py b/waylay_registry_types/src/waylay/services/registry/models/update_comment.py
index a9e4fbd7..66a43df8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/update_comment.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/update_comment.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
@@ -26,7 +29,7 @@
class UpdateComment(BaseModel):
"""UpdateComment."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
@@ -38,40 +41,37 @@ class UpdateComment(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UpdateComment from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateComment instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UpdateComment instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UpdateComment from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateComment instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateComment instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_commentobject.py b/waylay_registry_types/src/waylay/services/registry/models/update_commentobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/update_commentobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_draft_query.py b/waylay_registry_types/src/waylay/services/registry/models/update_draft_query.py
index ca8eb741..f3656cfd 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/update_draft_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/update_draft_query.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
@@ -26,11 +29,11 @@
class UpdateDraftQuery(BaseModel):
"""UpdateDraftQuery."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
- var_async: Optional[StrictBool] = Field(
+ var_async: StrictBool | None = Field(
default=True,
description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs.",
alias="async",
@@ -46,40 +49,37 @@ class UpdateDraftQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UpdateDraftQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateDraftQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UpdateDraftQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UpdateDraftQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateDraftQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateDraftQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_draft_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/update_draft_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/update_draft_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1.py b/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1.py
index 0d81aaa3..2e76b61e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.tag import Tag
@@ -27,30 +30,30 @@
class UpdateMetadataRequestV1(BaseModel):
"""UpdateMetadataRequestV1."""
- author: Optional[StrictStr] = Field(
+ author: StrictStr | None = Field(
default=None, description="The author of the function."
)
- description: Optional[StrictStr] = Field(
+ description: StrictStr | None = Field(
default=None, description="A description of the function"
)
- icon_url: Optional[StrictStr] = Field(
+ icon_url: StrictStr | None = Field(
default=None,
description="An url to an icon that represents this function.",
alias="iconURL",
)
- category: Optional[StrictStr] = Field(
+ category: StrictStr | None = Field(
default=None,
description="A category for this function (Deprecated: use tags to categorise your functions)",
)
- documentation_url: Optional[StrictStr] = Field(
+ documentation_url: StrictStr | None = Field(
default=None,
description="External url that document this function.",
alias="documentationURL",
)
- tags: Optional[List[Tag]] = Field(
+ tags: List[Tag] | None = Field(
default=None, description="Tags associated with this function."
)
- friendly_name: Optional[StrictStr] = Field(
+ friendly_name: StrictStr | None = Field(
default=None,
description="Display title for this function.",
alias="friendlyName",
@@ -63,40 +66,37 @@ class UpdateMetadataRequestV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UpdateMetadataRequestV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateMetadataRequestV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UpdateMetadataRequestV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UpdateMetadataRequestV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateMetadataRequestV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateMetadataRequestV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2.py b/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2.py
index 089369c8..99feaa1c 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.tag import Tag
@@ -27,30 +30,30 @@
class UpdateMetadataRequestV2(BaseModel):
"""UpdateMetadataRequestV2."""
- author: Optional[StrictStr] = Field(
+ author: StrictStr | None = Field(
default=None, description="The author of the function."
)
- description: Optional[StrictStr] = Field(
+ description: StrictStr | None = Field(
default=None, description="A description of the function"
)
- icon_url: Optional[StrictStr] = Field(
+ icon_url: StrictStr | None = Field(
default=None,
description="An url to an icon that represents this function.",
alias="iconURL",
)
- category: Optional[StrictStr] = Field(
+ category: StrictStr | None = Field(
default=None,
description="A category for this function (Deprecated: use tags to categorise your functions)",
)
- documentation_url: Optional[StrictStr] = Field(
+ documentation_url: StrictStr | None = Field(
default=None,
description="External url that document this function.",
alias="documentationURL",
)
- tags: Optional[List[Tag]] = Field(
+ tags: List[Tag] | None = Field(
default=None, description="Tags associated with this function."
)
- friendly_name: Optional[StrictStr] = Field(
+ friendly_name: StrictStr | None = Field(
default=None,
description="Display title for this function.",
alias="friendlyName",
@@ -63,40 +66,37 @@ class UpdateMetadataRequestV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UpdateMetadataRequestV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateMetadataRequestV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UpdateMetadataRequestV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UpdateMetadataRequestV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateMetadataRequestV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateMetadataRequestV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/update_metadata_request_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_record.py b/waylay_registry_types/src/waylay/services/registry/models/update_record.py
index e5afb7f5..1f14c951 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/update_record.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/update_record.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.request_operation import RequestOperation
@@ -27,12 +30,12 @@
class UpdateRecord(BaseModel):
"""An update report corresponding to a modifying operation initiated by a user/administrator on the entity.."""
- comment: Optional[StrictStr] = Field(
+ comment: StrictStr | None = Field(
default=None,
description="An optional user-specified comment corresponding to the operation.",
)
operation: RequestOperation
- jobs: Optional[List[StrictStr]] = Field(
+ jobs: List[StrictStr] | None = Field(
default=None,
description="The job id's of the corresponding jobs, if applicable.",
)
@@ -46,40 +49,37 @@ class UpdateRecord(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UpdateRecord from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateRecord instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UpdateRecord instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UpdateRecord from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateRecord instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateRecord instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/update_recordobject.py b/waylay_registry_types/src/waylay/services/registry/models/update_recordobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/update_recordobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/user_plug_meta.py b/waylay_registry_types/src/waylay/services/registry/models/user_plug_meta.py
index e5900e3a..46ddf7b7 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/user_plug_meta.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/user_plug_meta.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from ..models.tag import Tag
@@ -27,30 +30,30 @@
class UserPlugMeta(BaseModel):
"""Plug metadata that the user can update as `metadata`."""
- author: Optional[StrictStr] = Field(
+ author: StrictStr | None = Field(
default=None, description="The author of the function."
)
- description: Optional[StrictStr] = Field(
+ description: StrictStr | None = Field(
default=None, description="A description of the function"
)
- icon_url: Optional[StrictStr] = Field(
+ icon_url: StrictStr | None = Field(
default=None,
description="An url to an icon that represents this function.",
alias="iconURL",
)
- category: Optional[StrictStr] = Field(
+ category: StrictStr | None = Field(
default=None,
description="A category for this function (Deprecated: use tags to categorise your functions)",
)
- documentation_url: Optional[StrictStr] = Field(
+ documentation_url: StrictStr | None = Field(
default=None,
description="External url that document this function.",
alias="documentationURL",
)
- tags: Optional[List[Tag]] = Field(
+ tags: List[Tag] | None = Field(
default=None, description="Tags associated with this function."
)
- friendly_name: Optional[StrictStr] = Field(
+ friendly_name: StrictStr | None = Field(
default=None,
description="Display title for this function.",
alias="friendlyName",
@@ -63,40 +66,37 @@ class UserPlugMeta(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of UserPlugMeta from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UserPlugMeta instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the UserPlugMeta instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of UserPlugMeta from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UserPlugMeta instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UserPlugMeta instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/user_plug_metaobject.py b/waylay_registry_types/src/waylay/services/registry/models/user_plug_metaobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/user_plug_metaobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify.py b/waylay_registry_types/src/waylay/services/registry/models/verify.py
index 353ef6b2..a40b92d3 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -33,11 +36,11 @@
class Verify(BaseModel):
"""Verify."""
- links: Optional[JobHALLinks] = Field(default=None, alias="_links")
+ links: JobHALLinks | None = Field(default=None, alias="_links")
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
- request: Optional[VerifyArgs] = None
- result: Optional[VerifyResult] = None
+ request: VerifyArgs | None = None
+ result: VerifyResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -45,9 +48,9 @@ class Verify(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
- job: Optional[JobStatus] = None
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ function: FunctionRef | None = None
+ job: JobStatus | None = None
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
@field_validator("type")
@classmethod
@@ -64,40 +67,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Verify from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Verify instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Verify instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Verify from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Verify instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Verify instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify1.py b/waylay_registry_types/src/waylay/services/registry/models/verify1.py
index 7f1f82a6..807dcc7a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -43,7 +46,7 @@ class Verify1(BaseModel):
created_by: StrictStr = Field(
description="The user that initiated this job", alias="createdBy"
)
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
links: JobAndFunctionHALLink = Field(alias="_links")
@field_validator("type")
@@ -61,40 +64,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Verify1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Verify1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Verify1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Verify1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Verify1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Verify1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify1object.py b/waylay_registry_types/src/waylay/services/registry/models/verify1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_args.py b/waylay_registry_types/src/waylay/services/registry/models/verify_args.py
index 91129cb8..73bc471d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_args.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_args.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -36,7 +39,7 @@ class VerifyArgs(BaseModel):
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org",
alias="runtimeVersion",
)
- revision: Optional[StrictStr] = Field(
+ revision: StrictStr | None = Field(
default=None,
description="The revision hash of the current (draft) function revision",
)
@@ -58,40 +61,37 @@ def runtime_version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyArgs from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyArgs instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyArgs instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyArgs from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyArgs instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyArgs instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_argsobject.py b/waylay_registry_types/src/waylay/services/registry/models/verify_argsobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_argsobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_job_status.py b/waylay_registry_types/src/waylay/services/registry/models/verify_job_status.py
index da5653f9..4d0eab03 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_job_status.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_job_status.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.function_ref import FunctionRef
@@ -34,7 +37,7 @@ class VerifyJobStatus(BaseModel):
type: StrictStr = Field(description="The type of the background task.")
state: JobStateResult
request: VerifyArgs
- result: Optional[VerifyResult] = None
+ result: VerifyResult | None = None
created_at: datetime = Field(
description="The timestamp of creation of this job", alias="createdAt"
)
@@ -42,7 +45,7 @@ class VerifyJobStatus(BaseModel):
description="The user that created this job", alias="createdBy"
)
operation: StrictStr = Field(description="Request operation")
- function: Optional[FunctionRef] = None
+ function: FunctionRef | None = None
job: JobStatus
@field_validator("type")
@@ -60,40 +63,37 @@ def type_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyJobStatus from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyJobStatus instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyJobStatus instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyJobStatus from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyJobStatus instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyJobStatus instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_job_statusobject.py b/waylay_registry_types/src/waylay/services/registry/models/verify_job_statusobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_job_statusobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2.py
index f3ccb0a8..3754264d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.kfserving_response_v2 import KfservingResponseV2
from ..models.verify_result import VerifyResult
@@ -38,40 +41,37 @@ class VerifyModelSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyModelSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyModelSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyModelSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyModelSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyModelSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyModelSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_model_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2.py
index d887bf7d..db06791a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.plug_response_v2 import PlugResponseV2
from ..models.verify_result import VerifyResult
@@ -38,40 +41,37 @@ class VerifyPlugSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyPlugSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyPlugSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyPlugSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyPlugSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyPlugSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyPlugSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_plug_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1.py
index e15e1a37..bdf3b4b5 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,7 +29,7 @@
class VerifyQueryV1(BaseModel):
"""VerifyQueryV1."""
- scale_to_zero: Optional[StrictBool] = Field(
+ scale_to_zero: StrictBool | None = Field(
default=None,
description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command.",
alias="scaleToZero",
@@ -39,40 +42,37 @@ class VerifyQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_result.py b/waylay_registry_types/src/waylay/services/registry/models/verify_result.py
index 8c99174a..ee8e1552 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_result.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_result.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt
from pydantic import Field
@@ -27,7 +30,7 @@ class VerifyResult(BaseModel):
"""The result data for a completed verification job.."""
healthy: StrictBool = Field(description="If true, the deployment check succeeded.")
- replicas: Optional[Union[StrictFloat, StrictInt]] = Field(
+ replicas: StrictFloat | StrictInt | None = Field(
default=None,
description="The number of replicas this function was running at the time of the check.",
)
@@ -39,40 +42,37 @@ class VerifyResult(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyResult from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyResult instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyResult instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyResult from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyResult instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyResult instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_resultobject.py b/waylay_registry_types/src/waylay/services/registry/models/verify_resultobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_resultobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2.py
index 20493111..cacf3a07 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr
from ..models.verify_result import VerifyResult
from ..models.webscript_response_v2 import WebscriptResponseV2
@@ -38,40 +41,37 @@ class VerifyWebscriptSyncResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VerifyWebscriptSyncResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyWebscriptSyncResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VerifyWebscriptSyncResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VerifyWebscriptSyncResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyWebscriptSyncResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyWebscriptSyncResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verify_webscript_sync_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/verifyobject.py b/waylay_registry_types/src/waylay/services/registry/models/verifyobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/verifyobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/version_includes.py b/waylay_registry_types/src/waylay/services/registry/models/version_includes.py
index 33aea229..73ac0541 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/version_includes.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/version_includes.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,12 +29,12 @@
class VersionIncludes(BaseModel):
"""VersionIncludes."""
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
@@ -44,40 +47,37 @@ class VersionIncludes(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VersionIncludes from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VersionIncludes instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VersionIncludes instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VersionIncludes from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VersionIncludes instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VersionIncludes instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/version_includesobject.py b/waylay_registry_types/src/waylay/services/registry/models/version_includesobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/version_includesobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/versions_query.py b/waylay_registry_types/src/waylay/services/registry/models/versions_query.py
index 420813b6..8b209d76 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/versions_query.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/versions_query.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
-from pydantic import BaseModel, StrictBool, StrictStr
+from typing import Any, ClassVar, Dict, List, Optional, Union
+from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
from ..models.archive_format import ArchiveFormat
@@ -31,84 +34,82 @@
class VersionsQuery(BaseModel):
"""Function versions paged query."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- endpoint: Optional[StrictStr] = Field(
+ endpoint: StrictStr | None = Field(
default=None,
description="Filter on the openfaas endpoint. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- image_name: Optional[StrictStr] = Field(
+ image_name: StrictStr | None = Field(
default=None,
description="Filter on the container image name. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
alias="imageName",
)
- storage_location: Optional[StrictStr] = Field(
+ storage_location: StrictStr | None = Field(
default=None,
description="Filter on the storageLocation. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
alias="storageLocation",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- name_version: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
+ name_version: List[Annotated[str, Field(strict=True)]] | None = Field(
default=None,
description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered.",
alias="nameVersion",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -119,40 +120,37 @@ class VersionsQuery(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VersionsQuery from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VersionsQuery from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VersionsQuery instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2.py
index 9f488b18..4e952c67 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2.py
@@ -13,13 +13,16 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
-from pydantic import BaseModel, StrictBool, StrictStr
+from typing import Any, ClassVar, Dict, List, Optional, Union
+from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
from ..models.archive_format import ArchiveFormat
@@ -31,84 +34,82 @@
class VersionsQueryV2(BaseModel):
"""Function versions paged query."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- endpoint: Optional[StrictStr] = Field(
+ endpoint: StrictStr | None = Field(
default=None,
description="Filter on the openfaas endpoint. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- image_name: Optional[StrictStr] = Field(
+ image_name: StrictStr | None = Field(
default=None,
description="Filter on the container image name. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
alias="imageName",
)
- storage_location: Optional[StrictStr] = Field(
+ storage_location: StrictStr | None = Field(
default=None,
description="Filter on the storageLocation. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
alias="storageLocation",
)
- deprecated: Optional[StrictBool] = Field(
+ deprecated: StrictBool | None = Field(
default=None, description="Filter on the deprecation status of the function."
)
- draft: Optional[StrictBool] = Field(
+ draft: StrictBool | None = Field(
default=None, description="Filter on the draft status of the function."
)
- name_version: Optional[List[Annotated[str, Field(strict=True)]]] = Field(
+ name_version: List[Annotated[str, Field(strict=True)]] | None = Field(
default=None,
description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered.",
alias="nameVersion",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -119,40 +120,37 @@ class VersionsQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VersionsQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VersionsQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VersionsQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VersionsQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VersionsQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VersionsQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/versions_queryobject.py b/waylay_registry_types/src/waylay/services/registry/models/versions_queryobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/versions_queryobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2.py
index b02bcdd7..fd41cefa 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.any_function_response import AnyFunctionResponse
@@ -27,13 +30,13 @@
class VersionsResponseV2(BaseModel):
"""Version Listing Response."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[AnyFunctionResponse] = Field(
@@ -47,40 +50,37 @@ class VersionsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of VersionsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VersionsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the VersionsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of VersionsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VersionsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VersionsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/versions_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sse.py
index 9bed1594..e520a718 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sse.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.job_event_response_waiting_children_event_data import (
@@ -49,40 +52,37 @@ def event_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WaitingChildrenEventSSE from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WaitingChildrenEventSSE instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WaitingChildrenEventSSE instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WaitingChildrenEventSSE from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WaitingChildrenEventSSE instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WaitingChildrenEventSSE instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/waiting_children_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_data.py b/waylay_registry_types/src/waylay/services/registry/models/waiting_event_data.py
index b2475520..e1b319bb 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_data.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/waiting_event_data.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.queue_events import QueueEvents
@@ -26,7 +29,7 @@
class WaitingEventData(BaseModel):
"""WaitingEventData."""
- prev: Optional[QueueEvents] = None
+ prev: QueueEvents | None = None
model_config = ConfigDict(
populate_by_name=True,
@@ -35,40 +38,37 @@ class WaitingEventData(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WaitingEventData from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WaitingEventData instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WaitingEventData instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WaitingEventData from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WaitingEventData instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WaitingEventData instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_dataobject.py b/waylay_registry_types/src/waylay/services/registry/models/waiting_event_dataobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_dataobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sse.py b/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sse.py
index 4689e813..06d4104e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sse.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sse.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from ..models.job_event_response_waiting_event_data import (
@@ -49,40 +52,37 @@ def event_validate_enum(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WaitingEventSSE from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WaitingEventSSE instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WaitingEventSSE instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WaitingEventSSE from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WaitingEventSSE instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WaitingEventSSE instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sseobject.py b/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/waiting_event_sseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript.py b/waylay_registry_types/src/waylay/services/registry/models/webscript.py
index 2eba37b4..5b902d95 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class Webscript(BaseModel):
"""Webscript."""
- event: Optional[HALLink] = None
+ event: HALLink | None = None
webscript: HALLink
model_config = ConfigDict(
@@ -36,40 +39,37 @@ class Webscript(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Webscript from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Webscript instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Webscript instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Webscript from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Webscript instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Webscript instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript1.py b/waylay_registry_types/src/waylay/services/registry/models/webscript1.py
index 61eac22f..db64e497 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,8 +29,8 @@
class Webscript1(BaseModel):
"""Webscript1."""
- event: Optional[HALLink] = None
- job: Optional[HALLink] = None
+ event: HALLink | None = None
+ job: HALLink | None = None
webscript: HALLink
model_config = ConfigDict(
@@ -37,40 +40,37 @@ class Webscript1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Webscript1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Webscript1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Webscript1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Webscript1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Webscript1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Webscript1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript1object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript2.py b/waylay_registry_types/src/waylay/services/registry/models/webscript2.py
index c22bbe55..7c254121 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel
from ..models.hal_link import HALLink
@@ -26,7 +29,7 @@
class Webscript2(BaseModel):
"""Webscript2."""
- job: Optional[HALLink] = None
+ job: HALLink | None = None
webscript: HALLink
model_config = ConfigDict(
@@ -36,40 +39,37 @@ class Webscript2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of Webscript2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the Webscript2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the Webscript2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of Webscript2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a Webscript2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a Webscript2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript2object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2.py
index 0c60b587..926cffe8 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool
from pydantic import Field
@@ -26,12 +29,12 @@
class WebscriptLatestVersionQueryV2(BaseModel):
"""Webscript latest named version query.."""
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
@@ -44,40 +47,37 @@ class WebscriptLatestVersionQueryV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptLatestVersionQueryV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptLatestVersionQueryV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptLatestVersionQueryV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptLatestVersionQueryV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptLatestVersionQueryV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptLatestVersionQueryV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_version_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1.py
index 71e92c8d..dfb511c5 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from typing_extensions import Annotated
@@ -31,69 +34,67 @@
class WebscriptLatestVersionsQueryV1(BaseModel):
"""Webscript lastest versions listing query."""
- limit: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ limit: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value.",
)
- page: Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ] = Field(
+ page: (
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None
+ ) = Field(
default=None,
description="The number of pages to skip when returning result to this query.",
)
- include_draft: Optional[StrictBool] = Field(
+ include_draft: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**.",
alias="includeDraft",
)
- include_deprecated: Optional[StrictBool] = Field(
+ include_deprecated: StrictBool | None = Field(
default=None,
description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**.",
alias="includeDeprecated",
)
- version: Optional[StrictStr] = Field(
+ version: StrictStr | None = Field(
default=None,
description="Filter on the version of the function (case-sensitive, supports wildcards).",
)
- status: Optional[List[StatusFilter]] = Field(
+ status: List[StatusFilter] | None = Field(
default=None,
description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions.",
)
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
- created_by: Optional[StrictStr] = Field(
+ created_by: StrictStr | None = Field(
default=None,
description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs.",
alias="createdBy",
)
- updated_by: Optional[StrictStr] = Field(
+ updated_by: StrictStr | None = Field(
default=None,
description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs.",
alias="updatedBy",
)
- created_before: Optional[TimestampSpec] = Field(default=None, alias="createdBefore")
- created_after: Optional[TimestampSpec] = Field(default=None, alias="createdAfter")
- updated_before: Optional[TimestampSpec] = Field(default=None, alias="updatedBefore")
- updated_after: Optional[TimestampSpec] = Field(default=None, alias="updatedAfter")
- name: Optional[StrictStr] = Field(
+ created_before: TimestampSpec | None = Field(default=None, alias="createdBefore")
+ created_after: TimestampSpec | None = Field(default=None, alias="createdAfter")
+ updated_before: TimestampSpec | None = Field(default=None, alias="updatedBefore")
+ updated_after: TimestampSpec | None = Field(default=None, alias="updatedAfter")
+ name: StrictStr | None = Field(
default=None,
description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters).",
)
- archive_format: Optional[List[ArchiveFormat]] = Field(
+ archive_format: List[ArchiveFormat] | None = Field(
default=None,
description="Filter on the archive format of the function.",
alias="archiveFormat",
)
- runtime: Optional[List[StrictStr]] = Field(
+ runtime: List[StrictStr] | None = Field(
default=None, description="Filter on the runtime of the function."
)
@@ -104,40 +105,37 @@ class WebscriptLatestVersionsQueryV1(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptLatestVersionsQueryV1 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptLatestVersionsQueryV1 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptLatestVersionsQueryV1 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptLatestVersionsQueryV1 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptLatestVersionsQueryV1 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptLatestVersionsQueryV1 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v1object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2.py
index f4fbff4a..8029fe11 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2.py
@@ -10,18 +10,30 @@
"""
from __future__ import annotations
+from inspect import getfullargspec
+import json
+import pprint
import re # noqa: F401
+from typing import Optional
+from pydantic import BaseModel, Field, StrictStr, ValidationError, field_validator
from ..models.latest_function_versions_query import LatestFunctionVersionsQuery
from ..models.latest_functions_query import LatestFunctionsQuery
from typing import (
- Union, # >=3.8
+ Union,
+ Any,
+ List,
+ TYPE_CHECKING,
+ Optional,
+ Dict,
+ Literal, # >=3.8
)
from typing_extensions import (
Annotated, # >=3.9
)
+from pydantic import StrictStr, Field, ConfigDict
WebscriptLatestVersionsQueryV2 = Union[
Annotated[LatestFunctionVersionsQuery, ""], Annotated[LatestFunctionsQuery, ""]
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_latest_versions_query_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_manifest.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_manifest.py
index a935d81f..4c93b01e 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_manifest.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_manifest.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -30,13 +33,13 @@
class WebscriptManifest(BaseModel):
"""WebscriptManifest."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -65,40 +68,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptManifest from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptManifest instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptManifest instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptManifest from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptManifest instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptManifest instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_manifestobject.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_manifestobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_manifestobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_response.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_response.py
index 1b49e53f..a53c61e6 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_response.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_response.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr, field_validator
from pydantic import Field
from typing_extensions import Annotated
@@ -33,13 +36,13 @@
class WebscriptResponse(BaseModel):
"""Successful Response."""
- deploy: Optional[FunctionDeployOverridesType] = None
+ deploy: FunctionDeployOverridesType | None = None
name: StrictStr = Field(description="The logical name for the function.")
version: Annotated[str, Field(strict=True)] = Field(
description="A semantic version with _exactly_ a `major`, `minor` and `patch` specifier. No `pre-release` or `build` identifiers are allowed. See https://semver.org"
)
runtime: StrictStr
- runtime_version: Optional[SemanticVersionRange] = Field(
+ runtime_version: SemanticVersionRange | None = Field(
default=None, alias="runtimeVersion"
)
metadata: FunctionMeta
@@ -57,11 +60,11 @@ class WebscriptResponse(BaseModel):
alias="updatedAt",
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
- links: Optional[List[JobHALLinks]] = Field(
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
+ links: List[JobHALLinks] | None = Field(
default=None, description="Links to related entities.", alias="_links"
)
- secret: Optional[StrictStr]
+ secret: StrictStr | None
@field_validator("version")
@classmethod
@@ -80,45 +83,37 @@ def version_validate_regular_expression(cls, value):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptResponse from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptResponse instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptResponse instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- # set to None if secret (nullable) is None
- # and model_fields_set contains the field
- if self.secret is None and "secret" in self.model_fields_set: # pylint: disable=unsupported-membership-test
- _dict["secret"] = None
-
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptResponse from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptResponse instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptResponse instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2.py
index b5cdbfd5..80f025bc 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -48,7 +51,7 @@ class WebscriptResponseV2(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this function is deprecated and removed from regular listings."
@@ -57,7 +60,7 @@ class WebscriptResponseV2(BaseModel):
description="If true
this function is a draft function and it's assets are still mutable."
)
webscript: WebscriptManifest
- secret: Optional[StrictStr] = Field(
+ secret: StrictStr | None = Field(
default=None,
description="The secret for this webscript deployment. This is null
when allowHmac=false
in the webscript specificaton.",
)
@@ -69,40 +72,37 @@ class WebscriptResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2.py
index 56f22fa8..81e9de6d 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -49,7 +52,7 @@ class WebscriptResponseWithInvokeLinkV2(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this function is deprecated and removed from regular listings."
@@ -58,11 +61,11 @@ class WebscriptResponseWithInvokeLinkV2(BaseModel):
description="If true
this function is a draft function and it's assets are still mutable."
)
webscript: WebscriptManifest
- secret: Optional[StrictStr] = Field(
+ secret: StrictStr | None = Field(
default=None,
description="The secret for this webscript deployment. This is null
when allowHmac=false
in the webscript specificaton.",
)
- links: Optional[InvokeHALLink] = Field(default=None, alias="_links")
+ links: InvokeHALLink | None = Field(default=None, alias="_links")
model_config = ConfigDict(
populate_by_name=True,
@@ -71,40 +74,37 @@ class WebscriptResponseWithInvokeLinkV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptResponseWithInvokeLinkV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptResponseWithInvokeLinkV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptResponseWithInvokeLinkV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptResponseWithInvokeLinkV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptResponseWithInvokeLinkV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptResponseWithInvokeLinkV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_response_with_invoke_link_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_responseobject.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_responseobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_responseobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2.py
index 1cfb1fd7..ed13a73a 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, List, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
from ..models.webscript_response_with_invoke_link_v2 import (
@@ -29,13 +32,13 @@
class WebscriptVersionsResponseV2(BaseModel):
"""Webscript Versions Found."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
entities: List[WebscriptResponseWithInvokeLinkV2] = Field(
@@ -49,40 +52,37 @@ class WebscriptVersionsResponseV2(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WebscriptVersionsResponseV2 from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WebscriptVersionsResponseV2 instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WebscriptVersionsResponseV2 instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WebscriptVersionsResponseV2 from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WebscriptVersionsResponseV2 instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WebscriptVersionsResponseV2 instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2object.py b/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2object.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscript_versions_response_v2object.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/webscriptobject.py b/waylay_registry_types/src/waylay/services/registry/models/webscriptobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/webscriptobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_link.py b/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_link.py
index a24ecc42..2f65aec4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_link.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_link.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict
+from typing import Any, ClassVar, Dict, List
from pydantic import BaseModel
from pydantic import Field
from ..models.asset_summary_with_hal_link_links import AssetSummaryWithHALLinkLinks
@@ -36,40 +39,37 @@ class WithAssetHALLink(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WithAssetHALLink from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WithAssetHALLink instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WithAssetHALLink instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WithAssetHALLink from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WithAssetHALLink instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WithAssetHALLink instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_linkobject.py b/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_linkobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/with_asset_hal_linkobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributes.py b/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributes.py
index 87215a5b..7f2095f4 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributes.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributes.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
from datetime import datetime
-from typing import Any, Dict, List, Optional
+from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictBool, StrictStr
from pydantic import Field
from ..models.failure_reason import FailureReason
@@ -47,7 +50,7 @@ class WithEntityAttributes(BaseModel):
description="The audit logs corresponding to the latest modifying operations on this entity."
)
status: Status
- failure_reason: Optional[FailureReason] = Field(default=None, alias="failureReason")
+ failure_reason: FailureReason | None = Field(default=None, alias="failureReason")
runtime: RuntimeAttributes
deprecated: StrictBool = Field(
description="If true
this function is deprecated and removed from regular listings."
@@ -63,40 +66,37 @@ class WithEntityAttributes(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WithEntityAttributes from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WithEntityAttributes instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WithEntityAttributes instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WithEntityAttributes from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WithEntityAttributes instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WithEntityAttributes instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributesobject.py b/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributesobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/with_entity_attributesobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_limit.py b/waylay_registry_types/src/waylay/services/registry/models/with_limit.py
index 8c76909c..53103524 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/with_limit.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/with_limit.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
@@ -26,7 +29,7 @@
class WithLimit(BaseModel):
"""WithLimit."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
@@ -37,40 +40,37 @@ class WithLimit(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WithLimit from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WithLimit instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WithLimit instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WithLimit from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WithLimit instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WithLimit instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_limitobject.py b/waylay_registry_types/src/waylay/services/registry/models/with_limitobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/with_limitobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_paging.py b/waylay_registry_types/src/waylay/services/registry/models/with_paging.py
index e39a695c..d13abc61 100644
--- a/waylay_registry_types/src/waylay/services/registry/models/with_paging.py
+++ b/waylay_registry_types/src/waylay/services/registry/models/with_paging.py
@@ -13,12 +13,15 @@
import pprint
import re # noqa: F401
import json
-from pydantic import ConfigDict
+from pydantic import ConfigDict, SerializationInfo, model_serializer, StrictStr
+from pydantic_core import from_json
+from typing import Callable, Union
+from typing import cast
from typing_extensions import (
Self, # >=3.11
)
-from typing import Any, Dict, Optional, Union
+from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictFloat, StrictInt
from pydantic import Field
@@ -26,13 +29,13 @@
class WithPaging(BaseModel):
"""WithPaging."""
- limit: Optional[Union[StrictFloat, StrictInt]] = Field(
+ limit: StrictFloat | StrictInt | None = Field(
default=None, description="The page size used for this query result."
)
- count: Union[StrictFloat, StrictInt] = Field(
+ count: StrictFloat | StrictInt = Field(
description="The total count of matching items, from which this result is one page."
)
- page: Optional[Union[StrictFloat, StrictInt]] = Field(
+ page: StrictFloat | StrictInt | None = Field(
default=None, description="The page number of a paged query result."
)
@@ -43,40 +46,37 @@ class WithPaging(BaseModel):
extra="ignore",
)
- def to_str(self) -> str:
- """Get the string representation of the model using alias."""
- return pprint.pformat(self.model_dump(by_alias=True))
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- def to_json(self) -> str:
- """Get the JSON representation of the model using alias."""
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
- return json.dumps(self.to_dict(), default=str)
-
- @classmethod
- def from_json(cls, json_str: str) -> Self:
- """Create an instance of WithPaging from a JSON string."""
- return cls.from_dict(json.loads(json_str))
-
- def to_dict(self) -> Dict[str, Any]:
- """Get the dictionary representation of the model using alias.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
- This has the following differences from calling pydantic's
- `self.model_dump(by_alias=True)`:
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the WithPaging instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- * `None` is only added to the output dict for nullable fields that
- were set at model initialization. Other fields with value `None`
- are ignored.
- """
- _dict = self.model_dump(
- by_alias=True,
- exclude={},
- exclude_none=True,
+ def to_json(self) -> str:
+ """Convert the WithPaging instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
)
- return _dict
@classmethod
- def from_dict(cls, obj: Dict) -> Self:
- """Create an instance of WithPaging from a dict."""
- if obj is None:
- return None
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a WithPaging instance from a dict."""
return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a WithPaging instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/models/with_pagingobject.py b/waylay_registry_types/src/waylay/services/registry/models/with_pagingobject.py
deleted file mode 100644
index 6cbd270f..00000000
--- a/waylay_registry_types/src/waylay/services/registry/models/with_pagingobject.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# workaround definition to resolve the import
-# from ..models.object import object
-# generated by `vendorExtensions.x-py-model-imports`
-object = object
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/default_api.py b/waylay_registry_types/src/waylay/services/registry/queries/default_api.py
index c88af220..77530cc9 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/default_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/default_api.py
@@ -9,11 +9,75 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
+import warnings
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
+)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- TypedDict, # >=3.12
+ Self, # >=3.11
)
+from ..models.root_page_response import RootPageResponse
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """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,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
-class GetQuery(TypedDict):
- """get query parameters."""
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/jobs_api.py b/waylay_registry_types/src/waylay/services/registry/queries/jobs_api.py
index 6a561b6a..7ad466f1 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/jobs_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/jobs_api.py
@@ -9,17 +9,24 @@
"""
from __future__ import annotations # for Python 3.7–3.9
-
-from pydantic import Field, StrictStr
-from typing import (
- List,
- Optional,
- Union,
- Any,
+import io
+import warnings
+
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- NotRequired, # >=3.11
- TypedDict, # >=3.12
+ Self, # >=3.11
)
from pydantic import Field
@@ -28,88 +35,220 @@
from typing import Any, List, Optional, Union
+from ..models.event_with_close_sse import EventWithCloseSSE
from ..models.function_type import FunctionType
+from ..models.job_response import JobResponse
from ..models.job_state_result import JobStateResult
from ..models.job_type import JobType
from ..models.job_type_schema import JobTypeSchema
-
-
-class EventsQuery(TypedDict):
- """events query parameters."""
-
- # TODO use type
- type: NotRequired[
- Annotated[Optional[JobType], Field(description="The type of the job.")]
- ]
- # TODO use id
- id: NotRequired[
- Annotated[Optional[StrictStr], Field(description="The id of the job.")]
- ]
- # TODO use children
- children: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to false
."
- ),
- ]
- ]
-
-
-class GetQuery(TypedDict):
- """get query parameters."""
-
-
-class ListQuery(TypedDict):
- """list query parameters."""
-
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use type
- type: NotRequired[
- Annotated[
- Optional[List[JobTypeSchema]], Field(description="Filter on job type")
- ]
- ]
- # TODO use state
- state: NotRequired[
- Annotated[
- Optional[List[JobStateResult]], Field(description="Filter on job state")
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]], Field(description="Filter on function type")
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created before the given timestamp or age"
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created after the given timestamp or age"
- ),
- ]
- ]
+from ..models.jobs_response import JobsResponse
+
+
+def _events_query_alias_for(field_name: str) -> str:
+ if field_name == "type":
+ return "type"
+ if field_name == "id":
+ return "id"
+ if field_name == "children":
+ return "children"
+ return field_name
+
+
+class EventsQuery(BaseModel):
+ """Model for `events` query parameters."""
+
+ type: Annotated[JobType | None, Field(description="The type of the job.")] = None
+ id: Annotated[StrictStr | None, Field(description="The id of the job.")] = None
+ children: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, the event stream will include events of the job's dependants. E.g., when subscribing to a verify job with `children=true`, you will also receive the events of the underlying build and deploy jobs. Defaults to false
."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_events_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the EventsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the EventsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a EventsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a EventsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """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,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "type":
+ return "type"
+ if field_name == "state":
+ return "state"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ return field_name
+
+
+class ListQuery(BaseModel):
+ """Model for `list` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ type: Annotated[
+ List[JobTypeSchema] | None, Field(description="Filter on job type")
+ ] = None
+ state: Annotated[
+ List[JobStateResult] | None, Field(description="Filter on job state")
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None, Field(description="Filter on function type")
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created before the given timestamp or age"
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created after the given timestamp or age"
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/model_functions_api.py b/waylay_registry_types/src/waylay/services/registry/queries/model_functions_api.py
index 917cb8bd..8bb972bf 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/model_functions_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/model_functions_api.py
@@ -9,853 +9,1581 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
+import warnings
-from pydantic import Field, StrictStr
-from typing import (
- List,
- Optional,
- Union,
- Any,
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- NotRequired, # >=3.11
- TypedDict, # >=3.12
+ Self, # >=3.11
)
from pydantic import Field
from typing_extensions import Annotated
-from pydantic import StrictBool, StrictStr
+from pydantic import StrictBool, StrictStr, field_validator
from typing import Any, List, Optional, Union
from ..models.archive_format import ArchiveFormat
from ..models.deprecate_previous_policy import DeprecatePreviousPolicy
+from ..models.file_upload import FileUpload
+from ..models.function_meta import FunctionMeta
from ..models.function_type import FunctionType
+from ..models.get_model_response_v2 import GetModelResponseV2
from ..models.job_state_result import JobStateResult
from ..models.job_type_schema import JobTypeSchema
+from ..models.jobs_for_model_response_v2 import JobsForModelResponseV2
+from ..models.latest_models_response_v2 import LatestModelsResponseV2
+from ..models.model_versions_response_v2 import ModelVersionsResponseV2
+from ..models.multipart_file_upload import MultipartFileUpload
+from ..models.post_model_job_sync_response_v2 import PostModelJobSyncResponseV2
+from ..models.rebuild_model_sync_response_v2 import RebuildModelSyncResponseV2
from ..models.rebuild_policy import RebuildPolicy
from ..models.status_filter import StatusFilter
+from ..models.undeployed_response_v2 import UndeployedResponseV2
+from ..models.verify_model_sync_response_v2 import VerifyModelSyncResponseV2
-class CreateQuery(TypedDict):
- """create query parameters."""
+def _create_query_alias_for(field_name: str) -> str:
+ if field_name == "deprecate_previous":
+ return "deprecatePrevious"
+ if field_name == "dry_run":
+ return "dryRun"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ if field_name == "version":
+ return "version"
+ if field_name == "name":
+ return "name"
+ if field_name == "draft":
+ return "draft"
+ return field_name
- # TODO use deprecatePrevious
- deprecate_previous: NotRequired[
- Annotated[
- Optional[DeprecatePreviousPolicy],
- Field(
- description="Set the cleanup policy used to automatically deprecate/delete previous versions."
- ),
- ]
- ]
- # TODO use dryRun
- dry_run: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, validates the deployment conditions, but does not change anything."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately."
- ),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="If set, the value will be used as the function name instead of the one specified in the manifest."
- ),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid."
- ),
- ]
- ]
+class CreateQuery(BaseModel):
+ """Model for `create` query parameters."""
+
+ deprecate_previous: Annotated[
+ DeprecatePreviousPolicy | None,
+ Field(
+ description="Set the cleanup policy used to automatically deprecate/delete previous versions."
+ ),
+ ] = None
+ dry_run: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, validates the deployment conditions, but does not change anything."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately."
+ ),
+ ] = None
+ version: Annotated[
+ Any | None,
+ Field(
+ description="If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="If set, the value will be used as the function name instead of the one specified in the manifest."
+ ),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_create_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
-class DeleteAssetQuery(TypedDict):
- """delete_asset query parameters."""
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreateQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the CreateQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreateQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreateQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _delete_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class DeleteAssetQuery(BaseModel):
+ """Model for `delete_asset` query parameters."""
- # TODO use chown
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_delete_asset_query_alias_for,
+ populate_by_name=True,
+ )
-class GetArchiveQuery(TypedDict):
- """get_archive query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeleteAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
-class GetAssetQuery(TypedDict):
- """get_asset query parameters."""
+ def to_json(self) -> str:
+ """Convert the DeleteAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeleteAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeleteAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class GetLatestQuery(TypedDict):
- """get_latest query parameters."""
- # TODO use includeDraft
- include_draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
- ),
- ]
- ]
+def _get_archive_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ return field_name
-class GetQuery(TypedDict):
- """get query parameters."""
+class GetArchiveQuery(BaseModel):
+ """Model for `get_archive` query parameters."""
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
-class JobsQuery(TypedDict):
- """jobs query parameters."""
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_archive_query_alias_for,
+ populate_by_name=True,
+ )
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use type
- type: NotRequired[
- Annotated[
- Optional[List[JobTypeSchema]], Field(description="Filter on job type")
- ]
- ]
- # TODO use state
- state: NotRequired[
- Annotated[
- Optional[List[JobStateResult]], Field(description="Filter on job state")
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]], Field(description="Filter on function type")
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created before the given timestamp or age"
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created after the given timestamp or age"
- ),
- ]
- ]
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
-class ListQuery(TypedDict):
- """list query parameters."""
-
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use page
- page: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The number of pages to skip when returning result to this query."
- ),
- ]
- ]
- # TODO use includeDraft
- include_draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
- ),
- ]
- ]
- # TODO use deprecated
- deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the deprecation status of the function."),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the draft status of the function."),
- ]
- ]
- # TODO use nameVersion
- name_version: NotRequired[
- Annotated[
- Optional[List[Annotated[str, Field(strict=True)]]],
- Field(
- description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered."
- ),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the version of the function (case-sensitive, supports wildcards)."
- ),
- ]
- ]
- # TODO use status
- status: NotRequired[
- Annotated[
- Optional[List[StatusFilter]],
- Field(
- description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
- ),
- ]
- ]
- # TODO use runtimeVersion
- runtime_version: NotRequired[
- Annotated[Optional[Any], Field(description="Filter on the runtime version.")]
- ]
- # TODO use createdBy
- created_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use updatedBy
- updated_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created before the given timestamp or age."
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created after the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedBefore
- updated_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated before the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedAfter
- updated_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated after the given timestamp or age."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters)."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(description="Filter on the archive format of the function."),
- ]
- ]
- # TODO use runtime
- runtime: NotRequired[
- Annotated[
- Optional[List[StrictStr]],
- Field(description="Filter on the runtime of the function."),
- ]
- ]
- # TODO use latest
- latest: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter."
- ),
- ]
- ]
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetArchiveQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+ def to_json(self) -> str:
+ """Convert the GetArchiveQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
-class ListVersionsQuery(TypedDict):
- """list_versions query parameters."""
-
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use page
- page: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The number of pages to skip when returning result to this query."
- ),
- ]
- ]
- # TODO use deprecated
- deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the deprecation status of the function."),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the draft status of the function."),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the version of the function (case-sensitive, supports wildcards)."
- ),
- ]
- ]
- # TODO use status
- status: NotRequired[
- Annotated[
- Optional[List[StatusFilter]],
- Field(
- description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
- ),
- ]
- ]
- # TODO use runtimeVersion
- runtime_version: NotRequired[
- Annotated[Optional[Any], Field(description="Filter on the runtime version.")]
- ]
- # TODO use createdBy
- created_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use updatedBy
- updated_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created before the given timestamp or age."
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created after the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedBefore
- updated_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated before the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedAfter
- updated_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated after the given timestamp or age."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(description="Filter on the archive format of the function."),
- ]
- ]
- # TODO use runtime
- runtime: NotRequired[
- Annotated[
- Optional[List[StrictStr]],
- Field(description="Filter on the runtime of the function."),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetArchiveQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetArchiveQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class PatchMetadataQuery(TypedDict):
- """patch_metadata query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
+def _get_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ return field_name
-class PublishQuery(TypedDict):
- """publish query parameters."""
+class GetAssetQuery(BaseModel):
+ """Model for `get_asset` query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use deprecatePrevious
- deprecate_previous: NotRequired[
- Annotated[
- Optional[DeprecatePreviousPolicy],
- Field(
- description="Set the cleanup policy used to automatically deprecate/delete previous versions."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_asset_query_alias_for,
+ populate_by_name=True,
+ )
-class RebuildQuery(TypedDict):
- """rebuild query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use dryRun
- dry_run: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use upgrade
- upgrade: NotRequired[
- Annotated[
- Optional[RebuildPolicy],
- Field(
- description="If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .
"
- ),
- ]
- ]
- # TODO use forceVersion
- force_version: NotRequired[
- Annotated[
- Optional[Annotated[str, Field(strict=True)]],
- Field(
- description="If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter."
- ),
- ]
- ]
- # TODO use ignoreChecks
- ignore_checks: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option"
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command."
- ),
- ]
- ]
- # TODO use skipRebuild
- skip_rebuild: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
-class RemoveVersionQuery(TypedDict):
- """remove_version query parameters."""
+ def to_json(self) -> str:
+ """Convert the GetAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use force
- force: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
- ),
- ]
- ]
- # TODO use undeploy
- undeploy: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
- ),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class RemoveVersionsQuery(TypedDict):
- """remove_versions query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use force
- force: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
- ),
- ]
- ]
- # TODO use undeploy
- undeploy: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+def _get_latest_query_alias_for(field_name: str) -> str:
+ if field_name == "include_draft":
+ return "includeDraft"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ return field_name
+
+
+class GetLatestQuery(BaseModel):
+ """Model for `get_latest` query parameters."""
+
+ include_draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_latest_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetLatestQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetLatestQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetLatestQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetLatestQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """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,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _jobs_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "type":
+ return "type"
+ if field_name == "state":
+ return "state"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ return field_name
+
+
+class JobsQuery(BaseModel):
+ """Model for `jobs` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ type: Annotated[
+ List[JobTypeSchema] | None, Field(description="Filter on job type")
+ ] = None
+ state: Annotated[
+ List[JobStateResult] | None, Field(description="Filter on job state")
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None, Field(description="Filter on function type")
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created before the given timestamp or age"
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created after the given timestamp or age"
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_jobs_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the JobsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "page":
+ return "page"
+ if field_name == "include_draft":
+ return "includeDraft"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ if field_name == "deprecated":
+ return "deprecated"
+ if field_name == "draft":
+ return "draft"
+ if field_name == "name_version":
+ return "nameVersion"
+ if field_name == "version":
+ return "version"
+ if field_name == "status":
+ return "status"
+ if field_name == "runtime_version":
+ return "runtimeVersion"
+ if field_name == "created_by":
+ return "createdBy"
+ if field_name == "updated_by":
+ return "updatedBy"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ if field_name == "updated_before":
+ return "updatedBefore"
+ if field_name == "updated_after":
+ return "updatedAfter"
+ if field_name == "name":
+ return "name"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ if field_name == "runtime":
+ return "runtime"
+ if field_name == "latest":
+ return "latest"
+ return field_name
+
+
+class ListQuery(BaseModel):
+ """Model for `list` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ page: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The number of pages to skip when returning result to this query."
+ ),
+ ] = None
+ include_draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
+ ),
+ ] = None
+ deprecated: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the deprecation status of the function."),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the draft status of the function."),
+ ] = None
+ name_version: Annotated[
+ List[Annotated[str, Field(strict=True)]] | None,
+ Field(
+ description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered."
+ ),
+ ] = None
+ version: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the version of the function (case-sensitive, supports wildcards)."
+ ),
+ ] = None
+ status: Annotated[
+ List[StatusFilter] | None,
+ Field(
+ description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
+ ),
+ ] = None
+ runtime_version: Annotated[
+ Any | None, Field(description="Filter on the runtime version.")
+ ] = None
+ created_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ updated_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created before the given timestamp or age."
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created after the given timestamp or age."
+ ),
+ ] = None
+ updated_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated before the given timestamp or age."
+ ),
+ ] = None
+ updated_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated after the given timestamp or age."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters)."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(description="Filter on the archive format of the function."),
+ ] = None
+ runtime: Annotated[
+ List[StrictStr] | None,
+ Field(description="Filter on the runtime of the function."),
+ ] = None
+ latest: Annotated[
+ StrictBool | None,
+ Field(
+ description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_query_alias_for,
+ populate_by_name=True,
+ )
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
-class UpdateAssetQuery(TypedDict):
- """update_asset query parameters."""
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "page":
+ return "page"
+ if field_name == "deprecated":
+ return "deprecated"
+ if field_name == "draft":
+ return "draft"
+ if field_name == "version":
+ return "version"
+ if field_name == "status":
+ return "status"
+ if field_name == "runtime_version":
+ return "runtimeVersion"
+ if field_name == "created_by":
+ return "createdBy"
+ if field_name == "updated_by":
+ return "updatedBy"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ if field_name == "updated_before":
+ return "updatedBefore"
+ if field_name == "updated_after":
+ return "updatedAfter"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ if field_name == "runtime":
+ return "runtime"
+ return field_name
+
+
+class ListVersionsQuery(BaseModel):
+ """Model for `list_versions` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ page: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The number of pages to skip when returning result to this query."
+ ),
+ ] = None
+ deprecated: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the deprecation status of the function."),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the draft status of the function."),
+ ] = None
+ version: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the version of the function (case-sensitive, supports wildcards)."
+ ),
+ ] = None
+ status: Annotated[
+ List[StatusFilter] | None,
+ Field(
+ description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
+ ),
+ ] = None
+ runtime_version: Annotated[
+ Any | None, Field(description="Filter on the runtime version.")
+ ] = None
+ created_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ updated_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created before the given timestamp or age."
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created after the given timestamp or age."
+ ),
+ ] = None
+ updated_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated before the given timestamp or age."
+ ),
+ ] = None
+ updated_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated after the given timestamp or age."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(description="Filter on the archive format of the function."),
+ ] = None
+ runtime: Annotated[
+ List[StrictStr] | None,
+ Field(description="Filter on the runtime of the function."),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _patch_metadata_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ return field_name
+
+
+class PatchMetadataQuery(BaseModel):
+ """Model for `patch_metadata` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_patch_metadata_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchMetadataQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PatchMetadataQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchMetadataQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchMetadataQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _publish_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "deprecate_previous":
+ return "deprecatePrevious"
+ if field_name == "var_async":
+ return "async"
+ return field_name
+
+
+class PublishQuery(BaseModel):
+ """Model for `publish` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ deprecate_previous: Annotated[
+ DeprecatePreviousPolicy | None,
+ Field(
+ description="Set the cleanup policy used to automatically deprecate/delete previous versions."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_publish_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PublishQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PublishQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PublishQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PublishQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _rebuild_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "dry_run":
+ return "dryRun"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "upgrade":
+ return "upgrade"
+ if field_name == "force_version":
+ return "forceVersion"
+ if field_name == "ignore_checks":
+ return "ignoreChecks"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ if field_name == "skip_rebuild":
+ return "skipRebuild"
+ return field_name
+
+
+class RebuildQuery(BaseModel):
+ """Model for `rebuild` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ dry_run: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ upgrade: Annotated[
+ RebuildPolicy | None,
+ Field(
+ description="If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .
"
+ ),
+ ] = None
+ force_version: Annotated[
+ Annotated[str, Field(strict=True)] | None,
+ Field(
+ description="If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter."
+ ),
+ ] = None
+ ignore_checks: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option"
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command."
+ ),
+ ] = None
+ skip_rebuild: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_rebuild_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RebuildQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _remove_version_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "force":
+ return "force"
+ if field_name == "undeploy":
+ return "undeploy"
+ return field_name
+
+
+class RemoveVersionQuery(BaseModel):
+ """Model for `remove_version` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ force: Annotated[
+ StrictBool | None,
+ Field(
+ description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
+ ),
+ ] = None
+ undeploy: Annotated[
+ StrictBool | None,
+ Field(
+ description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_remove_version_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveVersionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RemoveVersionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveVersionQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveVersionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _remove_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "force":
+ return "force"
+ if field_name == "undeploy":
+ return "undeploy"
+ if field_name == "var_async":
+ return "async"
+ return field_name
+
+
+class RemoveVersionsQuery(BaseModel):
+ """Model for `remove_versions` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ force: Annotated[
+ StrictBool | None,
+ Field(
+ description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
+ ),
+ ] = None
+ undeploy: Annotated[
+ StrictBool | None,
+ Field(
+ description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_remove_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RemoveVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _update_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class UpdateAssetQuery(BaseModel):
+ """Model for `update_asset` query parameters."""
- # TODO use chown
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_update_asset_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the UpdateAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class UpdateAssetsQuery(TypedDict):
- """update_assets query parameters."""
- # TODO use chown
+def _update_assets_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class UpdateAssetsQuery(BaseModel):
+ """Model for `update_assets` query parameters."""
+
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_update_assets_query_alias_for,
+ populate_by_name=True,
+ )
-class VerifyQuery(TypedDict):
- """verify query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateAssetsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the UpdateAssetsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateAssetsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateAssetsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _verify_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ return field_name
+
+
+class VerifyQuery(BaseModel):
+ """Model for `verify` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_verify_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the VerifyQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/plug_functions_api.py b/waylay_registry_types/src/waylay/services/registry/queries/plug_functions_api.py
index 292594ac..c79ac6b2 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/plug_functions_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/plug_functions_api.py
@@ -9,900 +9,1669 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
+import warnings
-from pydantic import Field, StrictStr
-from typing import (
- List,
- Optional,
- Union,
- Any,
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- NotRequired, # >=3.11
- TypedDict, # >=3.12
+ Self, # >=3.11
)
from pydantic import Field
from typing_extensions import Annotated
-from pydantic import StrictBool, StrictStr
+from pydantic import StrictBool, StrictStr, field_validator
from typing import Any, List, Optional, Union
from ..models.archive_format import ArchiveFormat
from ..models.deprecate_previous_policy import DeprecatePreviousPolicy
+from ..models.documentation import Documentation
+from ..models.file_upload import FileUpload
from ..models.function_type import FunctionType
+from ..models.get_plug_response_v2 import GetPlugResponseV2
from ..models.job_state_result import JobStateResult
from ..models.job_type_schema import JobTypeSchema
+from ..models.jobs_for_plug_response_v2 import JobsForPlugResponseV2
+from ..models.latest_plugs_response_v2 import LatestPlugsResponseV2
+from ..models.multipart_file_upload import MultipartFileUpload
from ..models.plug_type import PlugType
+from ..models.plug_versions_response_v2 import PlugVersionsResponseV2
+from ..models.post_plug_job_sync_response_v2 import PostPlugJobSyncResponseV2
+from ..models.rebuild_plug_sync_response_v2 import RebuildPlugSyncResponseV2
from ..models.rebuild_policy import RebuildPolicy
from ..models.status_filter import StatusFilter
+from ..models.undeployed_response_v2 import UndeployedResponseV2
+from ..models.update_metadata_request_v2 import UpdateMetadataRequestV2
+from ..models.verify_plug_sync_response_v2 import VerifyPlugSyncResponseV2
-class CreateQuery(TypedDict):
- """create query parameters."""
+def _create_query_alias_for(field_name: str) -> str:
+ if field_name == "deprecate_previous":
+ return "deprecatePrevious"
+ if field_name == "dry_run":
+ return "dryRun"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ if field_name == "version":
+ return "version"
+ if field_name == "name":
+ return "name"
+ if field_name == "draft":
+ return "draft"
+ return field_name
- # TODO use deprecatePrevious
- deprecate_previous: NotRequired[
- Annotated[
- Optional[DeprecatePreviousPolicy],
- Field(
- description="Set the cleanup policy used to automatically deprecate/delete previous versions."
- ),
- ]
- ]
- # TODO use dryRun
- dry_run: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, validates the deployment conditions, but does not change anything."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately."
- ),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="If set, the value will be used as the function name instead of the one specified in the manifest."
- ),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid."
- ),
- ]
- ]
+class CreateQuery(BaseModel):
+ """Model for `create` query parameters."""
+
+ deprecate_previous: Annotated[
+ DeprecatePreviousPolicy | None,
+ Field(
+ description="Set the cleanup policy used to automatically deprecate/delete previous versions."
+ ),
+ ] = None
+ dry_run: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, validates the deployment conditions, but does not change anything."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately."
+ ),
+ ] = None
+ version: Annotated[
+ Any | None,
+ Field(
+ description="If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="If set, the value will be used as the function name instead of the one specified in the manifest."
+ ),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_create_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
-class DeleteAssetQuery(TypedDict):
- """delete_asset query parameters."""
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreateQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the CreateQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreateQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreateQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _delete_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class DeleteAssetQuery(BaseModel):
+ """Model for `delete_asset` query parameters."""
- # TODO use chown
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_delete_asset_query_alias_for,
+ populate_by_name=True,
+ )
-class GetArchiveQuery(TypedDict):
- """get_archive query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeleteAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
-class GetAssetQuery(TypedDict):
- """get_asset query parameters."""
+ def to_json(self) -> str:
+ """Convert the DeleteAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeleteAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeleteAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class GetLatestQuery(TypedDict):
- """get_latest query parameters."""
- # TODO use type
- type: NotRequired[
- Annotated[
- Optional[PlugType],
- Field(description="If set, filters on the type of plug."),
- ]
- ]
- # TODO use includeDraft
- include_draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
- ),
- ]
- ]
+def _get_archive_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ return field_name
-class GetQuery(TypedDict):
- """get query parameters."""
+class GetArchiveQuery(BaseModel):
+ """Model for `get_archive` query parameters."""
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
-class JobsQuery(TypedDict):
- """jobs query parameters."""
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_archive_query_alias_for,
+ populate_by_name=True,
+ )
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use type
- type: NotRequired[
- Annotated[
- Optional[List[JobTypeSchema]], Field(description="Filter on job type")
- ]
- ]
- # TODO use state
- state: NotRequired[
- Annotated[
- Optional[List[JobStateResult]], Field(description="Filter on job state")
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]], Field(description="Filter on function type")
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created before the given timestamp or age"
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created after the given timestamp or age"
- ),
- ]
- ]
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
-class ListQuery(TypedDict):
- """list query parameters."""
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetArchiveQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- # TODO use tags
- tags: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected."
- ),
- ]
- ]
- # TODO use type
- type: NotRequired[
- Annotated[
- Optional[PlugType],
- Field(description="If set, filters on the type of plug."),
- ]
- ]
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use page
- page: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The number of pages to skip when returning result to this query."
- ),
- ]
- ]
- # TODO use includeDraft
- include_draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
- ),
- ]
- ]
- # TODO use deprecated
- deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the deprecation status of the function."),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the draft status of the function."),
- ]
- ]
- # TODO use nameVersion
- name_version: NotRequired[
- Annotated[
- Optional[List[Annotated[str, Field(strict=True)]]],
- Field(
- description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered."
- ),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the version of the function (case-sensitive, supports wildcards)."
- ),
- ]
- ]
- # TODO use status
- status: NotRequired[
- Annotated[
- Optional[List[StatusFilter]],
- Field(
- description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
- ),
- ]
- ]
- # TODO use runtimeVersion
- runtime_version: NotRequired[
- Annotated[Optional[Any], Field(description="Filter on the runtime version.")]
- ]
- # TODO use createdBy
- created_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use updatedBy
- updated_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created before the given timestamp or age."
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created after the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedBefore
- updated_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated before the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedAfter
- updated_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated after the given timestamp or age."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters)."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(description="Filter on the archive format of the function."),
- ]
- ]
- # TODO use runtime
- runtime: NotRequired[
- Annotated[
- Optional[List[StrictStr]],
- Field(description="Filter on the runtime of the function."),
- ]
- ]
- # TODO use latest
- latest: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter."
- ),
- ]
- ]
+ def to_json(self) -> str:
+ """Convert the GetArchiveQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetArchiveQuery instance from a dict."""
+ return cls.model_validate(obj)
-class ListVersionsQuery(TypedDict):
- """list_versions query parameters."""
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetArchiveQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
- # TODO use tags
- tags: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected."
- ),
- ]
- ]
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use page
- page: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The number of pages to skip when returning result to this query."
- ),
- ]
- ]
- # TODO use deprecated
- deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the deprecation status of the function."),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the draft status of the function."),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the version of the function (case-sensitive, supports wildcards)."
- ),
- ]
- ]
- # TODO use status
- status: NotRequired[
- Annotated[
- Optional[List[StatusFilter]],
- Field(
- description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
- ),
- ]
- ]
- # TODO use runtimeVersion
- runtime_version: NotRequired[
- Annotated[Optional[Any], Field(description="Filter on the runtime version.")]
- ]
- # TODO use createdBy
- created_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use updatedBy
- updated_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created before the given timestamp or age."
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created after the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedBefore
- updated_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated before the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedAfter
- updated_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated after the given timestamp or age."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(description="Filter on the archive format of the function."),
- ]
- ]
- # TODO use runtime
- runtime: NotRequired[
- Annotated[
- Optional[List[StrictStr]],
- Field(description="Filter on the runtime of the function."),
- ]
- ]
+def _get_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ return field_name
-class PatchInterfaceQuery(TypedDict):
- """patch_interface query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
+class GetAssetQuery(BaseModel):
+ """Model for `get_asset` query parameters."""
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
-class PatchMetadataQuery(TypedDict):
- """patch_metadata query parameters."""
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_asset_query_alias_for,
+ populate_by_name=True,
+ )
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
-class PublishQuery(TypedDict):
- """publish query parameters."""
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use deprecatePrevious
- deprecate_previous: NotRequired[
- Annotated[
- Optional[DeprecatePreviousPolicy],
- Field(
- description="Set the cleanup policy used to automatically deprecate/delete previous versions."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ def to_json(self) -> str:
+ """Convert the GetAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
-class RebuildQuery(TypedDict):
- """rebuild query parameters."""
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use dryRun
- dry_run: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use upgrade
- upgrade: NotRequired[
- Annotated[
- Optional[RebuildPolicy],
- Field(
- description="If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .
"
- ),
- ]
- ]
- # TODO use forceVersion
- force_version: NotRequired[
- Annotated[
- Optional[Annotated[str, Field(strict=True)]],
- Field(
- description="If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter."
- ),
- ]
- ]
- # TODO use ignoreChecks
- ignore_checks: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option"
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command."
- ),
- ]
- ]
- # TODO use skipRebuild
- skip_rebuild: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function."
- ),
- ]
- ]
+def _get_latest_query_alias_for(field_name: str) -> str:
+ if field_name == "type":
+ return "type"
+ if field_name == "include_draft":
+ return "includeDraft"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ return field_name
-class RemoveVersionQuery(TypedDict):
- """remove_version query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use force
- force: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings."
- ),
- ]
- ]
- # TODO use undeploy
- undeploy: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
- ),
- ]
- ]
+class GetLatestQuery(BaseModel):
+ """Model for `get_latest` query parameters."""
+ type: Annotated[
+ PlugType | None, Field(description="If set, filters on the type of plug.")
+ ] = None
+ include_draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
+ ),
+ ] = None
-class RemoveVersionsQuery(TypedDict):
- """remove_versions query parameters."""
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_latest_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetLatestQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetLatestQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetLatestQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetLatestQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """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,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _jobs_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "type":
+ return "type"
+ if field_name == "state":
+ return "state"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ return field_name
+
+
+class JobsQuery(BaseModel):
+ """Model for `jobs` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ type: Annotated[
+ List[JobTypeSchema] | None, Field(description="Filter on job type")
+ ] = None
+ state: Annotated[
+ List[JobStateResult] | None, Field(description="Filter on job state")
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None, Field(description="Filter on function type")
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created before the given timestamp or age"
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created after the given timestamp or age"
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_jobs_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the JobsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_query_alias_for(field_name: str) -> str:
+ if field_name == "tags":
+ return "tags"
+ if field_name == "type":
+ return "type"
+ if field_name == "limit":
+ return "limit"
+ if field_name == "page":
+ return "page"
+ if field_name == "include_draft":
+ return "includeDraft"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ if field_name == "deprecated":
+ return "deprecated"
+ if field_name == "draft":
+ return "draft"
+ if field_name == "name_version":
+ return "nameVersion"
+ if field_name == "version":
+ return "version"
+ if field_name == "status":
+ return "status"
+ if field_name == "runtime_version":
+ return "runtimeVersion"
+ if field_name == "created_by":
+ return "createdBy"
+ if field_name == "updated_by":
+ return "updatedBy"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ if field_name == "updated_before":
+ return "updatedBefore"
+ if field_name == "updated_after":
+ return "updatedAfter"
+ if field_name == "name":
+ return "name"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ if field_name == "runtime":
+ return "runtime"
+ if field_name == "latest":
+ return "latest"
+ return field_name
+
+
+class ListQuery(BaseModel):
+ """Model for `list` query parameters."""
+
+ tags: Annotated[
+ Any | None,
+ Field(
+ description="Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected."
+ ),
+ ] = None
+ type: Annotated[
+ PlugType | None, Field(description="If set, filters on the type of plug.")
+ ] = None
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ page: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The number of pages to skip when returning result to this query."
+ ),
+ ] = None
+ include_draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
+ ),
+ ] = None
+ deprecated: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the deprecation status of the function."),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the draft status of the function."),
+ ] = None
+ name_version: Annotated[
+ List[Annotated[str, Field(strict=True)]] | None,
+ Field(
+ description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered."
+ ),
+ ] = None
+ version: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the version of the function (case-sensitive, supports wildcards)."
+ ),
+ ] = None
+ status: Annotated[
+ List[StatusFilter] | None,
+ Field(
+ description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
+ ),
+ ] = None
+ runtime_version: Annotated[
+ Any | None, Field(description="Filter on the runtime version.")
+ ] = None
+ created_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ updated_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created before the given timestamp or age."
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created after the given timestamp or age."
+ ),
+ ] = None
+ updated_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated before the given timestamp or age."
+ ),
+ ] = None
+ updated_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated after the given timestamp or age."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters)."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(description="Filter on the archive format of the function."),
+ ] = None
+ runtime: Annotated[
+ List[StrictStr] | None,
+ Field(description="Filter on the runtime of the function."),
+ ] = None
+ latest: Annotated[
+ StrictBool | None,
+ Field(
+ description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use force
- force: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings."
- ),
- ]
- ]
- # TODO use undeploy
- undeploy: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
- ),
- ]
- ]
+def _list_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "tags":
+ return "tags"
+ if field_name == "limit":
+ return "limit"
+ if field_name == "page":
+ return "page"
+ if field_name == "deprecated":
+ return "deprecated"
+ if field_name == "draft":
+ return "draft"
+ if field_name == "version":
+ return "version"
+ if field_name == "status":
+ return "status"
+ if field_name == "runtime_version":
+ return "runtimeVersion"
+ if field_name == "created_by":
+ return "createdBy"
+ if field_name == "updated_by":
+ return "updatedBy"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ if field_name == "updated_before":
+ return "updatedBefore"
+ if field_name == "updated_after":
+ return "updatedAfter"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ if field_name == "runtime":
+ return "runtime"
+ return field_name
-class UpdateAssetQuery(TypedDict):
- """update_asset query parameters."""
- # TODO use chown
+class ListVersionsQuery(BaseModel):
+ """Model for `list_versions` query parameters."""
+
+ tags: Annotated[
+ Any | None,
+ Field(
+ description="Filter on the tags of the item. Can be a single tag, or a list of tags. When multiple tags are specified, an item must have all of the tags to be selected."
+ ),
+ ] = None
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ page: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The number of pages to skip when returning result to this query."
+ ),
+ ] = None
+ deprecated: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the deprecation status of the function."),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the draft status of the function."),
+ ] = None
+ version: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the version of the function (case-sensitive, supports wildcards)."
+ ),
+ ] = None
+ status: Annotated[
+ List[StatusFilter] | None,
+ Field(
+ description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
+ ),
+ ] = None
+ runtime_version: Annotated[
+ Any | None, Field(description="Filter on the runtime version.")
+ ] = None
+ created_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ updated_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created before the given timestamp or age."
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created after the given timestamp or age."
+ ),
+ ] = None
+ updated_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated before the given timestamp or age."
+ ),
+ ] = None
+ updated_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated after the given timestamp or age."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(description="Filter on the archive format of the function."),
+ ] = None
+ runtime: Annotated[
+ List[StrictStr] | None,
+ Field(description="Filter on the runtime of the function."),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _patch_interface_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ return field_name
+
+
+class PatchInterfaceQuery(BaseModel):
+ """Model for `patch_interface` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_patch_interface_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchInterfaceQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PatchInterfaceQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchInterfaceQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchInterfaceQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _patch_metadata_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ return field_name
+
+
+class PatchMetadataQuery(BaseModel):
+ """Model for `patch_metadata` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_patch_metadata_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchMetadataQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PatchMetadataQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchMetadataQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchMetadataQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _publish_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "deprecate_previous":
+ return "deprecatePrevious"
+ if field_name == "var_async":
+ return "async"
+ return field_name
+
+
+class PublishQuery(BaseModel):
+ """Model for `publish` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ deprecate_previous: Annotated[
+ DeprecatePreviousPolicy | None,
+ Field(
+ description="Set the cleanup policy used to automatically deprecate/delete previous versions."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_publish_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PublishQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PublishQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PublishQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PublishQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _rebuild_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "dry_run":
+ return "dryRun"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "upgrade":
+ return "upgrade"
+ if field_name == "force_version":
+ return "forceVersion"
+ if field_name == "ignore_checks":
+ return "ignoreChecks"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ if field_name == "skip_rebuild":
+ return "skipRebuild"
+ return field_name
+
+
+class RebuildQuery(BaseModel):
+ """Model for `rebuild` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ dry_run: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ upgrade: Annotated[
+ RebuildPolicy | None,
+ Field(
+ description="If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .
"
+ ),
+ ] = None
+ force_version: Annotated[
+ Annotated[str, Field(strict=True)] | None,
+ Field(
+ description="If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter."
+ ),
+ ] = None
+ ignore_checks: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option"
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command."
+ ),
+ ] = None
+ skip_rebuild: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_rebuild_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RebuildQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _remove_version_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "force":
+ return "force"
+ if field_name == "undeploy":
+ return "undeploy"
+ return field_name
+
+
+class RemoveVersionQuery(BaseModel):
+ """Model for `remove_version` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ force: Annotated[
+ StrictBool | None,
+ Field(
+ description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings."
+ ),
+ ] = None
+ undeploy: Annotated[
+ StrictBool | None,
+ Field(
+ description="If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_remove_version_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveVersionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RemoveVersionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveVersionQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveVersionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _remove_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "force":
+ return "force"
+ if field_name == "undeploy":
+ return "undeploy"
+ return field_name
+
+
+class RemoveVersionsQuery(BaseModel):
+ """Model for `remove_versions` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ force: Annotated[
+ StrictBool | None,
+ Field(
+ description="If true
, the plug version(s) will be undeployed and removed. Otherwise, the plug version(s) will only be deprecated
, i.e removed from regular listings."
+ ),
+ ] = None
+ undeploy: Annotated[
+ StrictBool | None,
+ Field(
+ description="If `true`, the `DELETE` operation * undeploys the (openfaas) function for the plug: it becomes no longer available for invocation. * does NOT remove the plug from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the plug can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug version(s) as _deprecated_: the plug remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_remove_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RemoveVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _update_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class UpdateAssetQuery(BaseModel):
+ """Model for `update_asset` query parameters."""
+
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_update_asset_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+ def to_json(self) -> str:
+ """Convert the UpdateAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
-class UpdateAssetsQuery(TypedDict):
- """update_assets query parameters."""
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _update_assets_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class UpdateAssetsQuery(BaseModel):
+ """Model for `update_assets` query parameters."""
- # TODO use chown
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_update_assets_query_alias_for,
+ populate_by_name=True,
+ )
-class VerifyQuery(TypedDict):
- """verify query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateAssetsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the UpdateAssetsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateAssetsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateAssetsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _verify_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ return field_name
+
+
+class VerifyQuery(BaseModel):
+ """Model for `verify` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_verify_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the VerifyQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/runtimes_api.py b/waylay_registry_types/src/waylay/services/registry/queries/runtimes_api.py
index 8e92ada9..d9b81c96 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/runtimes_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/runtimes_api.py
@@ -9,234 +9,506 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
+import warnings
-from pydantic import Field, StrictStr
-from typing import (
- List,
- Optional,
- Any,
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- NotRequired, # >=3.11
- TypedDict, # >=3.12
+ Self, # >=3.11
)
from pydantic import Field
from typing_extensions import Annotated
from pydantic import StrictBool, StrictStr
-from typing import Any, List, Optional
+from typing import Any, List, Optional, Union
from ..models.archive_format import ArchiveFormat
from ..models.function_type import FunctionType
from ..models.latest_version_level import LatestVersionLevel
+from ..models.runtime_summary_response import RuntimeSummaryResponse
+from ..models.runtime_version_response import RuntimeVersionResponse
-class ExampleArchiveQuery(TypedDict):
- """example_archive query parameters."""
-
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, deprecated runtimes will be included in the query."
- ),
- ]
- ]
-
-
-class GetExampleAssetQuery(TypedDict):
- """get_example_asset query parameters."""
-
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, deprecated runtimes will be included in the query."
- ),
- ]
- ]
-
-
-class GetLatestQuery(TypedDict):
- """get_latest query parameters."""
-
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver)."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, deprecated runtimes will be included in the query."
- ),
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]],
- Field(
- description="If set, filters on the functionType
of a runtime. Uses an exact match."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(
- description="If set, filters on the archiveFormat
of a runtime. Uses an exact match."
- ),
- ]
- ]
-
-
-class GetQuery(TypedDict):
- """get query parameters."""
-
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, deprecated runtimes will be included in the query."
- ),
- ]
- ]
-
-
-class ListQuery(TypedDict):
- """list query parameters."""
-
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver)."
- ),
- ]
- ]
- # TODO use latest
- latest: NotRequired[
- Annotated[
- Optional[LatestVersionLevel],
- Field(
- description="If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, deprecated runtimes will be included in the query."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="If set, filters on the name
of a runtime. Supports *
and ?
wildcards and is case-insensitive."
- ),
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]],
- Field(
- description="If set, filters on the functionType
of a runtime. Uses an exact match."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(
- description="If set, filters on the archiveFormat
of a runtime. Uses an exact match."
- ),
- ]
- ]
-
-
-class ListVersionsQuery(TypedDict):
- """list_versions query parameters."""
-
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver)."
- ),
- ]
- ]
- # TODO use latest
- latest: NotRequired[
- Annotated[
- Optional[LatestVersionLevel],
- Field(
- description="If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, deprecated runtimes will be included in the query."
- ),
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]],
- Field(
- description="If set, filters on the functionType
of a runtime. Uses an exact match."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(
- description="If set, filters on the archiveFormat
of a runtime. Uses an exact match."
- ),
- ]
- ]
+def _example_archive_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ return field_name
+
+
+class ExampleArchiveQuery(BaseModel):
+ """Model for `example_archive` query parameters."""
+
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, deprecated runtimes will be included in the query."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_example_archive_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ExampleArchiveQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ExampleArchiveQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ExampleArchiveQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ExampleArchiveQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_example_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ return field_name
+
+
+class GetExampleAssetQuery(BaseModel):
+ """Model for `get_example_asset` query parameters."""
+
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, deprecated runtimes will be included in the query."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_example_asset_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetExampleAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetExampleAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetExampleAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetExampleAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_latest_query_alias_for(field_name: str) -> str:
+ if field_name == "version":
+ return "version"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ return field_name
+
+
+class GetLatestQuery(BaseModel):
+ """Model for `get_latest` query parameters."""
+
+ version: Annotated[
+ Any | None,
+ Field(
+ description="If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver)."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, deprecated runtimes will be included in the query."
+ ),
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None,
+ Field(
+ description="If set, filters on the functionType
of a runtime. Uses an exact match."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(
+ description="If set, filters on the archiveFormat
of a runtime. Uses an exact match."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_latest_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetLatestQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetLatestQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetLatestQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetLatestQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """Model for `get` query parameters."""
+
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, deprecated runtimes will be included in the query."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_query_alias_for(field_name: str) -> str:
+ if field_name == "version":
+ return "version"
+ if field_name == "latest":
+ return "latest"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ if field_name == "name":
+ return "name"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ return field_name
+
+
+class ListQuery(BaseModel):
+ """Model for `list` query parameters."""
+
+ version: Annotated[
+ Any | None,
+ Field(
+ description="If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver)."
+ ),
+ ] = None
+ latest: Annotated[
+ LatestVersionLevel | None,
+ Field(
+ description="If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, deprecated runtimes will be included in the query."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="If set, filters on the name
of a runtime. Supports *
and ?
wildcards and is case-insensitive."
+ ),
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None,
+ Field(
+ description="If set, filters on the functionType
of a runtime. Uses an exact match."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(
+ description="If set, filters on the archiveFormat
of a runtime. Uses an exact match."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "version":
+ return "version"
+ if field_name == "latest":
+ return "latest"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ return field_name
+
+
+class ListVersionsQuery(BaseModel):
+ """Model for `list_versions` query parameters."""
+
+ version: Annotated[
+ Any | None,
+ Field(
+ description="If set, filters on the version
of a runtime. Supports [version ranges](https://devhints.io/semver)."
+ ),
+ ] = None
+ latest: Annotated[
+ LatestVersionLevel | None,
+ Field(
+ description="If set, filters on the level of latest versions that will be included in the query. * `major`: include at most one latest version per name and major release. * `minor`: include at most one latest version per name and minor release. * `patch`: include each matching patch version. * `true`: include the latest matching version. * `false`: include any matching version (same as `patch`). This filter is applied after all other selection criteria."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, deprecated runtimes will be included in the query."
+ ),
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None,
+ Field(
+ description="If set, filters on the functionType
of a runtime. Uses an exact match."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(
+ description="If set, filters on the archiveFormat
of a runtime. Uses an exact match."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/schemas_api.py b/waylay_registry_types/src/waylay/services/registry/queries/schemas_api.py
index ec317066..cd8542b5 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/schemas_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/schemas_api.py
@@ -9,15 +9,133 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
+import warnings
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
+)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- TypedDict, # >=3.12
+ Self, # >=3.11
)
+from pydantic import Field
+from typing_extensions import Annotated
+from pydantic import StrictStr
+
+from typing import Any, Dict
+
+from ..models.asset_role import AssetRole
+from ..models.function_type import FunctionType
+
+
+def _get_by_role_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetByRoleQuery(BaseModel):
+ """Model for `get_by_role` query parameters."""
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_by_role_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetByRoleQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetByRoleQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetByRoleQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetByRoleQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """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,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
-class GetByRoleQuery(TypedDict):
- """get_by_role query parameters."""
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
-class GetQuery(TypedDict):
- """get query parameters."""
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
diff --git a/waylay_registry_types/src/waylay/services/registry/queries/webscript_functions_api.py b/waylay_registry_types/src/waylay/services/registry/queries/webscript_functions_api.py
index 8463c0a6..8a2ffbf0 100644
--- a/waylay_registry_types/src/waylay/services/registry/queries/webscript_functions_api.py
+++ b/waylay_registry_types/src/waylay/services/registry/queries/webscript_functions_api.py
@@ -9,853 +9,1581 @@
"""
from __future__ import annotations # for Python 3.7–3.9
+import io
+import warnings
-from pydantic import Field, StrictStr
-from typing import (
- List,
- Optional,
- Union,
- Any,
+from pydantic import (
+ BaseModel,
+ validate_call,
+ Field,
+ StrictFloat,
+ StrictStr,
+ StrictInt,
+ ConfigDict,
+ SerializationInfo,
+ model_serializer,
)
+from pydantic_core import from_json
+from typing import Dict, List, Optional, Tuple, Union, Any, Callable
from typing_extensions import (
- NotRequired, # >=3.11
- TypedDict, # >=3.12
+ Self, # >=3.11
)
from pydantic import Field
from typing_extensions import Annotated
-from pydantic import StrictBool, StrictStr
+from pydantic import StrictBool, StrictStr, field_validator
from typing import Any, List, Optional, Union
from ..models.archive_format import ArchiveFormat
from ..models.deprecate_previous_policy import DeprecatePreviousPolicy
+from ..models.file_upload import FileUpload
+from ..models.function_meta import FunctionMeta
from ..models.function_type import FunctionType
+from ..models.get_webscript_response_v2 import GetWebscriptResponseV2
from ..models.job_state_result import JobStateResult
from ..models.job_type_schema import JobTypeSchema
+from ..models.jobs_for_webscript_response_v2 import JobsForWebscriptResponseV2
+from ..models.latest_webscripts_response_v2 import LatestWebscriptsResponseV2
+from ..models.multipart_file_upload import MultipartFileUpload
+from ..models.post_webscript_job_sync_response_v2 import PostWebscriptJobSyncResponseV2
from ..models.rebuild_policy import RebuildPolicy
+from ..models.rebuild_webscript_sync_response_v2 import RebuildWebscriptSyncResponseV2
from ..models.status_filter import StatusFilter
+from ..models.undeployed_response_v2 import UndeployedResponseV2
+from ..models.verify_webscript_sync_response_v2 import VerifyWebscriptSyncResponseV2
+from ..models.webscript_versions_response_v2 import WebscriptVersionsResponseV2
-class CreateQuery(TypedDict):
- """create query parameters."""
+def _create_query_alias_for(field_name: str) -> str:
+ if field_name == "deprecate_previous":
+ return "deprecatePrevious"
+ if field_name == "dry_run":
+ return "dryRun"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ if field_name == "version":
+ return "version"
+ if field_name == "name":
+ return "name"
+ if field_name == "draft":
+ return "draft"
+ return field_name
- # TODO use deprecatePrevious
- deprecate_previous: NotRequired[
- Annotated[
- Optional[DeprecatePreviousPolicy],
- Field(
- description="Set the cleanup policy used to automatically deprecate/delete previous versions."
- ),
- ]
- ]
- # TODO use dryRun
- dry_run: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, validates the deployment conditions, but does not change anything."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately."
- ),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="If set, the value will be used as the function name instead of the one specified in the manifest."
- ),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid."
- ),
- ]
- ]
+class CreateQuery(BaseModel):
+ """Model for `create` query parameters."""
+
+ deprecate_previous: Annotated[
+ DeprecatePreviousPolicy | None,
+ Field(
+ description="Set the cleanup policy used to automatically deprecate/delete previous versions."
+ ),
+ ] = None
+ dry_run: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, validates the deployment conditions, but does not change anything."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, after successful deployment, the deployed function will be scaled to zero. Saves computing resources when the function is not to be used immediately."
+ ),
+ ] = None
+ version: Annotated[
+ Any | None,
+ Field(
+ description="If set, the function version will be an increment of the latest existing version that satisfies the `version` range. Note that this increment always takes precedence over an explicit `version` in the function manifest."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="If set, the value will be used as the function name instead of the one specified in the manifest."
+ ),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set, the created function will be a draft function and its assets are still mutable. A build and deploy is initiated only in the case when all necessary assets are present and valid."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_create_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
-class DeleteAssetQuery(TypedDict):
- """delete_asset query parameters."""
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the CreateQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the CreateQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a CreateQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a CreateQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _delete_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class DeleteAssetQuery(BaseModel):
+ """Model for `delete_asset` query parameters."""
- # TODO use chown
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_delete_asset_query_alias_for,
+ populate_by_name=True,
+ )
-class GetArchiveQuery(TypedDict):
- """get_archive query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the DeleteAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
-class GetAssetQuery(TypedDict):
- """get_asset query parameters."""
+ def to_json(self) -> str:
+ """Convert the DeleteAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
- # TODO use ls
- ls: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
- ),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a DeleteAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a DeleteAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class GetLatestQuery(TypedDict):
- """get_latest query parameters."""
- # TODO use includeDraft
- include_draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
- ),
- ]
- ]
+def _get_archive_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ return field_name
-class GetQuery(TypedDict):
- """get query parameters."""
+class GetArchiveQuery(BaseModel):
+ """Model for `get_archive` query parameters."""
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
-class JobsQuery(TypedDict):
- """jobs query parameters."""
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_archive_query_alias_for,
+ populate_by_name=True,
+ )
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use type
- type: NotRequired[
- Annotated[
- Optional[List[JobTypeSchema]], Field(description="Filter on job type")
- ]
- ]
- # TODO use state
- state: NotRequired[
- Annotated[
- Optional[List[JobStateResult]], Field(description="Filter on job state")
- ]
- ]
- # TODO use functionType
- function_type: NotRequired[
- Annotated[
- Optional[List[FunctionType]], Field(description="Filter on function type")
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created before the given timestamp or age"
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on jobs that created after the given timestamp or age"
- ),
- ]
- ]
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
-class ListVersionsQuery(TypedDict):
- """list_versions query parameters."""
-
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use page
- page: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The number of pages to skip when returning result to this query."
- ),
- ]
- ]
- # TODO use deprecated
- deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the deprecation status of the function."),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the draft status of the function."),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the version of the function (case-sensitive, supports wildcards)."
- ),
- ]
- ]
- # TODO use status
- status: NotRequired[
- Annotated[
- Optional[List[StatusFilter]],
- Field(
- description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
- ),
- ]
- ]
- # TODO use runtimeVersion
- runtime_version: NotRequired[
- Annotated[Optional[Any], Field(description="Filter on the runtime version.")]
- ]
- # TODO use createdBy
- created_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use updatedBy
- updated_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created before the given timestamp or age."
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created after the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedBefore
- updated_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated before the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedAfter
- updated_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated after the given timestamp or age."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(description="Filter on the archive format of the function."),
- ]
- ]
- # TODO use runtime
- runtime: NotRequired[
- Annotated[
- Optional[List[StrictStr]],
- Field(description="Filter on the runtime of the function."),
- ]
- ]
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetArchiveQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+ def to_json(self) -> str:
+ """Convert the GetArchiveQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
-class ListQuery(TypedDict):
- """list query parameters."""
-
- # TODO use limit
- limit: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
- ),
- ]
- ]
- # TODO use page
- page: NotRequired[
- Annotated[
- Optional[
- Union[
- Annotated[float, Field(strict=True, ge=0)],
- Annotated[int, Field(strict=True, ge=0)],
- ]
- ],
- Field(
- description="The number of pages to skip when returning result to this query."
- ),
- ]
- ]
- # TODO use includeDraft
- include_draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
- ),
- ]
- ]
- # TODO use includeDeprecated
- include_deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
- ),
- ]
- ]
- # TODO use deprecated
- deprecated: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the deprecation status of the function."),
- ]
- ]
- # TODO use draft
- draft: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(description="Filter on the draft status of the function."),
- ]
- ]
- # TODO use nameVersion
- name_version: NotRequired[
- Annotated[
- Optional[List[Annotated[str, Field(strict=True)]]],
- Field(
- description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered."
- ),
- ]
- ]
- # TODO use version
- version: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the version of the function (case-sensitive, supports wildcards)."
- ),
- ]
- ]
- # TODO use status
- status: NotRequired[
- Annotated[
- Optional[List[StatusFilter]],
- Field(
- description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
- ),
- ]
- ]
- # TODO use runtimeVersion
- runtime_version: NotRequired[
- Annotated[Optional[Any], Field(description="Filter on the runtime version.")]
- ]
- # TODO use createdBy
- created_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use updatedBy
- updated_by: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
- ),
- ]
- ]
- # TODO use createdBefore
- created_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created before the given timestamp or age."
- ),
- ]
- ]
- # TODO use createdAfter
- created_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were created after the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedBefore
- updated_before: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated before the given timestamp or age."
- ),
- ]
- ]
- # TODO use updatedAfter
- updated_after: NotRequired[
- Annotated[
- Optional[Any],
- Field(
- description="Filter on funtions that were updated after the given timestamp or age."
- ),
- ]
- ]
- # TODO use name
- name: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters)."
- ),
- ]
- ]
- # TODO use archiveFormat
- archive_format: NotRequired[
- Annotated[
- Optional[List[ArchiveFormat]],
- Field(description="Filter on the archive format of the function."),
- ]
- ]
- # TODO use runtime
- runtime: NotRequired[
- Annotated[
- Optional[List[StrictStr]],
- Field(description="Filter on the runtime of the function."),
- ]
- ]
- # TODO use latest
- latest: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter."
- ),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetArchiveQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetArchiveQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class PatchMetadataQuery(TypedDict):
- """patch_metadata query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
+def _get_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "ls":
+ return "ls"
+ return field_name
-class PublishQuery(TypedDict):
- """publish query parameters."""
+class GetAssetQuery(BaseModel):
+ """Model for `get_asset` query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use deprecatePrevious
- deprecate_previous: NotRequired[
- Annotated[
- Optional[DeprecatePreviousPolicy],
- Field(
- description="Set the cleanup policy used to automatically deprecate/delete previous versions."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ ls: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to `true`, the result will be a listing of the files in the asset, annotated with metadata and validation report from the asset conditions of the functions runtime."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_asset_query_alias_for,
+ populate_by_name=True,
+ )
-class RebuildQuery(TypedDict):
- """rebuild query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use dryRun
- dry_run: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use upgrade
- upgrade: NotRequired[
- Annotated[
- Optional[RebuildPolicy],
- Field(
- description="If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .
"
- ),
- ]
- ]
- # TODO use forceVersion
- force_version: NotRequired[
- Annotated[
- Optional[Annotated[str, Field(strict=True)]],
- Field(
- description="If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter."
- ),
- ]
- ]
- # TODO use ignoreChecks
- ignore_checks: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option"
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command."
- ),
- ]
- ]
- # TODO use skipRebuild
- skip_rebuild: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
-class RemoveVersionQuery(TypedDict):
- """remove_version query parameters."""
+ def to_json(self) -> str:
+ """Convert the GetAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use force
- force: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
- ),
- ]
- ]
- # TODO use undeploy
- undeploy: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
- ),
- ]
- ]
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class RemoveVersionsQuery(TypedDict):
- """remove_versions query parameters."""
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use force
- force: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
- ),
- ]
- ]
- # TODO use undeploy
- undeploy: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
- ),
- ]
- ]
+def _get_latest_query_alias_for(field_name: str) -> str:
+ if field_name == "include_draft":
+ return "includeDraft"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ return field_name
+
+
+class GetLatestQuery(BaseModel):
+ """Model for `get_latest` query parameters."""
+
+ include_draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_get_latest_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetLatestQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetLatestQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetLatestQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetLatestQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _get_query_alias_for(field_name: str) -> str:
+ return field_name
+
+
+class GetQuery(BaseModel):
+ """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,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the GetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the GetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a GetQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a GetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _jobs_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "type":
+ return "type"
+ if field_name == "state":
+ return "state"
+ if field_name == "function_type":
+ return "functionType"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ return field_name
+
+
+class JobsQuery(BaseModel):
+ """Model for `jobs` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ type: Annotated[
+ List[JobTypeSchema] | None, Field(description="Filter on job type")
+ ] = None
+ state: Annotated[
+ List[JobStateResult] | None, Field(description="Filter on job state")
+ ] = None
+ function_type: Annotated[
+ List[FunctionType] | None, Field(description="Filter on function type")
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created before the given timestamp or age"
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on jobs that created after the given timestamp or age"
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_jobs_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the JobsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the JobsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a JobsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a JobsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "page":
+ return "page"
+ if field_name == "deprecated":
+ return "deprecated"
+ if field_name == "draft":
+ return "draft"
+ if field_name == "version":
+ return "version"
+ if field_name == "status":
+ return "status"
+ if field_name == "runtime_version":
+ return "runtimeVersion"
+ if field_name == "created_by":
+ return "createdBy"
+ if field_name == "updated_by":
+ return "updatedBy"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ if field_name == "updated_before":
+ return "updatedBefore"
+ if field_name == "updated_after":
+ return "updatedAfter"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ if field_name == "runtime":
+ return "runtime"
+ return field_name
+
+
+class ListVersionsQuery(BaseModel):
+ """Model for `list_versions` query parameters."""
+
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ page: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The number of pages to skip when returning result to this query."
+ ),
+ ] = None
+ deprecated: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the deprecation status of the function."),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the draft status of the function."),
+ ] = None
+ version: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the version of the function (case-sensitive, supports wildcards)."
+ ),
+ ] = None
+ status: Annotated[
+ List[StatusFilter] | None,
+ Field(
+ description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
+ ),
+ ] = None
+ runtime_version: Annotated[
+ Any | None, Field(description="Filter on the runtime version.")
+ ] = None
+ created_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ updated_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created before the given timestamp or age."
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created after the given timestamp or age."
+ ),
+ ] = None
+ updated_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated before the given timestamp or age."
+ ),
+ ] = None
+ updated_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated after the given timestamp or age."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(description="Filter on the archive format of the function."),
+ ] = None
+ runtime: Annotated[
+ List[StrictStr] | None,
+ Field(description="Filter on the runtime of the function."),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _list_query_alias_for(field_name: str) -> str:
+ if field_name == "limit":
+ return "limit"
+ if field_name == "page":
+ return "page"
+ if field_name == "include_draft":
+ return "includeDraft"
+ if field_name == "include_deprecated":
+ return "includeDeprecated"
+ if field_name == "deprecated":
+ return "deprecated"
+ if field_name == "draft":
+ return "draft"
+ if field_name == "name_version":
+ return "nameVersion"
+ if field_name == "version":
+ return "version"
+ if field_name == "status":
+ return "status"
+ if field_name == "runtime_version":
+ return "runtimeVersion"
+ if field_name == "created_by":
+ return "createdBy"
+ if field_name == "updated_by":
+ return "updatedBy"
+ if field_name == "created_before":
+ return "createdBefore"
+ if field_name == "created_after":
+ return "createdAfter"
+ if field_name == "updated_before":
+ return "updatedBefore"
+ if field_name == "updated_after":
+ return "updatedAfter"
+ if field_name == "name":
+ return "name"
+ if field_name == "archive_format":
+ return "archiveFormat"
+ if field_name == "runtime":
+ return "runtime"
+ if field_name == "latest":
+ return "latest"
+ return field_name
+
+
+class ListQuery(BaseModel):
+ """Model for `list` query parameters."""
+ limit: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The maximum number of items to be return from this query. Has a deployment-defined default and maximum value."
+ ),
+ ] = None
+ page: Annotated[
+ Annotated[float, Field(strict=True, ge=0)]
+ | Annotated[int, Field(strict=True, ge=0)]
+ | None,
+ Field(
+ description="The number of pages to skip when returning result to this query."
+ ),
+ ] = None
+ include_draft: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _draft_ versions when selecting latest versions per name. By default, draft versions are only considered when no other versions are available. If set to `true`, draft versions are **included**. If set to `false`, draft versions are **excluded**."
+ ),
+ ] = None
+ include_deprecated: Annotated[
+ StrictBool | None,
+ Field(
+ description="Configures the inclusion of _deprecated_ versions when selecting latest versions per name. By default, deprecated versions are only considered when no other versions are available. If set to `true`, deprecated versions are **included**. If set to `false`, deprecated versions are **excluded**."
+ ),
+ ] = None
+ deprecated: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the deprecation status of the function."),
+ ] = None
+ draft: Annotated[
+ StrictBool | None,
+ Field(description="Filter on the draft status of the function."),
+ ] = None
+ name_version: Annotated[
+ List[Annotated[str, Field(strict=True)]] | None,
+ Field(
+ description="Filter on exact `{name}@{version}` functions. Using this filter implies a `latest=false` default, returning multiple versions of the same named versions if they are filtered."
+ ),
+ ] = None
+ version: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the version of the function (case-sensitive, supports wildcards)."
+ ),
+ ] = None
+ status: Annotated[
+ List[StatusFilter] | None,
+ Field(
+ description="Filter on the status of the plug. Filter values with a `-` postfix exclude the status. Use the `any` filter value to include all states. When not specified, a default `undeployed-` filter excludes _undeployed_ functions."
+ ),
+ ] = None
+ runtime_version: Annotated[
+ Any | None, Field(description="Filter on the runtime version.")
+ ] = None
+ created_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that create the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ updated_by: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the user that last updated the plug. You can use the `@me` token to indicate your own plugs."
+ ),
+ ] = None
+ created_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created before the given timestamp or age."
+ ),
+ ] = None
+ created_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were created after the given timestamp or age."
+ ),
+ ] = None
+ updated_before: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated before the given timestamp or age."
+ ),
+ ] = None
+ updated_after: Annotated[
+ Any | None,
+ Field(
+ description="Filter on funtions that were updated after the given timestamp or age."
+ ),
+ ] = None
+ name: Annotated[
+ StrictStr | None,
+ Field(
+ description="Filter on the name of the function. This is case-insensitive and supports wild-cards `?` (any one character) and `*` (any sequence of characters)."
+ ),
+ ] = None
+ archive_format: Annotated[
+ List[ArchiveFormat] | None,
+ Field(description="Filter on the archive format of the function."),
+ ] = None
+ runtime: Annotated[
+ List[StrictStr] | None,
+ Field(description="Filter on the runtime of the function."),
+ ] = None
+ latest: Annotated[
+ StrictBool | None,
+ Field(
+ description="When `true`, only the latest version per function name is returned. If set to `false`, multiple versions per named function can be returned. Defaults to `true`, except when specific versions are selected with the `nameVersion` filter."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_list_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the ListQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the ListQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a ListQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a ListQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _patch_metadata_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ return field_name
+
+
+class PatchMetadataQuery(BaseModel):
+ """Model for `patch_metadata` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_patch_metadata_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PatchMetadataQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PatchMetadataQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PatchMetadataQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PatchMetadataQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _publish_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "deprecate_previous":
+ return "deprecatePrevious"
+ if field_name == "var_async":
+ return "async"
+ return field_name
+
+
+class PublishQuery(BaseModel):
+ """Model for `publish` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ deprecate_previous: Annotated[
+ DeprecatePreviousPolicy | None,
+ Field(
+ description="Set the cleanup policy used to automatically deprecate/delete previous versions."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_publish_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the PublishQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the PublishQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a PublishQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a PublishQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _rebuild_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "dry_run":
+ return "dryRun"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "upgrade":
+ return "upgrade"
+ if field_name == "force_version":
+ return "forceVersion"
+ if field_name == "ignore_checks":
+ return "ignoreChecks"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ if field_name == "skip_rebuild":
+ return "skipRebuild"
+ return field_name
+
+
+class RebuildQuery(BaseModel):
+ """Model for `rebuild` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ dry_run: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true
, checks whether rebuild jobs are needed, but do not start any jobs."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ upgrade: Annotated[
+ RebuildPolicy | None,
+ Field(
+ description="If set, force a rebuild with the given runtime version selection policy. same
patch version. This should only include backward compatible upgrades. minor
major version. This might include an upgrade of e.g. the language runtime and/or provided dependencies that could break compatiblity with the function. .
"
+ ),
+ ] = None
+ force_version: Annotated[
+ Annotated[str, Field(strict=True)] | None,
+ Field(
+ description="If set, force a rebuild with the given runtime version (including downgrades). This parameter is mutually exclusive to the `upgrade` parameter."
+ ),
+ ] = None
+ ignore_checks: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set to true, checks that normally prevent a rebuild are overriden. These checks include: * function state in `pending`, `running`, `failed` or `undeployed` * backoff period due to recent failures * usage of deprecated dependencies * running jobs on entity * the `dryRun` option"
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="Indicates whether the function needs to be scaled down after successful (re-)deployment. If not set, the function is scaled to zero only if it was not active before this command."
+ ),
+ ] = None
+ skip_rebuild: Annotated[
+ StrictBool | None,
+ Field(
+ description="If set, the function will not be rebuild. Always uses the current runtime version when re-deploying/re-verifying the function."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_rebuild_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
-class UpdateAssetQuery(TypedDict):
- """update_asset query parameters."""
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RebuildQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RebuildQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RebuildQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RebuildQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _remove_version_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "force":
+ return "force"
+ if field_name == "undeploy":
+ return "undeploy"
+ return field_name
+
+
+class RemoveVersionQuery(BaseModel):
+ """Model for `remove_version` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ force: Annotated[
+ StrictBool | None,
+ Field(
+ description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
+ ),
+ ] = None
+ undeploy: Annotated[
+ StrictBool | None,
+ Field(
+ description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_remove_version_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveVersionQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RemoveVersionQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveVersionQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveVersionQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _remove_versions_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "force":
+ return "force"
+ if field_name == "undeploy":
+ return "undeploy"
+ return field_name
+
+
+class RemoveVersionsQuery(BaseModel):
+ """Model for `remove_versions` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ force: Annotated[
+ StrictBool | None,
+ Field(
+ description="If true
, the function version will be immediately undeployed and removed. Otherwise, the removal will be delayed to allow current invocations to end. During that period, the function is marked _deprecated_."
+ ),
+ ] = None
+ undeploy: Annotated[
+ StrictBool | None,
+ Field(
+ description="If `true`, the `DELETE` operation * undeploys the (openfaas) function: it becomes no longer available for invocation. * does NOT remove the function from registry: it stays in an `undeployed` status. All assets and definitions are retained, so the version can be restored later with a _rebuild_ action. If `false`, the `DELETE` operation * _only_ marks the plug function as _deprecated_, the function remains active but is removed from the default listings. This also applies to _draft_ versions. This parameter is incompatible with `force=true`. If not set the default behaviour applies: * _draft_ versions are _undeployed_ and _removed_ from registry. * non-_draft_ versions are marked _deprecated_ only."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_remove_versions_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the RemoveVersionsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the RemoveVersionsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a RemoveVersionsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a RemoveVersionsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _update_asset_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class UpdateAssetQuery(BaseModel):
+ """Model for `update_asset` query parameters."""
- # TODO use chown
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_update_asset_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateAssetQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the UpdateAssetQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateAssetQuery instance from a dict."""
+ return cls.model_validate(obj)
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateAssetQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
-class UpdateAssetsQuery(TypedDict):
- """update_assets query parameters."""
- # TODO use chown
+def _update_assets_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "chown":
+ return "chown"
+ return field_name
+
+
+class UpdateAssetsQuery(BaseModel):
+ """Model for `update_assets` query parameters."""
+
chown: Annotated[
StrictBool,
Field(
description="If set, ownership of the draft function is transferred to the current user."
),
]
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_update_assets_query_alias_for,
+ populate_by_name=True,
+ )
-class VerifyQuery(TypedDict):
- """verify query parameters."""
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
- # TODO use comment
- comment: NotRequired[
- Annotated[
- Optional[StrictStr],
- Field(
- description="An optional user-specified comment corresponding to the operation."
- ),
- ]
- ]
- # TODO use async
- var_async: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
- ),
- ]
- ]
- # TODO use scaleToZero
- scale_to_zero: NotRequired[
- Annotated[
- Optional[StrictBool],
- Field(
- description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command."
- ),
- ]
- ]
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the UpdateAssetsQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the UpdateAssetsQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a UpdateAssetsQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a UpdateAssetsQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)
+
+
+def _verify_query_alias_for(field_name: str) -> str:
+ if field_name == "comment":
+ return "comment"
+ if field_name == "var_async":
+ return "async"
+ if field_name == "scale_to_zero":
+ return "scaleToZero"
+ return field_name
+
+
+class VerifyQuery(BaseModel):
+ """Model for `verify` query parameters."""
+
+ comment: Annotated[
+ StrictStr | None,
+ Field(
+ description="An optional user-specified comment corresponding to the operation."
+ ),
+ ] = None
+ var_async: Annotated[
+ StrictBool | None,
+ Field(
+ description="Unless this is set to false
, the server will start the required job actions asynchronously and return a 202
Accepted response. If false
the request will block until the job actions are completed, or a timeout occurs."
+ ),
+ ] = None
+ scale_to_zero: Annotated[
+ StrictBool | None,
+ Field(
+ description="Indicates whether the function needs to be scaled down after successful verification. If not set, the function is scaled to zero only if it was not active before this command."
+ ),
+ ] = None
+
+ model_config = ConfigDict(
+ validate_assignment=True,
+ protected_namespaces=(),
+ extra="allow",
+ alias_generator=_verify_query_alias_for,
+ populate_by_name=True,
+ )
+
+ @model_serializer(mode="wrap")
+ def serializer(
+ self, handler: Callable, info: SerializationInfo
+ ) -> Dict[StrictStr, Any]:
+ """The default serializer of the model.
+
+ * Excludes `None` fields that were not set at model initialization.
+ """
+ model_dict = handler(self, info)
+ return {
+ k: v
+ for k, v in model_dict.items()
+ if v is not None or k in self.model_fields_set
+ }
+
+ def to_dict(self) -> dict[str, Any]:
+ """Convert the VerifyQuery instance to dict."""
+ return self.model_dump(by_alias=True, exclude_unset=True, exclude_none=True)
+
+ def to_json(self) -> str:
+ """Convert the VerifyQuery instance to a JSON-encoded string."""
+ return self.model_dump_json(
+ by_alias=True, exclude_unset=True, exclude_none=True
+ )
+
+ @classmethod
+ def from_dict(cls, obj: dict) -> Self:
+ """Create a VerifyQuery instance from a dict."""
+ return cls.model_validate(obj)
+
+ @classmethod
+ def from_json(cls, json_data: str | bytes | bytearray) -> Self:
+ """Create a VerifyQuery instance from a JSON-encoded string."""
+ return cls.model_validate_json(json_data)