swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

[GO] Missing os import when API returns an *os.File

Open tchandelle opened this issue 6 years ago • 1 comments

Description

When an API returns a file, the golang generator converts it to *os.File, but forget to import os

Swagger-codegen version

2.4.8

Swagger declaration file content or url

Relevant part :

paths:
  /systems/download_traces:
    get:
      summary: Check result of a download traces job.
      operationId: result_download_traces
      tags:
        - systems
      produces:
        - application/json
        - application/tar+gzip
      responses:
        '200':
          $ref: '#/responses/download_traces'
        '202':
          $ref: '#/responses/active_job_status'
      parameters:
        - $ref: '#/parameters/job_id'
responses:
  download_traces:
    description: A completed job for downloading traces.
    schema:
      type: file

Which generate to https://github.com/nodeum-io/nodeum-sdk-go/blob/1798fe5373e6b36d67b50b835762d9c3f306286b/v2/api_systems.go#L35

Command line used for generation

(generated from swaggerhub)

tchandelle avatar Dec 02 '19 08:12 tchandelle

Hello @tchandelle , i'm not familiar GO but i tested this and the os is imported, maybe, this was fixed in later releases. So, i'm going to close for now but if you still get the issue please dont hesitate to ping me and i work on it asap.

HugoMario avatar Mar 28 '20 07:03 HugoMario