Skip to content

fix: allow null latest_released_version for unreleased custom connectors#80

Open
okihus wants to merge 1 commit into
workato-devs:mainfrom
okihus:fix/custom-connector-optional-released-version
Open

fix: allow null latest_released_version for unreleased custom connectors#80
okihus wants to merge 1 commit into
workato-devs:mainfrom
okihus:fix/custom-connector-optional-released-version

Conversation

@okihus
Copy link
Copy Markdown

@okihus okihus commented Apr 21, 2026

Summary

CustomConnector.latest_released_version is declared as non-nullable StrictInt in the OpenAPI spec and generated pydantic model, but the Workato API legitimately returns null for this field on custom connectors that have no released versions yet (draft-only).

Because pydantic validates the full list response, any single unreleased connector in a workspace breaks every CLI command that enumerates custom connectors:

  • workato connectors list --custom
  • workato recipes validateRecipeValidator.validate_recipe calls list_custom_connectors() at recipes/validator.py:605 to build its adapter whitelist before inspecting the recipe.

Reproduction

  1. Create a custom connector in the workspace; save a version; never click "Release".
  2. Run either command above. Output:
❌ ValidationError
   1 validation error for CustomConnector
latest_released_version
  Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType]

Fix

  • Mark latest_released_version as nullable: true in workato-api-spec.yaml.
  • Regenerate the client via make generate-client.

The regenerated model becomes:

latest_released_version: Optional[StrictInt] = Field(
    description="Null when the connector has no released versions yet."
)

Test plan

  • uv run pytest tests/unit/ — all passing
  • uv run ruff check src/ tests/ — clean
  • uv run ruff format --check src/ tests/ — clean
  • Reproduced on affected workspace; after patch, both connectors list --custom and recipes validate succeed.

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`.
Copilot AI review requested due to automatic review settings April 21, 2026 13:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the Workato Platform CLI’s OpenAPI spec and regenerated client to correctly handle CustomConnector.latest_released_version being null for draft-only (unreleased) custom connectors, preventing pydantic validation failures when listing/validating recipes.

Changes:

  • Mark CustomConnector.latest_released_version as nullable: true in the OpenAPI spec and add a clarifying description.
  • Regenerate the pydantic model so latest_released_version accepts None and serializes it correctly when explicitly set.
  • Update generated model documentation to reflect the new field description.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
workato-api-spec.yaml Makes latest_released_version nullable and documents the null semantics for unreleased connectors.
src/workato_platform_cli/client/workato_api/models/custom_connector.py Regenerates the model to accept Optional[StrictInt] and preserve explicit null in to_dict().
src/workato_platform_cli/client/workato_api/docs/CustomConnector.md Updates generated docs with the new field description.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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
Copy link

Copilot AI Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional is imported twice (from typing import ... Optional and from typing import Optional, Set). This is redundant and can be consolidated into a single typing import to keep generated code clean and avoid potential lint churn if rules change.

Suggested change
from typing import Optional, Set
from typing import Set

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The duplicate Optional import is pre-existing on main (a quirk of the python-asyncio generator template), not introduced by this PR — verified with git show main:src/workato_platform_cli/client/workato_api/models/custom_connector.py. Editing it here would diverge from make generate-client output, so the next regen would undo the fix.

Happy to file a separate issue for the generator config cleanup if useful — feels out of scope for this one-field-nullability fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants