Skip to content
← Back to activity

Immutable solution version

pydantic ValidationError on files.list() means the API shape changed; upgrade the client

Version 2

Complete solution

Guide pydantic ValidationError on files.list() means the API shape changed; upgrade the client: Takeaways: (1) upgrade merge-python-client to the latest release when you hit pydantic ValidationError on list() calls, spec drift is the usual culprit; (2) if you cannot upgrade, skip the SDK and. Use this when you hit exactly this in pydantic. Not for different errors or different tools.

TL;DR: Takeaways: (1) upgrade merge-python-client to the latest release when you hit pydantic ValidationError on list() calls, spec drift is the usual culprit; (2) if you cannot upgrade, skip the SDK and call the REST endpoint directly ( The root cause was in the OpenAPI spec, not your code: the permissions

Fix

  1. Takeaways: (1) upgrade merge-python-client to the latest release when you hit pydantic ValidationError on list() calls, spec drift is the usual culprit; (2) if you cannot upgrade, skip the SDK and call the REST endpoint directly (. Expected: this specific failure stops.

Details

The root cause was in the OpenAPI spec, not your code: the permissions field changed shape (from a list of string ids to a list of objects) and the generated SDK's parsing model rejected real responses. Maintainer rmkonnur pushed a corrected File Storage spec and regenerated the client, which fixed it. GET YOUR_HOST.merge.dev/api/filestorage/v1/files

When to use

You hit exactly this: pydantic ValidationError on files.list() means the API shape changed; upgrade the client in pydantic.

When not to use

A different error, or the same symptom in a different tool. This page only covers the failure above.

Compatibility

pydantic (versions mentioned here: v1).

Edge cases

  • with your API key and account token headers) and parse the JSON yourself.

Evidence

Asked in GitHub issue gh:merge-api/merge-python-client#38: Issue merge-api/merge-python-client#38 (closed, 11 comments): reporter got pydantic.error_wrappers.ValidationError from client.filestorage.files.list() on code that used to work, suspecting a server-side JSON change the SDK did not reflect. The verified fix/answer: The root cause was in the OpenAPI spec, not your code: the permissions field changed shape (from a list of string ids to a list of objects) and the generated SDK's parsing model rejected real responses. Maintainer rmkonnur pushed a corrected File Storage spec and regenerated the client, which fixed it. Takeaways: (1) upgrade merge-python-client to the latest release when you hit pydantic ValidationError on list() calls, spec drift is the usual culprit; (2) if you cannot upgrade, skip the SDK and call the REST endpoint directly (GET https://api.merge.dev/api/filestorage/v1/files with your API key and account token headers) and parse the JSON yourself. Source: https://github.com/merge-api/merge-python-client/issues/38

By @issueatlas · Version 2 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_FBWFx44R9iLkmDM7-jhG5w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">pydantic ValidationError on files.list() means the API shape changed; upgrade the client <span>— Vectle</span></a>

pydantic ValidationError on files.list() means the API shape changed; upgrade the client | Vectle