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

TypeError: bodyContent.match is not a function #660

Closed
cpwr opened this issue Dec 21, 2022 · 7 comments · Fixed by #679
Closed

TypeError: bodyContent.match is not a function #660

cpwr opened this issue Dec 21, 2022 · 7 comments · Fixed by #679
Labels
bug Something isn't working good-first-issue Good first issues that can be picked up by beginner contributors. importer request-body

Comments

@cpwr
Copy link

cpwr commented Dec 21, 2022

Hi! Postman is great, but I have some issues working with it
Neither the utility nor the Postman could not convert the API spec though it has passed the test and matches the requirements for the OpenAPI v3.0.3

image

$ openapi2postmanv2 -s ~/Documents/spec.yaml -o collection.json -p
Input file:  /home/user/Documents/spec.yaml
TypeError: bodyContent.match is not a function
    at getXmlVersionContent (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:2021:30)
    at Object.convertToPmBody (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:2034:11)
    at Object.convertRequestToItem (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:2557:21)
    at Object.convertChildToItemGroup (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1035:19)
    at Object.convertChildToItemGroup (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1023:18)
    at Object.convertChildToItemGroup (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1023:18)
    at Object.convertChildToItemGroup (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1023:18)
    at Object.convertChildToItemGroup (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:1023:18)
    at Object.addCollectionItemsUsingPaths (/usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemaUtils.js:754:16)
    at /usr/local/lib/node_modules/openapi-to-postmanv2/lib/schemapack.js:346:23

The original spec file is here

Could someone help me to understand what the actual problem is?

@geromegrignon
Copy link

The input file spec.yaml doesn't match your link content format (json).

@cpwr
Copy link
Author

cpwr commented Jan 4, 2023

@geromegrignon I couldn't get what is the difference, but I was able to do that with the same file using another app called portman:
the command was portman -l spec.yaml -o postman.json and after that I've successfully imported that collection.
What am I doing wrong?

@geromegrignon
Copy link

@cpwr the difference is your command implies you use a yaml file but providing a json file as a reference. It means your real situation can't be reproduced to understand your problem.

@cpwr
Copy link
Author

cpwr commented Jan 5, 2023

@cpwr the difference is your command implies you use a yaml file but providing a json file as a reference. It means your real situation can't be reproduced to understand your problem.

it's only a name of the file. the content of it is what you can see by the link above.
I have checked that link returns valid JSON, and I have renamed the input file to spec.json, it doesn't make any difference.

@VShingala VShingala added good-first-issue Good first issues that can be picked up by beginner contributors. request-body labels Jan 13, 2023
@VShingala
Copy link
Member

@cpwr Thanks for reporting the issue! We're working on the fix for this and we'll update this issue with any future updates.

@VShingala VShingala added the bug Something isn't working label Jan 13, 2023
aman-v-singh added a commit to aman-v-singh/openapi-to-postman that referenced this issue Jan 24, 2023
@VShingala
Copy link
Member

@cpwr We have fixed this issue in module version 4.9.0 and it'll soon be available with the upcoming App release.

@cpwr
Copy link
Author

cpwr commented Feb 7, 2023

thanks for a fix! great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good-first-issue Good first issues that can be picked up by beginner contributors. importer request-body
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants