Skip to content

fix(resources): preserve multipart file uploads in generated client (HYBIM-882)#104

Open
etserend wants to merge 2 commits into
mainfrom
feat/HYBIM-882-port-02ce8bb
Open

fix(resources): preserve multipart file uploads in generated client (HYBIM-882)#104
etserend wants to merge 2 commits into
mainfrom
feat/HYBIM-882-port-02ce8bb

Conversation

@etserend

Copy link
Copy Markdown
Contributor

Summary

Port of upstream commit 02ce8bbfix: Preserve multipart file uploads in generated client (#624).

  • openapi.yaml: Replace contentMediaType: application/octet-streamformat: binary for 7 Body_* multipart file fields, enabling openapi-python-client to generate File-typed attributes instead of plain str
  • scripts/import-openapi-yaml.sh: Add yq patches for the 7 binary fields so the fix survives future openapi.yaml regenerations; tighten error handling ($? -ne 0)
  • 6 generated Body_* models: file: strfile: File; add BytesIO/File/FileTypes imports; call .to_tuple() in to_dict/to_multipart; construct File(payload=BytesIO(...)) in from_dict
  • tests/test_datasets.py: 2 new tests verifying File payloads round-trip through to_multipart() correctly

Test plan

  • poetry run pytest tests/test_datasets.py -v — 61 passed
  • New tests: test_create_dataset_body_serializes_file_as_multipart_upload, test_code_scorer_bodies_serialize_files_as_multipart_uploads
  • Trigger regenerate-api-client workflow after merge to produce clean generated output

etserend added 2 commits July 20, 2026 17:52
…02ce8bb)

Port of rungalileo/galileo-python@02ce8bb2 — fix: Preserve multipart file
uploads in generated client (#624).

- openapi.yaml: replace contentMediaType: application/octet-stream with
  format: binary for 7 Body_* multipart file fields so openapi-python-client
  generates File-typed attributes instead of plain str
- scripts/import-openapi-yaml.sh: add yq patches for the 7 binary fields so
  the fix survives future openapi.yaml regenerations; tighten error handling
- 6 generated Body_* models: update file fields from str → File, add BytesIO
  import, add File/FileTypes imports, call .to_tuple() in to_dict/to_multipart,
  construct File(payload=BytesIO(...)) in from_dict
- tests/test_datasets.py: add two tests verifying File payloads round-trip
  through to_multipart() correctly
…ation block

Two gaps vs upstream 02ce8bb:
- ListAnnotationQueueParams.properties.sort.default patch was missing (added in
  e34a5b1 / PR#103 but not carried forward to this branch)
- Post-patch verification block (yq -e with 14 assertions) was absent
- Error message corrected: "Failed to fetch..." -> "Failed to patch..."
@etserend
etserend marked this pull request as ready for review July 21, 2026 16:49
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.

1 participant