swagger-api / swagger-api/swagger-ui

Post Upload file (error 403)

Open
#5,280 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

I am new to Swagger. I want to ask a question. I have a docker on the server with a neural network that processes the photo! To send a photo to the docker for processing, I use the string "curl http: // localhost: 5000 / predict -X POST -F" image=@1201.jpg" to the terminal I tried to send this command along with the photo through the postman, and everything worked, but I want to try to do it through Swagger. This is possible ??? I wrote a form for downloading phtographs, but I cannot send a command (curl http: // localhost: 5000 / predict -X POST -F "image=@1201.jpg" ) But the photo is not sent! Can you help?

Swagger/OpenAPI definition:

# consumes:
  - application/json
  - application/xml
produces:
  - application/json
  - application/xml
paths:
   /predict:
     post:
       responses:
        200:
          description: ОК
          schema:
            $ref: '#/definitions/RecongitionResult'
       summary: Uploads a file.
       consumes:
         - multipart/form-data
       parameters:
         - in: formData
           name: image
           type: file
           description: The file to upload.
definitions:
  RecongitionResult:
    type: object
    required:
      - categories
      - prediction
    properties:
      categories:
        type: array
        items: 
            $ref: '#/definitions/Prediction'
        description: ''
      prediction:
        $ref: "#/definitions/Prediction"
  Prediction:
    type: object
    required: 
    - confidence
    - name
    properties:
      confidience:
        type: number
        format: double
        example: 0.951259434223175
        description: 'Recognition accuracy.'
      name:
        type: string
        example: "1"
        description: 'The name of the recognition classifier.'

schemes:
 - https
 - http
host: 192.168.0.10:5000
basePath: /

403Undocumented | Error:Response
headers content-length: 0
date: Mon, 01 Apr 2019 08:21:38 GMT
server: nginx/1.14.0 + Phusion Passenger 5.3.4
status: 403, 403 Forbidden via: 1.1 02362f0faae05408640185d927020628.cloudfront.net (CloudFront)
x-amz-cf-id: DY95Edhvp_FvhNkW_g6v9J_h7gjn3EyyRB5LwE9bpdlsRLpuV-t15g==
x-cache: Error from cloudfront x-powered-by: Express, Phusion Passenger 5.3.4
-- | --

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No Swagger UI file or test is named. Start by reproducing the multipart/form-data request against /predict with the supplied definition and compare it with the working curl and Postman requests. Done would require a project-specific, reproducible Swagger UI defect with expected behavior; the report currently only shows a server-side 403 response.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, nginx, openapi
Domain
api, backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
10/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.