Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openapi2conv: v3 formDataBody has extra required array #847

Closed
liankui opened this issue Oct 17, 2023 · 0 comments
Closed

openapi2conv: v3 formDataBody has extra required array #847

liankui opened this issue Oct 17, 2023 · 0 comments

Comments

@liankui
Copy link
Contributor

liankui commented Oct 17, 2023

swagger.json into v3.json

{
  "swagger": "2.0",
  "info": {
    "description": "Hello Java Sec API",
    "version": "1.10",
    "title": "Swagger2 RESTful API"
  },
  "host": "localhost:8888",
  "basePath": "/",
  "paths": {
    "/UPLOAD/uploadSafe": {
      "post": {
        "operationId": "singleFileUploadSafeUsingPOST",
        "consumes": [
          "multipart/form-data"
        ],
        "parameters": [
          {
            "name": "file",
            "in": "formData",
            "description": "file",
            "required": true,
            "type": "file"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}

and the v3.json

{
    "components": {},
    "info": {
        "description": "Hello Java Sec API",
        "title": "Swagger2 RESTful API",
        "version": "1.10"
    },
    "openapi": "3.0.3",
    "paths": {
        "/UPLOAD/uploadSafe": {
            "post": {
                "operationId": "singleFileUploadSafeUsingPOST",
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "properties": {
                                    "file": {
                                        "description": "file",
                                        "format": "binary",
                                        "required": [
                                            "file"
                                        ],
                                        "type": "string",
                                        "x-formData-name": "file"
                                    }
                                },
                                "required": [
                                    "file"
                                ],
                                "type": "object"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "string"
                                }
                            }
                        },
                        "description": "OK"
                    }
                }
            }
        }
    },
    "servers": [
        {
            "url": "https://localhost:8888/"
        }
    ]
}

In v3.json, requestBody.schema.properties has a required array, and schema.properties.file has an extra required array again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant