Skip to content

docs: add OpenAPI migration guide and mocks.json conversion script - #108

Merged
MaxMichel2 merged 5 commits into
mainfrom
docs/openapi-migration-guide
Sep 8, 2026
Merged

docs: add OpenAPI migration guide and mocks.json conversion script#108
MaxMichel2 merged 5 commits into
mainfrom
docs/openapi-migration-guide

Conversation

@MaxMichel2

Copy link
Copy Markdown
Collaborator

Summary

Closes #81, #80

Last PR of milestone 0.2.0 (epic #72). #80 (migrate the sample app and networkmock docs to OpenAPI) was fully completed in PR #104 but no PR closed it yet — this is the milestone's last PR, so it picks that up.

  • scripts/mocks_json_to_openapi.py: one-time conversion script for a pre-0.2.0 mocks.json — one OpenAPI 3.x spec per apiGroups[] entry. Only ever writes new spec files; existing response files are never moved/renamed/deleted, so it's safe to re-run. Warns (stderr, exit 0) rather than silently guessing on: a group id that won't match the engine's slugified spec id, an environment override that changes nothing OpenAPI can represent, stray per-environment response files with no matching override, empty operations, and operationId collisions.
  • docs/guides/migrating-to-openapi.md: the migration guide — rationale, field-by-field mapping table, why endpointOverrides needs no replacement feature, response-file discovery changes, the NetworkMock(...) call-site diff, the sample app's real before/after, and a checklist of what the script can't do automatically. Registered in zensical.toml's nav and docs/guides/index.md, cross-linked from networkmock-core.md.
  • CHANGELOG.md: PR 1 filed its breaking-change notes under the already-tagged ## [0.1.5] section by mistake (tag 0.1.5 predates that commit, and the repo is on 0.2.0-SNAPSHOT). Moved those five bullets up into [Unreleased], added the migration guide/script entry, and linked the guide from the breaking-change bullet.

Test plan

  • python scripts/mocks_json_to_openapi.py --selftest passes
  • Converted the sample app's real pre-migration mocks.json (recovered via git show 34531e3^) and confirmed the output matches the shipped specs/{jsonplaceholder,sample-api}.json field-for-field (servers, operationIds, paths/methods, x-devview.delayMs placement, query params, example names) — differences are only cosmetic (response files referenced in place rather than moved, getUserProfileV2's summary/location were hand-touched-up in the original migration)
  • zensical build — no dead links, no nav errors, new guide page renders
  • No Kotlin changes in this PR — api.txt, detektFull, konsist:test, and testAndroidHostTest are unaffected (detektFull ran clean as part of each commit's pre-commit hook)

🤖 Generated with Claude Code

@MaxMichel2 MaxMichel2 self-assigned this Sep 8, 2026
@MaxMichel2 MaxMichel2 added the documentation Improvements or additions to documentation label Sep 8, 2026
@MaxMichel2 MaxMichel2 added this to the 0.2.0 milestone Sep 8, 2026
@MaxMichel2
MaxMichel2 force-pushed the docs/openapi-migration-guide branch from 3383fbf to c91d18c Compare September 8, 2026 14:16
Base automatically changed from feat/networkmock-lazy-ui to main September 8, 2026 15:34
One-time upgrade aid for pre-0.2.0 integrators (#81): converts a legacy
mocks.json into one OpenAPI 3.x spec per apiGroups entry. Only ever writes
new spec files -- existing response files are never moved, renamed, or
deleted, so the script is safe to re-run. Warns (stderr, exit 0) on
anything it can't unambiguously translate: a group id that won't match the
engine's slugified spec id, an environment override that changes nothing
OpenAPI can represent (per-server delay/name/queryParams tweaks), stray
per-environment response files with no matching override, empty operations,
and operationId collisions -- rather than silently guessing.

Converting the sample app's real pre-migration mocks.json reproduces the
two shipped specs field-for-field (servers, operationIds, paths/methods,
x-devview.delayMs placement, query params, example names), modulo cosmetic
differences documented in the PR: response files are referenced in place
rather than moved, and the hand-picked getUserProfileV2 summary/location
were touched up by hand after PR 1's manual migration.
New docs/guides/migrating-to-openapi.md, registered in both zensical.toml's
nav and docs/guides/index.md: rationale, a field-by-field mocks.json ->
OpenAPI mapping table, why endpointOverrides needs no replacement (a path
variant is just another paths entry), how response file discovery changed,
the NetworkMock(...) call-site diff, the sample app's real before/after,
and a checklist of what the new conversion script (#81) can't do
automatically. Cross-linked from the DataStore-reset paragraph in
networkmock-core.md. Verified with `zensical build` (no dead links, no nav
errors).
PR 1's OpenAPI/environment-removal notes landed in ## [0.1.5] - 2026-09-08,
but tag 0.1.5 (0f912d2) predates that commit and the repo is on
VERSION_NAME=0.2.0-SNAPSHOT -- an unreleased change was filed under an
already-shipped version. Moved the five breaking-change bullets up into
[Unreleased], above PR 2's entries; [0.1.5] keeps only the devview-timecapsule
entry that's actually in that tag. Also links the migration guide from the
breaking-change bullet and adds the guide + conversion script under
[Unreleased] -> Added (#81 AC: CHANGELOG documents the 0.2.0 break with a
pointer to the guide).
@MaxMichel2
MaxMichel2 force-pushed the docs/openapi-migration-guide branch from c91d18c to 281a57d Compare September 8, 2026 15:34
@MaxMichel2
MaxMichel2 merged commit 293887d into main Sep 8, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: migration guide + mocks.json -> OpenAPI conversion script

2 participants