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

swagger_2 -> openapi_3: Crash when body parameter is missing schema #375

Open
icholy opened this issue Nov 12, 2023 · 0 comments
Open

swagger_2 -> openapi_3: Crash when body parameter is missing schema #375

icholy opened this issue Nov 12, 2023 · 0 comments

Comments

@icholy
Copy link

icholy commented Nov 12, 2023

Trying to convert the following file will make the converter crash:

{
	"swagger": "2.0",
	"paths": {
		"/endpoint": {
			"post": {
				"parameters": [
					{
						"in": "body",
						"name": "body"
					}
				]
			}
		}
	},
}

Command:

api-spec-converter -f swagger_2 -t openapi_3 swagger.json

Error:

Fatal SyntaxError: Unexpected token u in JSON at position 0
    at JSON.parse (<anonymous>)
    at Object.clone (/home/icholy/.nvm/versions/node/v16.20.1/lib/node_modules/api-spec-converter/node_modules/swagger2openapi/common.js:12:17)
    at processParameter (/home/icholy/.nvm/versions/node/v16.20.1/lib/node_modules/api-spec-converter/node_modules/swagger2openapi/index.js:490:54)
    at processPaths (/home/icholy/.nvm/versions/node/v16.20.1/lib/node_modules/api-spec-converter/node_modules/swagger2openapi/index.js:678:25)
    at main (/home/icholy/.nvm/versions/node/v16.20.1/lib/node_modules/api-spec-converter/node_modules/swagger2openapi/index.js:845:5)
    at /home/icholy/.nvm/versions/node/v16.20.1/lib/node_modules/api-spec-converter/node_modules/swagger2openapi/index.js:1133:13
    at Generator.next (<anonymous>)
    at onFulfilled (/home/icholy/.nvm/versions/node/v16.20.1/lib/node_modules/api-spec-converter/node_modules/co/index.js:65:19)
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