GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Bad code generation · Issue #1318 · openapi-generators/openapi-python-client

Bad code generation #1318

New issue
Copy link
New issue
Copy link
Closed
Closed
Bad code generation#1318
Copy link

Description

@syrn0n
syrn0n
opened on Sep 7, 2025
Issue body actions

Bug Report: Missing Closing Parenthesis in Generated Multipart Form Data Code

Summary

The openapi-python-client generator produces invalid Python syntax when generating multipart form data handling code, specifically missing closing parentheses in files.append() calls within the to_multipart() method.

Environment

  • openapi-python-client version: 0.25.2
  • Python version: 3.x
  • Operating System: macOS 24.6.0

OpenAPI Specification

  • URL: https://raw.githubusercontent.com/immich-app/immich/refs/heads/main/open-api/immich-openapi-specs.json
  • Affected Model: AssetMediaCreateDto

Bug Description

When generating code for the AssetMediaCreateDto model, the generator produces malformed Python code in the to_multipart() method. Specifically, line 180 in the generated file is missing a closing parenthesis:

Generated (incorrect) code:

files.append(("livePhotoVideoId", (None, str(self.live_photo_video_id), "text/plain"))

Expected (correct) code:

files.append(("livePhotoVideoId", (None, str(self.live_photo_video_id), "text/plain")))

Error Details

The missing parenthesis causes a cascade of syntax errors:

SyntaxError: Expected 'else', found ':'
SyntaxError: Unparenthesized generator expression cannot be used here
SyntaxError: Expected ',', found ':'
SyntaxError: Expected ')', found newline

Steps to Reproduce

  1. Run: openapi-python-client generate --overwrite --url https://raw.githubusercontent.com/immich-app/immich/refs/heads/main/open-api/immich-openapi-specs.json
  2. Check the generated file: immich_client/models/asset_media_create_dto.py
  3. Look at line 180 in the to_multipart() method

Expected Behavior

The generator should produce valid Python syntax with properly closed parentheses.

Actual Behavior

The generator produces invalid Python syntax with missing closing parentheses, causing the generated code to fail linting and runtime checks.

Impact

  • Generated code cannot be used without manual fixes
  • Breaks automated CI/CD pipelines that rely on generated code
  • Requires manual intervention after each code generation

Workaround

Currently, the issue must be manually fixed by adding the missing closing parenthesis to the affected line.

Additional Information

This appears to be a template rendering issue in the multipart form data generation logic. The bug is reproducible and occurs consistently in the same location.

Reacted by Nico

Activity

  1. nicotsx commented on Sep 26, 2025

    @nicotsx
    nicotsx
    on Sep 26, 2025
    More actions

    Experiencing the same. Going back to 0.24.3 resolves the issue

    Reacted by Antony Male
  2. github-merge-queue
    added a commit that references this issue on Dec 3, 2025

    Fix bad code generation (#1360)

    f5f3b41
  3. dbanty commented on Dec 3, 2025

    @dbanty
    dbanty
    on Dec 3, 2025
    Collaborator
    More actions

    Fixed by #1360

  4. dbanty
    closed this as completedon Dec 3, 2025
  5. github-merge-queue
    added a commit that references this issue on Dec 3, 2025

    Release 0.28.0 (#1368)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.