You probably need to specify the bytes parameter as being of type file.

 

 

 

From: <[email protected]> on behalf of Martin Duris 
<[email protected]>
Reply-To: "[email protected]" 
<[email protected]>
Date: Wednesday, August 30, 2017 at 12:39
To: Swagger <[email protected]>
Subject: How to define in swagger following service (Typescript Angular 2)( ?

 

Hi guys, 

 

i would need to define in swagger service (file upload service). Service is 
already on API server implemented.

 

>From this definition should be generated code (using Typescript Angular 2 in 
>editor2.swagger).

To call service i can use this code :

const formData:FormData = new FormData();
formData.append('filename', <any>filename);
formData.append('contentType', <any>contentType);
formData.append('size', <any>size);
formData.append('bytes', <any>bytes);

const headers = new Headers();
headers.delete('Content-Type');

const options: RequestOptionsArgs = new RequestOptions({
 method: RequestMethod.Post,
 headers: headers,
 withCredentials:this.configuration.withCredentials
});
return this.http.post(path, formData, options); // this will call service with 
valid reponse

 

I have tried following definition:

/rest/service:
    post:
        summary: Upload
        consumes:
          - multipart/form-data
        produces:
          - application/json
        parameters:
          - name: filename
            in: formData
            required: true
            type: string
          - name: contentType
            in: formData
            required: true
            type: string
          - name: size
            in: formData
            required: true
            type: integer
          - name: bytes
            in: formData
            required: true
            type: string
        responses:
          200:
            schema:
              $ref: '#/definitions/SomeModel'

 

But this will generated not request i need.

 

Can you please help ?

 

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to