Skip to content

feat(openapi): complete importer with query params, $ref bodies and form support - #148

Merged
matstech merged 6 commits into
mainfrom
fix/openapi_importer
May 9, 2026
Merged

matstech merged 6 commits into
mainfrom
fix/openapi_importer

Conversation

@matstech

@matstech matstech commented May 6, 2026 •

Copy link
Copy Markdown
Member

Summary 💡

This PR significantly enhances the OpenAPI/Swagger importer, making it "feature-complete" for standard API specifications. It adds support for query parameters, global path parameters, recursive request body resolution, and various form data types.

Description 📝

The OpenAPI importer has been overhauled to handle complex real-world specifications that were previously resulting in incomplete requests or empty bodies.

Key changes:

  • Recursive Reference Resolution & Request Bodies:
    • Correctly follows $ref pointers within definitions (Swagger 2.0) and components/schemas (OpenAPI 3.x).
    • Added support for $ref at the requestBody level (OAS 3.x).
  • Deep Example & Fallback Generation:
    • Implemented recursive traversal of schema properties to "assemble" bodies.
    • New: Added primitive fallback values (e.g., "string", 0, false) when no examples or defaults are provided in the spec, ensuring non-empty, typed bodies.
  • Parameter Management:
    • Query Parameters: Now extracted and automatically appended to the request URL (consistent with Postman importer behavior).
    • Path-Level Parameters: Support for parameters defined at the path level (common to all operations in that path), with proper override logic for operation-level parameters.
  • Form Support:
    • Implemented support for application/x-www-form-urlencoded.
    • Implemented support for multipart/form-data with automatic boundary generation (for textual fields).
  • Improved URL Normalization: Better handling of baseUrl and path placeholders.

Tests performed 🧪

  • Enhanced Petstore Test: Updated testdata/petstore_openapi.yaml to include a full suite of test cases (global headers, query params, $ref bodies, and form data).
  • Comprehensive Unit Tests: Verified the entire internal/importer package.
  • Manual Verification: Validated that imported requests are correctly structured for the Solo frontend (URL with query strings, specific Content-Type headers).

@matstech

matstech commented May 6, 2026

Copy link
Copy Markdown
Member Author

/prudence

matstech added 2 commits May 9, 2026 15:07
…orm support

- Added support for path-level global parameters.
- Implemented query parameters extraction and URL appending.
- Added recursive $ref resolution for OAS3 requestBody objects.
- Implemented support for application/x-www-form-urlencoded and multipart/form-data.
- Added primitive fallback values (string, integer, boolean) when examples are missing.
- Enhanced petstore_openapi.yaml with a comprehensive set of test cases.
- Updated unit tests to verify headers, query params, and complex body structures.
@matstech matstech changed the title fix(openapi): importer body example by ref feat(openapi): complete importer with query params, $ref bodies and form support May 9, 2026
@matstech
matstech marked this pull request as ready for review May 9, 2026 13:44
matstech added 3 commits May 9, 2026 22:45
…port

- Added support for Bruno query { ... } blocks.
- Implemented support for body:form-urlencoded and body:multipart-form.
- Refactored form formatting utilities to a shared internal/importer/utils.go file.
- Added new .bru test files and updated unit tests.
- Updated OpenAPI importer to use {{fieldName}} as fallback for missing examples.
- Standardized binary file placeholder to [BINARY_FILE_CONTENT] across all importers.
- Ensured deterministic output by sorting keys in query strings and multipart bodies.
- Updated all unit tests to reflect new placeholder logic and deterministic ordering.
@matstech
matstech force-pushed the fix/openapi_importer branch from dc9fd04 to 5ed5775 Compare May 9, 2026 21:21
@matstech
matstech merged commit 8da97ba into main May 9, 2026
7 checks passed
@matstech
matstech deleted the fix/openapi_importer branch May 9, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant