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

swagger-codegen erroneously import java.io.File #8134

Open
sknick opened this issue May 3, 2018 · 3 comments
Open

swagger-codegen erroneously import java.io.File #8134

sknick opened this issue May 3, 2018 · 3 comments

Comments

@sknick
Copy link

sknick commented May 3, 2018

Description

If you generate code for python-flask using a spec file that contains a definition for an object called "File", swagger-codegen never creates the corresponding model file module and imports java.io.File into the generated default_controller.py.

Swagger-codegen version

2.3.1

Swagger declaration file content or url

swagger: "2.0"

info:
version: 0.0.1
title: Blah API
description: An API for interacting with the blah system

paths:

/files:

get:
  description: Retrieves information on files that match the specified criteria

  produces:
  - "application/json"

  parameters:
    - name: tags
      type: array
      description: The tags for which matching files are to be returned
      in: query
      items:
        type: string

  responses:
    '200':
      description: Successful response
      schema:
        type: array
        items:
          $ref: "#/definitions/File"

definitions:
File:
type: object
properties:
file_id:
type: "string"
format: "uuid"
path:
type: "string"
tags:
type: array
items:
type: "string"

Command line used for generation

java -jar /home/sknick/Misc/swagger-codegen-cli-2.3.1.jar generate -l python-flask -o ./Source -i ./api.yaml

Steps to reproduce

(Shown above.)

Related issues/PRs

Not sure.

Suggest a fix/enhancement

No idea.

@alxdarksage
Copy link

I have this exact problem. Doesn't look like there has been any solution to it. :-(

@HugoMario
Copy link
Contributor

hi guys, thanks for reporting this. if someone is willing/available to propose a PR, let me know and i can help with merging

@progmacattack
Copy link

Same -- partial workaround is to add a prefix to your models. However, still in the GET methods the generated code erroneously imports java.io.File

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

No branches or pull requests

4 participants