subasraj / flashpost-support

Flashpost is a lightweight Rest API Client Extension for Visual Studio Code.
MIT License
10 stars 0 forks source link

Import Collection from OpenAPI 2.0/3.0 Swagger Files #2

Closed SxMShaDoW closed 9 months ago

SxMShaDoW commented 10 months ago

Hi,

It would be great to add support for importing OpenAPI swagger.json/yaml files.

Example 2.0 - https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v2.0/json/api-with-examples.json Example 3.0 - https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/api-with-examples.json

subasraj commented 9 months ago

Hi, Please install the latest version of Flashpost 1.1.48 I have added the option to import OpenAPI/Swagger files.

Thanks, Subas

brandsr commented 9 months ago

Hi, support for examples per path-parameter in an openapi definition would be much appreciated. So variables (the path-parameters) in the uri, like /api/v1/:hostname/:action could be supported also (ThunderClient does that nicely). See also: https://swagger.io/docs/specification/adding-examples/

subasraj commented 9 months ago

@brandsr Can you please share a sample file for "/api/v1/:hostname/:action"

brandsr commented 9 months ago

Hi @subasraj ,

find attached a small example. I would expect that when opening the hostname get request to have Params prefilled with the examples for the path parameters hostname and action. And when sending de request (after optionally modifying the values) the URI is properly formatted with replaced param values.

(ergo: an uri in openapi does not only have query params, but also (and most often) path params)

You could apply the same for query-params and a body (when sending a PUT or POST request): prefill it with the examples from the openapi definition. openapi3.1.yml.zip

subasraj commented 9 months ago

@brandsr I have added code for "path params" It will be the same as in postman. Please update to latest version and try again. Also, the file you sent me "openapi3.1.yml doesn't work and getting exceptions in Thunder Client.

subasraj commented 9 months ago

Closing this. Please open a new one if needed for any changes or bug fixes.

brandsr commented 9 months ago

@brandsr I have added code for "path params" It will be the same as in postman. Please update to latest version and try again. Also, the file you sent me "openapi3.1.yml doesn't work and getting exceptions in Thunder Client.

The example file was only imported in your extension, not in ThunderClient. 👍