Description
Tell us about the task you want to perform and are unable to do so because the feature is not available
Add support for importing requests from the json or yaml files in OpenAPI 3 and Swagger 2 data formats. The developed code should be able to parse the data & examples provided in the specs, let user choose the requests he wants to add to the API Dash collection and create the corresponding request items.
Activity
ashitaprasad commentedon Nov 8, 2024
Update: The frontend is already implemented.
The only change required will be the addition on OpenAPI in ImportFormat enum and adding the parser code.
sajid-31 commentedon Dec 21, 2024
OPENAPI specification document contains multiple endpoints and these endpoints branched into folders based on tags and into sub-folders based on /paths
The POSTMAN implementation creates a separate collection on importing openapi file and maintains branching based on tags and endpoints.
But I'm not sure if APIDASH has nested collections.
Rightnow, I'm implementing the parser using DART:CONVERT package.
The basic implementation will add all the endpoints by parsing them into HttpRequestModel
Can I proceed with this approach?
ashitaprasad commentedon Dec 21, 2024
@sajid-31 You can use this package to parse the OpenAPI spec file - https://pub.dev/packages/openapi_spec
Since OpenAPI spec is usually a dump of all the endpoints, once you have the parsed results, you should focus on allowing user to select the endpoints they want to include and add request models to the collections for the selected endpoints.
sajid-31 commentedon Dec 21, 2024
There is no documentation for openapi_spec. I'm not sure how to implement using this package.
Can you provide a resource which might help me understand this package.
Or should I look for alternatives?
ashitaprasad commentedon Dec 21, 2024
https://pub.dev/documentation/openapi_spec/latest/openapi_spec/
sajid-31 commentedon Dec 23, 2024
Query parameters can be added directly to the request model for each request endpoint.
How should path parameters be handled?
Since these can be accessed through environment variables, is it better to create a new environment for an OPENAPI JSON/YAML file upload and add the path parameters as variables, or should they be added to the global variables?
ashitaprasad commentedon Dec 23, 2024
@sajid-31 There is no need to create a new environment. You can add path parameters enclosed as
{{param}}
in the URL itself. It will get highlighted in red and user can create the requisite environment variable or replace it with a hardcoded string as per personal preference.2 remaining items
akshayw1 commentedon Mar 3, 2025
@ashitaprasad, I successfully set up the application locally and explored it. If you can answer my query, I can kickstart the issue. Also, while using the application, I noticed how it allows importing from a Postman collection. Similarly, in the same kind of UI, we would need to add OpenAPI specs, right, to conclude?
ashitaprasad commentedon Mar 3, 2025
@akshayw1 Figuring out answers to these questions are part of the task.
akshayw1 commentedon Mar 3, 2025
@ashitaprasad, I have everything figured out and can start now. I asked for confirmation earlier, but no worries—I’ll implement the integration similar to what we have for Postman and Insomnia, but for OpenAPI.
akshayw1 commentedon Mar 3, 2025
@ashitaprasad I have completed work on the issue. Now, I can import OpenAPI JSON or YAML files, select/delete items via a dialog, and import them into the side panel. Below is the demo video of implementation—please review it, and if everything looks good, I'll proceed with the PR.
Screen.Recording.2025-03-03.at.8.42.30.PM.mp4
ashitaprasad commentedon Mar 3, 2025
@akshayw1 You can send across a draft PR.
akshayw1 commentedon Mar 3, 2025
Okay will do , Just wanted to confirm the flow seems correct right? Will make PR in morning
akshayw1 commentedon Mar 6, 2025
@ashitaprasad I would appreciate it if you could review the PR. If there are any issues, please let me know, and I'll be happy to address them promptly. It's been open for over 48 hours now.
Initial implementation for openapi requests imports (foss42#121)