joolfe / postman-to-openapi

🛸 Convert postman collection to OpenAPI
MIT License
575 stars 99 forks source link

JSON instead of YAML #206

Closed hosseinmd closed 1 year ago

hosseinmd commented 1 year ago

We need JSON response instead of YAML.

Please return JSON in response and write YAML to file. YAML in response is not useful.

joolfe commented 1 year ago

@hosseinmd not sure if I'm understanding this issue, could you please put some examples of collections and the corresponding open API transformation to show case this?

Thanks

hosseinmd commented 1 year ago
const result = await postmanToOpenApi(postmanCollection, outputFile);

I need to 'result' be a JSON

mindrunner commented 1 year ago

You can use yamljs to convert yaml to json

hosseinmd commented 1 year ago

You can use yamljs to convert yaml to json

This is not useful for this module

mindrunner commented 1 year ago

I personally found it very helpful. I am sorry if the workaround doesn't suit you. I am pretty sure, a Pull Request is highly appreciated :)

joolfe commented 1 year ago

Hi @hosseinmd,

As per OpenApi specification "An OpenAPI document that conforms to the OpenAPI Specification is itself a JSON object, which may be represented either in JSON or YAML format." so I have add in version 2.6.0 i have implement a new configuration option outputFormat for choose between json or yaml, yaml is still the default option.

Take into consideration that the goal of this library is to create OpenAPI documents so the returning value is still a string value but you can choose if the format in the string is yaml or json.

Best Regards.