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

java.util.Map is not imported #8121

Open
githubgogogo opened this issue May 2, 2018 · 7 comments
Open

java.util.Map is not imported #8121

githubgogogo opened this issue May 2, 2018 · 7 comments

Comments

@githubgogogo
Copy link

Description

When I use swagger-codegen-maven-plugin maven plugin to generate API java code, the Map is not imported. I saw some similar issue raised but no code fix merged in master branch, could you please let me know when could the fix merged in master branch.

Swagger-codegen version

2.4.0-SNAPSHOT

Swagger declaration file content or url
  • name: searchCriteria
    required: false
    in: query
    type: object
    additionalProperties: {
    type: string
    }
Suggest a fix/enhancement

Please support Map in code generation

@yuanpli
Copy link

yuanpli commented Aug 6, 2018

I faced the same issue with swagger-codegen-maven-plugin 2.3.1

@mccrackend
Copy link

mccrackend commented Feb 22, 2019

I'm also still seeing this behavior in both 2.3.1 and 2.4.2.

default ResponseEntity<Map<String, MyObject>>.. is generated, but import java.util.Map; is missing.

One possible workaround I've found is to define a wrapper object to be the host of the actual map, which isn't idea, but does work.

responses:
  200:
    description: Successful call
    schema:
      $ref: "#/definitions/WrapperHashMap"

definitions:
  WrapperHashMap:
    type: object
    additionalProperties:
      $ref: '#/definitions/SomeObject'

@HugoMario
Copy link
Contributor

hello @githubgogogo @yuanpli @mccrackend

can you please let me know what language are you using to get the issue?

@mccrackend
Copy link

@HugoMario I'm using Java v1.8 in this particular project

@HugoMario
Copy link
Contributor

@mccrackend sorry for confuse, i meant what language option for code generation, example: java, spring, python, etc

@mccrackend
Copy link

@HugoMario <language>spring</language> sorry about that!

@nigelsim
Copy link

nigelsim commented Mar 14, 2022

Same issue, swagger-codegen-cli 3.0.33 using -l java and no other language options.

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

5 participants