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

Missing enum import #76

Closed
midoriiro opened this issue Dec 19, 2019 · 1 comment · Fixed by #79
Closed

Missing enum import #76

midoriiro opened this issue Dec 19, 2019 · 1 comment · Fixed by #79

Comments

@midoriiro
Copy link

My swagger.json was generated by swashbuckle (from an asp.net core web service). I trying to generate a kotlin client from this swagger.json, the generation run successfully. But on the api generated object enum import is missing.

I followed this sample code. Maybe I missing somethings.

You can reproduce the bug from this repository : https://github.com/midoriiro/yelp-swagger-gradle-codegen-missing-enum-import

cortinico added a commit to cortinico/swagger-gradle-codegen that referenced this issue Dec 26, 2019
Previously inner types of complex types were not imported properly on
operations. This resulted in Retrofit interfaces missing some imports.

This commit introduces methods to inspect and import the inner types
used as result types of operations.

Fixes Yelp#76
@cortinico
Copy link
Collaborator

Thanks for reporting @midoriiro
I was able to reproduce your issue and fix it in this PR: #79

The bug was related to the return type of your endpoint:

"responses": {
          "200": {
            "description": "Success",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "additionalProperties": {
                  "$ref": "#/definitions/MyEnum"
                }
              }
            }
          }
        }

Will generate a method with this return type: Single<Map<String, Map<String, MyEnum>>>

Previously, inner types (such as MyEnum) were ignored and not imported properly. The fix I proposed should cover also this scenario.

cortinico added a commit to cortinico/swagger-gradle-codegen that referenced this issue Jan 1, 2020
Previously inner types of complex types were not imported properly on
operations. This resulted in Retrofit interfaces missing some imports.

This commit introduces methods to inspect and import the inner types
used as result types of operations.

Fixes Yelp#76
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

Successfully merging a pull request may close this issue.

2 participants