oazapfts generates string instead of Blob for file upload fields when FastAPI >=0.129.1 emits OpenAPI 3.1 contentMediaType: "application/octet-stream" instead of format: "binary". The codegen only checks schema.format == "binary" (getTypeFromSchema.ts:213) and has no handler for contentMediaType. This also affects Swagger UI 5.x which won't render file pickers for the 3.1 style. The root cause is FastAPI PR #14953 switching UploadFile schema representation for OpenAPI 3.1 compliance, combined with oazapfts (and Swagger UI) not supporting the newer spec form.
Post-process the OpenAPI schema before feeding it to oazapfts: walk all properties and convert {"type": "string", "contentMediaType": "application/octet-stream"} back to {"type": "string", "format": "binary"}. This is the same workaround recommended in the FastAPI discussion (fastapi/fastapi#14975). Apply it after schema generation but before saving/codegen. Example Python:
def _fixup_content_media_type(schema: dict) -> dict:
def _walk(obj):
if isinstance(obj, dict):
if (obj.get('type') == 'string'
and obj.get('contentMediaType') == 'application/octet-stream'):
del obj['contentMediaType']
obj['format'] = 'binary'
for v in obj.values():
_walk(v)
elif isinstance(obj, list):
for v in obj:
_walk(v)
_walk(schema)
return schemaThe proper fix is for oazapfts to add a contentMediaType check alongside the existing format == "binary" check in getTypeFromSchema.ts:213. An upstream PR to oazapfts would resolve this for all users.