feat: migrate networkmock config to OpenAPI 3.x - #104
Open
MaxMichel2 wants to merge 6 commits into
Open
Conversation
…lude Adds the graphify skill/agent tooling and a generated knowledge graph (graphify-out/) for codebase navigation, plus a PreToolUse hook that nudges toward graphify query over raw grep. Also removes the stale BootstrapKmp exclude pattern from the Detekt default config, a leftover template artifact with no matching class in this codebase.
The post-commit graphify hook auto-rebuilt the graph after the prior commit, picking up a graphify version bump (v0.9.33 -> v0.9.49-s2) that forced a full re-extraction (2522->2584 nodes, 212->222 communities). That rebuild path is AST-only (no LLM), so it fell back to naming communities after their hub node instead of the curated plain-language names. Re-labels all 222 communities and regenerates GRAPH_REPORT.md, graph.html, and the labels/.sig sidecar accordingly.
Replaces the bespoke mocks.json format with one OpenAPI 3.x document (JSON, YAML best-effort via kaml) per API group, across all three networkmock modules plus the sample app. No intermediate state in this diff compiles independently - the core model change, its consumers, and the sample's registration call all have to move together. ## Core engine (devview-networkmock-core) The environment axis is gone entirely - a group's request-matching hosts now come from the spec's servers[] list, so an app talking to two hosts for the same API is just two operations with different paths in one document, not two environments. Renamed to OpenAPI vocabulary: ApiGroupConfig -> ApiSpec, EndpointConfig -> Operation, EndpointKey -> OperationKey (drops environmentId), EndpointDescriptor -> OperationDescriptor, EndpointMockState -> OperationMockState. MockResponse and MockMatch are deliberately not renamed - they model DevView's own runtime mocking behavior, not something OpenAPI describes. EnvironmentConfig, EndpointOverride, and effectiveEndpoints are deleted outright (pre-1.0, no deprecation path). Response variant discovery now reads the spec's declared responses.<code>.content.*.examples instead of probing status-code and filename-suffix combinations against the filesystem. OperationMockState.Mock is now keyed by (statusCode, exampleName) instead of a response file name. Response delay simulation moves to the x-devview OpenAPI Specification Extension, at the document root (spec-wide default) and/or per operation (overrides the default). DataStore entries under the pre-0.2.0 key shape are wiped once on first launch after upgrading, gated by a schema version marker - the key shape and the Mock payload shape both changed at once, so a best-effort translation wasn't attempted. The new core/openapi package is the only format-aware code in the module and is entirely internal - no OpenAPI-shaped type is visible outside MockConfigRepository's implementation, which keeps a second, lower-ceremony config format cheap to add later. ## UI and Ktor plugin (devview-networkmock, devview-networkmock-ktor) Adapted to the renamed core API: GroupEnvironmentUiModel -> ApiSpecUiModel, EndpointUiModel -> OperationUiModel. Tabs are now one per spec instead of one per group+environment combination. NetworkMock's constructor takes specPaths: List<String> instead of a single configPath, with no default - integrators list every spec file explicitly. ## Sample app mocks.json is replaced by two specs (jsonplaceholder.json, sample-api.json). The old prod-environment override that rewrote getUserProfile's path between staging and prod is now a proper second operation, getUserProfileV2, sharing the same spec with two servers - the OpenAPI-native replacement for what the environment axis was really being used for. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Updates every doc page and CLAUDE.md that described the old mocks.json format, the environment axis, or the single configPath entry point: root README/CLAUDE.md/CHANGELOG, the getting-started guides, all docs/modules/networkmock*.md pages, and the add-destination skill's EndpointKey example. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Re-extracts the knowledge graph following the mocks.json -> OpenAPI 3.x migration (new openapi/ package, renamed model/UI types across three modules). AST-only rebuild via the post-commit hook, no LLM relabeling - community names may drift from their curated labels until the next `graphify label` pass. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Section.containerColor and Section.contentColor were already public API as of f050eed but api.txt was never regenerated after that commit. Caught while running metalava across the full project during the networkmock migration; no source change here, just catching the signature file up to what was already committed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
First PR of the milestone 0.2.0 OpenAPI migration (epic #72). Replaces the bespoke
mocks.jsonformat with OpenAPI 3.x (JSON, YAML best-effort via kaml), removes the environment axis entirely, and adopts OpenAPI vocabulary across the public API of all three networkmock modules.Closes #73, #74, #75, #76, #78, #94
This is the "core break" PR — see #72 for the full milestone plan. Deliberately not included here, tracked for follow-up PRs:
mocks.jsonconversion script) — last PR, since docs follow the API per this repo's documentation-hygiene ruleWhat changed
devview-networkmock-core): new internalopenapi/package (OpenApiDocument,OpenApiParser,YamlSupport) is the only format-aware code in the library — no OpenAPI-shaped type leaks pastMockConfigRepository.$ref/externalValueresolve one level deep, locally or into another file. Response variant discovery now reads declaredresponses.<code>.content.*.examplesinstead of probing status-code/suffix combinations.x-devview.delayMsreplacesdefaultDelayMs/delayMs(document-level default, operation-level override).ApiGroupConfig→ApiSpec,EndpointConfig→Operation,EndpointKey→OperationKey(dropsenvironmentId),EndpointDescriptor→OperationDescriptor,EndpointMockState→OperationMockState,GroupEnvironmentUiModel→ApiSpecUiModel,EndpointUiModel→OperationUiModel.MockResponseandMockMatchare deliberately not renamed — they model DevView's own runtime mocking behavior (a served response, a request-to-operation match), not something OpenAPI describes.EnvironmentConfig,EndpointOverride, andeffectiveEndpointsare deleted outright (pre-1.0, no deprecation path).OperationMockState.Mockis now keyed by(statusCode, exampleName)instead of a response file name. DataStore entries under the pre-0.2.0 key shape are wiped once on first launch after upgrading (gated by a schema version marker) — chose wipe over a best-effort translation since the key shape and the payload shape changed at once (see fix: prune orphaned DataStore keys after the key-shape change #78); this is disabled-by-default developer-tooling state, not user data.devview-networkmock,devview-networkmock-ktor): adapted to the renamed core API. Tabs are now one per spec instead of one per group+environment.NetworkMock's constructor takesspecPaths: List<String>instead of a singleconfigPath, with no default.mocks.jsonreplaced by two specs (jsonplaceholder.json,sample-api.json). The old prod-environment override that rewrotegetUserProfile's path between staging/prod is now a proper second operation,getUserProfileV2, in the same spec with two servers — the OpenAPI-native replacement for what the environment axis was actually being used for.docs/modules/networkmock*.mdpages, and theadd-destinationskill's example.Test plan
testAndroidHostTestgreen indevview-networkmock-core,devview-networkmock,devview-networkmock-ktordetektFullandkonsist:testgreen across the repometalavaGenerateSignatureregenerated for all three networkmock modules (devview-networkmock-ktor's public surface was unaffected)devview-networkmock-corecross-compiles foriosArm64andiosSimulatorArm64— verifies kaml (YAML support) works on iOS, not just JVMsample:androidApp:assembleDebugsucceeds end-to-end against the new spec filesgetUserProfile/getUserProfileV2both listed, mock toggling works, delays applyCo-Authored-By: Claude Sonnet 5 noreply@anthropic.com