Skip to content

fix(validator): change format_version type from str to int#75

Merged
cmworkato merged 4 commits intomainfrom
fix/validation-errors
Mar 26, 2026
Merged

fix(validator): change format_version type from str to int#75
cmworkato merged 4 commits intomainfrom
fix/validation-errors

Conversation

@cmworkato
Copy link
Copy Markdown
Contributor

@cmworkato cmworkato commented Mar 25, 2026

Summary

This PR fixes several validation bugs discovered during CLI testing.

Fixes

1. RecipeValidator format_version type mismatch

The Workato export package API returns format_version as an integer (2), not a string. This caused false validation errors for all exported recipes.

Error:
❌ Recipe validation failed Message: Recipe parsing failed: format_version should be string not int Type: syntax_invalid

Root Cause: The RecipeLine Pydantic model defined format_version as str | None, but the API returns an integer.

Fix: Changed the type from str | None to int | None to match the actual API response.

2. api-collections list ValidationError

The API returns project_id as an integer or null, but the model expected a string.

Error:
ValidationError: 1 validation error for ApiCollection project_id: Input should be a valid string

Fix: Made project_id optional and added a validator to coerce int to string.

3. api-clients list ValidationError

The API can return null for api_policies and api_collections, but the model required non-null lists.

Error:
ValidationError: 1 validation error for ApiClient api_policies: Input should be a valid list

Fix: Made api_policies and api_collections optional with default=None.

4. connections pick-lists command path error

The path to picklist-data.json was incorrect (cli/data instead of cli/resources/data).

Error:
Picklist data not found. Run 'python scripts/parse_picklist_docs.py' to generate it.

Fix: Corrected the path to cli/resources/data.

Testing

  • Added unit test test_recipe_line_accepts_format_version_as_int
  • Updated test_helpers.py to use correct data path
  • Verified against 17 recipes exported from Workato - all now validate without errors
  • All existing tests pass

- ApiCollection.project_id: Make optional and coerce int to string (API returns int or null)
- ApiClient.api_policies/api_collections: Make optional (API can return null)
- Change path from cli/data to cli/resources/data
- Update test_helpers.py to match new path
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 25, 2026

Coverage

Coverage Report
FileStmtsMissCoverMissing
__init__.py68494%10–11, 69–70
cli
   __init__.py52394%49, 51, 60
   containers.py270100% 
cli/commands
   __init__.py00100% 
   api_clients.py292996%27, 302, 448–449, 483, 493, 585, 616, 624
   api_collections.py257398%28, 183, 347
   assets.py47295%57–58
   connections.py526599%596, 598, 604, 642, 995
   data_tables.py165596%31, 253, 267, 321–322
   guide.py166199%106
   init.py1080100% 
   profiles.py3512892%353, 370, 372–373, 376, 378, 381–384, 386–387, 389, 460–461, 541–542, 544–545, 547–548, 552, 556–557, 567–569, 622
   properties.py97198%21
   pull.py172298%193–194
   workspace.py39294%61, 71
cli/commands/connectors
   __init__.py00100% 
   command.py103298%131, 180
   connector_manager.py203498%176, 292, 300–301
cli/commands/projects
   __init__.py00100% 
   command.py2721096%359–362, 373, 439–441, 491, 495
   project_manager.py166795%48, 66, 263–264, 276, 317, 325
cli/commands/push
   __init__.py00100% 
   command.py133496%109, 112, 230, 308
cli/commands/recipes
   __init__.py00100% 
   command.py427997%117, 133–134, 272–275, 403, 709
   validator.py7062097%174, 883, 1136, 1223, 1246, 1279, 1281–1282, 1359–1361, 1457–1458, 1517–1518, 1707–1708, 1736–1738
cli/utils
   __init__.py40100% 
   exception_handler.py3453390%134–135, 140–141, 143–144, 174–175, 181, 184–185, 270, 300, 333–337, 371, 398, 425, 482, 517, 576, 578–579, 584–585, 587–591
   gitignore.py140100% 
   ignore_patterns.py230100% 
   spinner.py430100% 
   token_input.py451762%70, 98, 100, 102–104, 107, 124, 127–128, 132–133, 136, 139–140, 142, 144
   version_checker.py135695%24, 26, 33–34, 72, 102
cli/utils/config
   __init__.py50100% 
   manager.py5373393%130, 141, 152, 160–162, 165, 168, 180, 230–231, 404, 422, 426, 429–432, 448, 469, 483, 496, 538, 640–641, 680, 894, 1037–1038, 1052–1053, 1109, 1168
   models.py330100% 
   profiles.py3341595%99, 195–196, 199, 234–236, 261–263, 522, 530, 541–542, 546
   workspace.py680100% 
TOTAL596322596% 

@cmworkato cmworkato requested a review from oalami March 25, 2026 21:39
@github-actions
Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

The Workato export package API returns format_version as an integer (2),
not a string. This caused false validation errors for all exported recipes.

Fixes recipe validation error:
  'format_version should be string not int'
@cmworkato cmworkato force-pushed the fix/validation-errors branch from 5905741 to 71bf03a Compare March 25, 2026 21:45
@github-actions
Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

oalami
oalami previously approved these changes Mar 26, 2026
@oalami
Copy link
Copy Markdown
Contributor

oalami commented Mar 26, 2026

@cmworkato linter is throwing an error

@github-actions
Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@cmworkato cmworkato merged commit 1cede7a into main Mar 26, 2026
10 checks passed
@cmworkato cmworkato deleted the fix/validation-errors branch March 26, 2026 21:14
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.

3 participants