Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Multipart Formdata bodies are ignored #191

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

arkraft
Copy link
Contributor

@arkraft arkraft commented Mar 13, 2024

Hi,

switching from 0.16.8 to 0.16.9 the generated client ignores file uploads. We have this request in swagger:

"requestBody": {
    "required": true,
    "content": {
        "multipart/form-data": {
            "schema": {
                "type": "object",
                "properties": {
                    "file": {
                        "type": "string",
                        "format": "binary"
                    }
                }
            }
        }
    }
}

which worked fine and generated the upload code:
image

Since 0.16.9 it is broken and generated nothing in this place. This breaks the file uploads for us.

We identified the change which broke the generation. It seems that the if statement is to harsh and in our case it will be skipped. We made a PR to revert this if statement change, bur we are open for other solutions.

v0.16.8...v0.16.9

@Manweill
Copy link
Owner

@arkraft I'm really sorry for not conducting rigorous testing. Can you verify that in v0.16.11 version? I seem to have fixed this problem in v0.16.11

@arkraft
Copy link
Contributor Author

arkraft commented Mar 14, 2024

Hi @Manweill. No worries, that can happen.

We found the problem in v0.16.11 and went back the versions until the version where it did not happen.

We believe the if statement already blocks because in our case, bodyParameter is an empty string. So maybe the problem lies somewhere else, where the bodyParameter is parsed. Right now version 0.16.8 is working for us and also the fix generates the correct client.

@Manweill
Copy link
Owner

嗨 .不用担心,这可能会发生。

我们在 v0.16.11 中发现了问题,并返回了版本,直到没有发生问题的版本。

我们相信 if 语句已经阻塞,因为在我们的例子中,是一个空字符串。所以也许问题出在其他地方,bodyParameter 被解析的地方。现在版本 0.16.8 正在为我们工作,并且修复程序也会生成正确的客户端。bodyParameter

OK,rebase it and push agian

@arkraft
Copy link
Contributor Author

arkraft commented Mar 15, 2024

The branch is already up to date, or am I missing something?

@arkraft ➜ /workspaces/swagger-axios-codegen (fix/multipart-form-data) $ git rebase 'upstream/main'
Current branch fix/multipart-form-data is up to date.

@Manweill Manweill merged commit 6956938 into Manweill:main Mar 15, 2024
1 check passed
@Manweill
Copy link
Owner

The branch is already up to date, or am I missing something?

@arkraft ➜ /workspaces/swagger-axios-codegen (fix/multipart-form-data) $ git rebase 'upstream/main'
Current branch fix/multipart-form-data is up to date.

fix in 0.16.13

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.

2 participants