codeasashu / swagman

A Postman to swagger api converter using openAPI v3
0 stars 0 forks source link

ERROR while running on terminal #2

Open imranshaik012 opened 3 years ago

imranshaik012 commented 3 years ago

getting error while running a project

image File "run.py", line 36, in cli()

codeasashu commented 3 years ago

can you post the full error?

imranshaik012 commented 3 years ago

Below is the code for an api with using POST method

@app.route('/convert', methods=['POST']) def cli(format, ignore, postmanfile, outfile): try: postmanfile = ('./collection.json') converter = swagman.Converter(request.body.fileName) swagger_output = converter.convert(format) return jsonify({ 'data': swagger_output }) with open(outfile, 'w') as f: f.write(swagger_output) click.echo(click.style('Schema converted successfully!', fg='green')) f.close() except ValueError as e: return False if name == 'main': app.run(debug=True) cli()

I Run the Command

python run.py collection.json openapi.yaml

till here its working fine it has created openapi file which is empty

On sending request with postman in the body i am passing input as filename also i tried using string instead of file same error i am getting

image

It throws an error on console

image

Infosec-RKR commented 3 years ago

@codeasashu @imranshaik012

I do still get the same " TypeError" python run.py MY.postman_collection.json swagger1.yaml

TypeError: 'pmrequest' object is not subscriptable

Traceback (most recent call last): File "run.py", line 32, in cli() File "C:\Users\infosec\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 764, in call

codeasashu commented 3 years ago

@Infosec-RKR Sorry but I've renamed this project to openman. It contains a lot of bugfixes and have better mocking capabilities.

https://github.com/codeasashu/openman

Can you try that and see if it fixes the issue?