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

File parameter generated incorrectly in client code #1020

Closed
ligustah opened this issue Apr 24, 2017 · 0 comments · Fixed by #1977
Closed

File parameter generated incorrectly in client code #1020

ligustah opened this issue Apr 24, 2017 · 0 comments · Fixed by #1977

Comments

@ligustah
Copy link

Problem statement

The params struct generated for the client of the below spec looks like this:

type TestParams struct {

	/*File
	  The file to upload

	*/
	File os.File

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

I think this is wrong. The correct type would be *os.File, but even that is somewhat limiting. I think it should be an interface like it is in the code generated for the server.

Swagger specification

---
swagger: "2.0"
info:
  description: test
  title: test
  version: "0.0.0"
consumes:
  - multipart/form-data
produces:
  - application/json
paths:
  /upload:
    post:
      operationId: test
      consumes:
        - multipart/form-data
      produces:
        - application/json
      parameters:
        - name: file
          description: The file to upload
          in: formData
          required: true
          type: file
      responses:
        200:
          description: Successful upload
          schema:
            type: string

Environment

version: 0.10.0
commit: 4d1e79b
OS: Windows 7

@fredbi fredbi added generate client needs testing Needs more testing for issue confirmation/qualification labels May 14, 2018
fredbi added a commit to fredbi/go-swagger that referenced this issue Jun 20, 2019
fixes go-swagger#1020

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
@fredbi fredbi added pending PR and removed needs testing Needs more testing for issue confirmation/qualification labels Jun 20, 2019
casualjim pushed a commit that referenced this issue Jun 22, 2019
fixes #1020

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
djgilcrease pushed a commit to djgilcrease/go-swagger that referenced this issue Jun 25, 2019
fixes go-swagger#1020

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
djgilcrease pushed a commit to djgilcrease/go-swagger that referenced this issue Jun 26, 2019
fixes go-swagger#1020

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>
fredbi pushed a commit that referenced this issue Jun 27, 2019
* do not force set the api logger to log.Printf

the logger already defaults so do not force set it in `SetAPI` since that would overwrite one I set in the API before calling `SetAPI`

Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Add CodeTriage badge to go-swagger/go-swagger

Adds a badge showing the number of people helping this repo on CodeTriage.

[![Open Source Helpers](https://www.codetriage.com/go-swagger/go-swagger/badges/users.svg)](https://www.codetriage.com/go-swagger/go-swagger)

## What is CodeTriage?

CodeTriage is an Open Source app that is designed to make contributing to Open Source projects easier. It works by sending subscribers a few open issues in their inbox. If subscribers get busy, there is an algorithm that backs off issue load so they do not get overwhelmed

[Read more about the CodeTriage project](https://www.codetriage.com/what).

## Why am I getting this PR?

Your project was picked by the human, @schneems. They selected it from the projects submitted to https://www.codetriage.com and hand edited the PR. How did your project get added to [CodeTriage](https://www.codetriage.com/what)? Roughly over 3 years ago, [tamarabartlett](https://github.com/tamarabartlett) added this project to CodeTriage in order to start contributing. Since then, 13 people have subscribed to help this repo.

## What does adding a badge accomplish?

Adding a badge invites people to help contribute to your project. It also lets developers know that others are invested in the longterm success and maintainability of the project.

You can see an example of a CodeTriage badge on these popular OSS READMEs:

- [![Email clients like GMAIL do not render SVG images](https://www.codetriage.com/rails/rails/badges/users.svg)](https://www.codetriage.com/rails/rails) https://github.com/rails/rails
- [![Email clients like GMAIL do not render SVG images](https://www.codetriage.com/crystal-lang/crystal/badges/users.svg)](https://www.codetriage.com/crystal-lang/crystal) https://github.com/crystal-lang/crystal

## Have a question or comment?

While I am a bot, this PR was manually reviewed and monitored by a human - @schneems. My job is writing commit messages and handling PR logistics.

If you have any questions, you can reply back to this PR and they will be answered by @schneems. If you do not want a badge right now, no worries, close the PR, you will not hear from me again.

Thanks for making your project Open Source! Any feedback is greatly appreciated.

Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Fix basic auth for stratoscale template

Use the correct signature for the basic authentication interface.
This caused the compilation to fail. Fixes #1765

Signed-off-by: Joakim Soderberg <joakim.soderberg@gmail.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Multiple tags operations: deduce package from first tag

as for only-one-tag operations, instead of default "operations" as when no
tags are available.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* keep spec order on nested objects

Signed-off-by: kofler <efi.kofler@flir.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* chore(ci): set codecov patch expectation to a fixed level, exclude bindata.go from coverage

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* chore(ack): acknowledges fix for #1490 (client w/ body as interface{})

fixes #1490

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* chore(ack): acknowledges fix for #973 (client w/ param UUID)

* fixes #973

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* 151 add a diff sub command (#1961)

* x-go-type: if no imports are specified, assume that the referred type is inside the same package

Signed-off-by: Emil Nikolov <emil.e.nikolov@gmail.com>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* support keep spec properties order

Signed-off-by: Efi-Kofler <efi.kofler@tectonic.network>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added diff sub command

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Refactored location node code. Detected reponse and param header changes

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated test fixtures

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Removed redundant method and fixed default/required on response headers

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* urlbuilder template fixed to support query params named 'append' (#1949)

fixes #1948

Update urlbuilder_test.go to support added query name mangling.

Update bindata.go

Signed-off-by: Jim Turnquist <jim@boonlogic.com>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Refactored type names and removed some dead code

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Refactored analyser and diff code in prep for ignore processing

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added ability to igore selected diffs

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added ability to ignore deprecated operations

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added docs

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Fixed typo compatabilty -> compatibilty

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Fixed typo and scopelint issue

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* scan: proper parse for numeric elements (future validation pass).

Signed-off-by: Dzmitry.Harupa <dzmitry.harupa@1pt.com>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* fix test

Signed-off-by: Dzmitry.Harupa <dzmitry.harupa@1pt.com>

fix building

Signed-off-by: Dzmitry.Harupa <dzmitry.harupa@1pt.com>

review: goconst

Signed-off-by: d7561985 <d7561985@gmail.com>

update

Signed-off-by: d7561985 <d7561985@gmail.com>

test fix

Signed-off-by: d7561985 <d7561985@gmail.com>

test fix

Signed-off-by: d7561985 <d7561985@gmail.com>

add const for linter

Signed-off-by: d7561985 <d7561985@gmail.com>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added gocrest in various spots

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updating vendor folder and adding coverage.txt to gitignore

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Lower-cased error - lint warning

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated go.mod

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added files nuked by rogue gitignore

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added files lost due to bad gitignore

Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated readme

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated README

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>
Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Adding lost code and new tests

Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated ignore diff test

Signed-off-by: Jason Wraxall <>
Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Circle CI closed some issues

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated lint settings as recommended by reviewer

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Updated capitalisation of global

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* ran go gmt as asked

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* fixed loop scope issue

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* fixed more formatting

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* fixed yet more formatting

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* ran goimports

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* nuked spurious warning from dupl

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Removed dead code and added an array diff test

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Resolved code suggestion

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Cleaning code

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* moved test code into diff package to improve coverage report

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* fixed lint suggestion

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Added kitchensink to diff fictures to improve coverage and fixed the bugs the new test cases detected ;-)

Signed-off-by: Jason Wraxall <wjase@yahoo.com.au>

* Improving formatting and coverage at the same time

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>

* Fixed cicd issues

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>

* Added test for map diff

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>

* Removed dead code

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>

* Added empty arg error test

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>

* Added test cases to get above 80% coverage

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>

* Added extra test permutations to boost coverage

Signed-off-by: Jason Wraxall <jwraxall@tyro.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* chore(ack): acknowledges fix for #1020 (client w/ param File)

fixes #1020

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Acknowlegde #1339 was fixed (generated client w/ binary param)

Fixes #1339

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* fixes #1878 (conflicting output options in CLI)

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* doc: updated CLI usage, including the newly added diff command

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Added support for non-standard http codes (#1980)

* fixes #1893
* codegen (client and server) now supports codes other than the well-known ones published by go-openapi/runtime

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* fix(server): generates server to enable http/2

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Generated client: handles unexpected successful responses and returns default response with error rather than panicking (#1978)

Fixes #1518

Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Honour JSON ,string directive of ptr field when generating spec

Signed-off-by: wych42 <wych101010@gmail.com>
Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* do not force set the api logger to log.Printf

the logger already defaults so do not force set it in `SetAPI` since that would overwrite one I set in the API before calling `SetAPI`

Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>

* Regenerate bindata

Signed-off-by: Dj Gilcrease <d.gilcrease@f5.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants