swagger-api / validator-badge

Validate your Swagger JSON/YAML today!
http://swagger.io
Apache License 2.0
210 stars 85 forks source link

multipart/form-data multiples propreties required in swagger display "unvalid" #186

Open zakipuzo opened 3 years ago

zakipuzo commented 3 years ago

This is the working request body:

"requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "required": [
                  "video",
                  "encodings"
                ],
                "properties": {
                  "video": {
                    "type": "string",
                    "format": "binary",
                    "description": "Upload video file"
                  },
                  "encodings": {
                    "type": "string",
                    "format": "binary",
                    "description": "Upload video file "

                  }
                }
              } 
            }
          }
        }

This is the error message:

{"messages":["attribute paths.'/smile_video'(post).requestBody.content.'multipart/form-data'.schema.required is not of type `array`"],"schemaValidationMessages":[{"level":"error","domain":"validation","keyword":"oneOf","message":"instance failed to match exactly one schema (matched 0 out of 2)","schema":{"loadingURI":"#","pointer":"/definitions/Operation/properties/requestBody"},"instance":{"pointer":"/paths/~1smile_video/post/requestBody"}}]}

I resolve this by disabling validation: validatorUrl : false

const ui = SwaggerUIBundle({
        url: url,
        dom_id: '#swagger-ui',
        deepLinking: true,
        validatorUrl : false,
        presets: [
          SwaggerUIBundle.presets.apis,
          SwaggerUIStandalonePreset
        ],
        plugins: [
          SwaggerUIBundle.plugins.DownloadUrl
        ]
      });