docs: add OpenAPI migration guide and mocks.json conversion script - #108
Merged
Conversation
MaxMichel2
force-pushed
the
docs/openapi-migration-guide
branch
from
September 8, 2026 14:16
3383fbf to
c91d18c
Compare
matthiaslao
approved these changes
Sep 8, 2026
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
force-pushed
the
docs/openapi-migration-guide
branch
from
September 8, 2026 15:34
c91d18c to
281a57d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.0mocks.json— one OpenAPI 3.x spec perapiGroups[]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, whyendpointOverridesneeds no replacement feature, response-file discovery changes, theNetworkMock(...)call-site diff, the sample app's real before/after, and a checklist of what the script can't do automatically. Registered inzensical.toml's nav anddocs/guides/index.md, cross-linked fromnetworkmock-core.md.CHANGELOG.md: PR 1 filed its breaking-change notes under the already-tagged## [0.1.5]section by mistake (tag0.1.5predates that commit, and the repo is on0.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 --selftestpassesmocks.json(recovered viagit show 34531e3^) and confirmed the output matches the shippedspecs/{jsonplaceholder,sample-api}.jsonfield-for-field (servers, operationIds, paths/methods,x-devview.delayMsplacement, 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 rendersapi.txt,detektFull,konsist:test, andtestAndroidHostTestare unaffected (detektFullran clean as part of each commit's pre-commit hook)🤖 Generated with Claude Code