From 8ba6877adacf66be9bac9d6f5cfb7a784f9a3088 Mon Sep 17 00:00:00 2001 From: Oki Husso Date: Tue, 21 Apr 2026 16:04:26 +0300 Subject: [PATCH] fix: allow null latest_released_version for unreleased custom connectors The Workato API returns `null` for `latest_released_version` when a custom connector has no released versions yet (draft-only). The generated `CustomConnector` pydantic model declared this field as a non-nullable `StrictInt`, so any response containing such a connector would fail with a pydantic `ValidationError` and abort the entire list parse. This broke two commands for any workspace containing at least one draft-only custom connector: - `workato connectors list --custom` - `workato recipes validate` (calls `list_custom_connectors` to build its adapter whitelist before inspecting the recipe) Mark `latest_released_version` as `nullable: true` in the OpenAPI spec and regenerate the affected files via `make generate-client`. --- .../client/workato_api/docs/CustomConnector.md | 2 +- .../client/workato_api/models/custom_connector.py | 9 +++++++-- workato-api-spec.yaml | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/workato_platform_cli/client/workato_api/docs/CustomConnector.md b/src/workato_platform_cli/client/workato_api/docs/CustomConnector.md index e1d2047..e8b6cb2 100644 --- a/src/workato_platform_cli/client/workato_api/docs/CustomConnector.md +++ b/src/workato_platform_cli/client/workato_api/docs/CustomConnector.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **id** | **int** | | **name** | **str** | | **title** | **str** | | -**latest_released_version** | **int** | | +**latest_released_version** | **int** | Null when the connector has no released versions yet. | **latest_released_version_note** | **str** | | **released_versions** | [**List[ConnectorVersion]**](ConnectorVersion.md) | | **static_webhook_url** | **str** | | diff --git a/src/workato_platform_cli/client/workato_api/models/custom_connector.py b/src/workato_platform_cli/client/workato_api/models/custom_connector.py index bf056e3..2e40ae4 100644 --- a/src/workato_platform_cli/client/workato_api/models/custom_connector.py +++ b/src/workato_platform_cli/client/workato_api/models/custom_connector.py @@ -17,7 +17,7 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from workato_platform_cli.client.workato_api.models.connector_version import ConnectorVersion from typing import Optional, Set @@ -30,7 +30,7 @@ class CustomConnector(BaseModel): id: StrictInt name: StrictStr title: StrictStr - latest_released_version: StrictInt + latest_released_version: Optional[StrictInt] = Field(description="Null when the connector has no released versions yet.") latest_released_version_note: Optional[StrictStr] released_versions: List[ConnectorVersion] static_webhook_url: Optional[StrictStr] @@ -82,6 +82,11 @@ def to_dict(self) -> Dict[str, Any]: if _item_released_versions: _items.append(_item_released_versions.to_dict()) _dict['released_versions'] = _items + # set to None if latest_released_version (nullable) is None + # and model_fields_set contains the field + if self.latest_released_version is None and "latest_released_version" in self.model_fields_set: + _dict['latest_released_version'] = None + # set to None if latest_released_version_note (nullable) is None # and model_fields_set contains the field if self.latest_released_version_note is None and "latest_released_version_note" in self.model_fields_set: diff --git a/workato-api-spec.yaml b/workato-api-spec.yaml index c909859..e3cc06d 100644 --- a/workato-api-spec.yaml +++ b/workato-api-spec.yaml @@ -2532,6 +2532,8 @@ components: example: "Apps by Workato" latest_released_version: type: integer + nullable: true + description: "Null when the connector has no released versions yet." example: 2 latest_released_version_note: type: string