mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #5988] [bug]: OpenAPI import generates empty request body for schemas using allOf #2354
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#2354
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mahmoodhamdi on GitHub (Mar 13, 2026).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/5988
Software and environment
Steps to reproduce
allOfcomposition (a very common pattern for schema inheritance):Expected behavior
The request body example should include all merged properties from the
allOfschemas:Actual behavior
The request body is empty (
"") because theallOfcase is not handled in the example generator.Root cause
In
packages/hoppscotch-common/src/helpers/import-export/import/openapi/example-generators/v3.ts, the functiongenerateRequestBodyExampleFromSchemaObjecthas a TODO comment acknowledging this gap:The same issue exists in
v31.ts(oneOf/anyOfare handled at lines 105-113, butallOfis missing).Suggested fix
For
allOf, merge all sub-schemas' properties and generate an example from the merged result:Impact
allOfis one of the most commonly used composition keywords in OpenAPI specs (used for inheritance, mixins, and extending base schemas). Any API spec using this pattern will have empty request bodies after import, forcing users to manually fill in every field.@savauu commented on GitHub (Mar 14, 2026):
Hi! I’d like to work on this issue.
I noticed the TODO in
generateRequestBodyExampleFromSchemaObjectwhereallOfschemas are not handled. I’ll try implementing support for merging theallOfsub-schemas so the example body is generated correctly.Please let me know if that approach sounds good.
@matthewwalker1621-star commented on GitHub (Mar 16, 2026):
Looks good to me
On Sat, Mar 14, 2026, 12:36 PM savari sable @.***>
wrote: