Generate swagger server that will server local file

Viewed 94

I'm trying to write a yaml that will generate a nodejs stub-server serving a file. Swagger codegen generates server that replies nothing.

swagger: "2.0"
info:
  description: ""
  version: "1"
  title: "Swagger example"
  
host: "localhost:3200"
basePath: "/v2"

schemes:
- "http"
paths:
  /getImage:
    get:
      tags:
      - "image"
      summary: "Returns image"
      description: ""
      operationId: "getImage"
      produces:
      - "application/octet-stream"
      responses:
        "200":
          description: "successful operation"
          schema:
           type: "file"
           example:
              sampleFile:
                summary: "A sample file"
                externalValue: "http://github.com/topheroes/topheroes.github.io/raw/master/img/dragon.png"
              
        "400":
          description: "Invalid value"

Is there a way to generate a stub that will serve a local or a random binary (image) file? I tried type: string and format: binary, I tried url in example. Nothing seems to work.

Please advice

0 Answers
Related