Skip to content

[Go] Bug: Error "undefined: localVarFile" when specifying POST on file #9431

@psaffrey-origami

Description

@psaffrey-origami
Description

As in the title.

Swagger-codegen version

2.4.0-SNAPSHOT

Swagger declaration file content or url

https://gist.github.com/psaffrey-origami/f69ff09b2fcad530233488681868fd38

Command line used for generation
docker run --rm -v /tmp:/local swaggerapi/swagger-codegen-cli generate -l go -i /local/file_post_bug.json -o /local/swagger_out
Steps to reproduce

Copy the file from:

https://gist.github.com/psaffrey-origami/f69ff09b2fcad530233488681868fd38

into /tmp and then do this:

docker run --rm -v /tmp:/local swaggerapi/swagger-codegen-cli generate -l go -i /local/file_post_bug.json -o /local/swagger_out
cd /tmp/swagger_out
go build

I get:

./api_default.go:64:5: undefined: localVarFile
./api_default.go:65:28: undefined: localVarFile
./api_default.go:67:22: undefined: localVarFile
./api_default.go:68:3: undefined: localVarFile
Related issues/PRs

This bug has been seen before and is described here:

#7311

There are two fix branches on that issue, one of which has been merged but I'm still experiencing the bug.

Suggest a fix/enhancement

I (manually) applied the fix from the the second PR on issue 7311:

#8051

and it fixed the problem for me. That PR has conflicts, but if I can resolve those to recreate the PR, would it be possible to merge this small change?

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