Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

feat: synthesise response bodies from OpenAPI schemas

Open
#82 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
kotlin, openapi
Domain
api, tooling

Research direction

Start with devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.kt and the parser package introduced by #1/#4 to trace response discovery. Define the schema-synthesis utility under devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/openapi/ and cover the listed schema shapes with unit tests. Done means schema-only responses produce bodies, nested and nullable cases work, and the UI distinguishes synthesized responses or documents that decision.

Written by the indexing model from the issue text.

Description

enhancement

Part of #72

Depends on #1. Not blocking for 0.2.0 — follow-up depth issue.

Summary

When an OpenAPI operation declares a response (responses.<code>) but no examples entry, synthesize a plausible response body from the response's JSON Schema instead of the operation having zero mockable variants.

Current state

Per #1/#4, this migration's 0.2.0 scope only surfaces responses that have an explicit example (examples.<name>.externalValue). Many real-world OpenAPI specs declare a content.<mediaType>.schema for a response without ever attaching an example — those specs are still perfectly valid, but under 0.2.0 they'd show that response code with zero selectable variants in the DevView UI, which is a worse experience than the old probing-based discovery gave for a hand-written mocks.json (where at least an integrator could always add a matching file).

What to build

A schema → example synthesizer: given a Schema Object (type, properties, items, format, enum, etc.), generate a representative JSON value — e.g. string → "string" or the first enum value if present, integer/number → 0, boolean → false, object → recursively synthesized properties, array → a single-element array of the synthesized item type. Use this as the response body when no example exists for that status code.

Consider whether to cache synthesized bodies (they're deterministic per schema, so no need to regenerate on every discovery pass) and whether synthesized responses should be visually distinguished in the UI from author-provided examples (recommended — a user picking a mock should know whether they're looking at real example data or a generic placeholder).

Explicitly out of scope

  • allOf/oneOf/anyOf/discriminator resolution — tracked separately in #12, since that's a meaningfully different (and larger) problem: which schema variant to pick, not how to render a known schema.
  • Schema validation of any kind — this library mocks, it doesn't validate.

Acceptance criteria

  • An operation with a declared response schema but no example produces a synthesized JSON body.
  • Synthesis handles at minimum: primitives (string/integer/number/boolean), enum, object with properties, array with items, and nullable fields.
  • Synthesized responses are visually distinguishable from example-provided responses in the UI (or a documented decision explaining why not).
  • Unit tests cover each schema shape above plus nested objects/arrays.

Files likely touched

  • devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/repository/MockConfigRepository.kt (or wherever discovery lands post-#4)
  • New schema-synthesis utility, likely devview-networkmock-core/src/commonMain/kotlin/com/worldline/devview/networkmock/core/openapi/ (or wherever #1's parser package lands)
  • devview-networkmock/ UI components if the "synthesized vs. real" visual distinction is built
Dominant language
Kotlin
Stars
10
Forks
2
Avg merge
2d 14h
Merged PRs (30d)
13

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from worldline/devview

All issues in worldline/devview

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.