Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !1367

[typescript-fetch] Add support for File (application/octet-stream) response types

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/interface48/fix_issue531 into master Nov 04, 2018
  • Overview 0
  • Commits 2
  • Pipelines 1
  • Changes 4

Created by: spallister

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language. @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) @topce (2018/10)

Description of the PR

This is a copy of a similar PR I submitted to the swagger-codgen repo here. A while back, @wing328 reached out to let me know the majority of the community moved over here, where I might want to consider re-submitting my PR.

The purpose of this PR is to return application/octet-stream response types as Files, instead of processing them as JSON. In the PR I had submitted to the swagger-codegen repo, I was returning such response types as Blobs, but soon after had a need to obtain the file's name (i.e. which File supports, but Blob does not).

Note that this PR includes a change for DefaultGenerator.java, as I needed to add a property to the mustache template model to determine whether the API contained at least one 'File Response'-type Operation. In particular, this was needed so that I could conditionally include a responseToFile helper method within api.mustache as necessary (i.e. our TS linter would otherwise throw an unused method warning for applications where no 'File Response'-type Operations were in use).

It looks like there is a TypeScript-fetch rewrite taking place over at #569, but figured I'd submit this in case it can be merged in the interim, or incorporated into that rewrite.

Fixes #531

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/interface48/fix_issue531