[PR #5322] [MERGED] feat(common): add support for post/put body schemas in openapi import #5156

Closed
opened 2026-03-17 02:37:56 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hoppscotch/hoppscotch/pull/5322
Author: @anwarulislam
Created: 8/11/2025
Status: Merged
Merged: 8/20/2025
Merged by: @jamesgeorge007

Base: nextHead: feat/openapi-body


📝 Commits (10+)

  • 2fab163 feat: support for post/put body schemas
  • a97f281 fix: add error logging for sample generation in parseOpenAPIV2Body
  • 5521988 fix: additional request parameters missing errors
  • 3d14c39 feat: added sample body generation support for v3
  • c54acd2 feat: add JSON example generation for OpenAPI v2, v3, and v3.1 schemas
  • 61359e8 feat: enhance request body example generation for OpenAPI v2 and v3
  • 213c294 fix: correct typo in generateMixedArrayRequestBodyExample function name
  • f03637c fix: simplify array item generation in generateExampleArrayFromOpenAPIV2ItemsObject
  • d9f8afd feat: enhance media object example handling for OpenAPI v3 and v3.1
  • 95cd082 refactor: reorganize openapi directory structure

📊 Changes

6 files changed (+640 additions, -35 deletions)

View changed files

📝 packages/hoppscotch-common/src/helpers/functional/json.ts (+8 -0)
packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v2.ts (+189 -0)
packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v3.ts (+133 -0)
packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v31.ts (+145 -0)
📝 packages/hoppscotch-common/src/helpers/import-export/import/openapi/index.ts (+154 -35)
📝 packages/hoppscotch-sh-admin/src/components.d.ts (+11 -0)

📄 Description

Closes FE-944 #2087

Functionality to generate sample objects from OpenAPI v2/v3 schemas and fix parsing of form data and body parameters for post and put requests.

Try importing from the collections below. And open a post/put request from the imported collection, then look at the body tab.

Collections:

Before After
image image

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hoppscotch/hoppscotch/pull/5322 **Author:** [@anwarulislam](https://github.com/anwarulislam) **Created:** 8/11/2025 **Status:** ✅ Merged **Merged:** 8/20/2025 **Merged by:** [@jamesgeorge007](https://github.com/jamesgeorge007) **Base:** `next` ← **Head:** `feat/openapi-body` --- ### 📝 Commits (10+) - [`2fab163`](https://github.com/hoppscotch/hoppscotch/commit/2fab1630c6e3bb8bca9a5047c0ae9effa30fdf89) feat: support for post/put body schemas - [`a97f281`](https://github.com/hoppscotch/hoppscotch/commit/a97f2816b0336746042bf7392458fbdd61ddb800) fix: add error logging for sample generation in parseOpenAPIV2Body - [`5521988`](https://github.com/hoppscotch/hoppscotch/commit/55219885bb8f96ad9bbec6fbc5c1be7d14376245) fix: additional request parameters missing errors - [`3d14c39`](https://github.com/hoppscotch/hoppscotch/commit/3d14c39b5338eb8b3dd8c2f97d8c925b86d9a39f) feat: added sample body generation support for v3 - [`c54acd2`](https://github.com/hoppscotch/hoppscotch/commit/c54acd26734f7fc2176909ec008e700af99a5dd8) feat: add JSON example generation for OpenAPI v2, v3, and v3.1 schemas - [`61359e8`](https://github.com/hoppscotch/hoppscotch/commit/61359e8b90d075260969e99c12ebd659a0f206ea) feat: enhance request body example generation for OpenAPI v2 and v3 - [`213c294`](https://github.com/hoppscotch/hoppscotch/commit/213c29467bcbfba11977cf240e06c935f15f2424) fix: correct typo in generateMixedArrayRequestBodyExample function name - [`f03637c`](https://github.com/hoppscotch/hoppscotch/commit/f03637c6560ac390b37598e1906c37e354e35297) fix: simplify array item generation in generateExampleArrayFromOpenAPIV2ItemsObject - [`d9f8afd`](https://github.com/hoppscotch/hoppscotch/commit/d9f8afd1dff372a27680c7d62b706ccb151c2e66) feat: enhance media object example handling for OpenAPI v3 and v3.1 - [`95cd082`](https://github.com/hoppscotch/hoppscotch/commit/95cd0823570a1356c592952126d926487ff3ba95) refactor: reorganize openapi directory structure ### 📊 Changes **6 files changed** (+640 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `packages/hoppscotch-common/src/helpers/functional/json.ts` (+8 -0) ➕ `packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v2.ts` (+189 -0) ➕ `packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v3.ts` (+133 -0) ➕ `packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v31.ts` (+145 -0) 📝 `packages/hoppscotch-common/src/helpers/import-export/import/openapi/index.ts` (+154 -35) 📝 `packages/hoppscotch-sh-admin/src/components.d.ts` (+11 -0) </details> ### 📄 Description Closes FE-944 #2087 Functionality to generate sample objects from OpenAPI v2/v3 schemas and fix parsing of form data and body parameters for post and put requests. Try importing from the collections below. And open a post/put request from the imported collection, then look at the `body` tab. #### Collections: - v2: [petstore-v2.json](https://github.com/user-attachments/files/21847178/petstore-v2.json) - v3: [petstore-v3.json](https://github.com/user-attachments/files/21847179/petstore-v3.json) - v3.1: [ecommerce-v3.1.json](https://github.com/user-attachments/files/21847181/ecommerce-v3.1.json) | Before | After | |:--------|:--------| | <img width="660" height="326" alt="image" src="https://github.com/user-attachments/assets/d982dea6-d928-4bef-8ce6-778eb851a615" /> | <img width="604" height="397" alt="image" src="https://github.com/user-attachments/assets/7acba4df-d11c-418e-84e7-e254f78e3ebb" /> | --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-17 02:37:56 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#5156
No description provided.