JuliaComputing/OpenAPI.jl

Is this correct server function signature to response a file?

Closed this issue · 3 comments

For download.yaml :

paths:
  /report:
    get:
      summary: Returns the report in the PDF format
      responses:
        '200':
          description: A PDF file
          content:
            application/pdf:
              schema:
                type: string
                format: binary

Julia server generate doc is:

@doc raw"""
Encapsulates generated server code for DownloadServer

The following server methods must be implemented:

- **report_get**
    - *invocation:* GET /report
    - *signature:* report_get(req::HTTP.Request;) -> String
"""

report_get(req::HTTP.Request;) -> String, is this the expected result?

Another question is how to implement this report_get function.

Shall we manually set the content-type for response in server implementation?

I think this part is not finished because I can't find any code snip about "application/pdf" in server-generated code.

There have been some related changes to code generation in the openapi-generator repo... so if you try the master branch of openapi-generator, it should generate report_get(req::HTTP.Request;) -> Vector{UInt8} instead.

Shall we manually set the content-type for response in server implementation?
I think this part is not finished ...

True, this part is not there. This is what #25 was meant for. But I would recommend addressing that after #51, which can be done in isolation.