Skip to content

[Swift] Codegen does not detect file data types #4764

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

Closed
AnthonyOliveri opened this issue Feb 9, 2017 · 3 comments
Closed

[Swift] Codegen does not detect file data types #4764

AnthonyOliveri opened this issue Feb 9, 2017 · 3 comments

Comments

@AnthonyOliveri
Copy link
Contributor

Description

For Swift codegen, the CodegenOperation's defaultResponse is never set to type file, even when specified in the swagger doc, like so:

responses:
    200:
        description: success
        schema:
            type: file

This means that anything nested in the mustache tags {{#operation}}{{#isResponseFile}} never get evaluated, even for file type responses.

Swagger-codegen version

master branch

Suggest a Fix

The fix is very simple: the function public boolean isDataTypeFile(String dataType) needs to be implemented in SwiftCodegen.java and Swift3Codegen.java. Since these methods are currently not implemented, the response type incorrectly uses the same function from DefaultCodegen.java, which looks for the type string "file" instead of the Swift equivalent "NSURL" or "URL".

I can create a pull request with the fix if you like.

@wing328
Copy link
Contributor

wing328 commented Feb 13, 2017

@AnthonyOliveri thanks for reporting the issue. Please submit a PR so that we can review the change.

@AnthonyOliveri
Copy link
Contributor Author

AnthonyOliveri commented Feb 13, 2017

Submitted pull request #5065.

@wing328
Copy link
Contributor

wing328 commented Mar 17, 2017

Closed via #5056

Thanks for the contribution.

@wing328 wing328 closed this as completed Mar 17, 2017
spr3nk3ls pushed a commit to spr3nk3ls/swagger-codegen that referenced this issue Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants