Skip to content

Unified Interface Modelを最小限で定義 - #6

Merged
ningenMe merged 8 commits into
mainfrom
worktree-define-unified-api-model
Aug 17, 2026
Merged

ningenMe merged 8 commits into
mainfrom
worktree-define-unified-api-model

Conversation

@ningenMe

@ningenMe ningenMe commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • issue/004を実装。src/core/model.ts に最小限の型を追加
  • レビュー指摘を受けて設計を作り込みすぎない方針に変更した。当初は schema の再帰union + 名前付きref解決、UnifiedInterfaceModelラッパー(service含む)まで作っていたが、parserもUIもまだ無い段階でそこまでやるのは過剰と判断し、使う側が無いものは全部削除
  • 最終的に残したのは InterfaceOperation { id, action, target, description?, deprecated? } のみ
  • method/pathではなくaction/targetという命名だけは残した。単なる命名でOpenAPI以外のprotocol(gRPC/GraphQL/AsyncAPI)でも「動詞的な軸」「対象の軸」に分解できることは検証済みのため
  • parameters・request body・response・schema・enum・examples、UnifiedInterfaceModelラッパー(schemasなど)は型を定義せず、005(parser実装)・008(詳細画面実装)で実データを見ながら育てる

Test plan

  • npm run build(型チェック)
  • npm test
  • npm run format:check

Implements issue/004: src/core/model.ts, a protocol-agnostic
representation of an API surface (service, operations with
method/path/parameters/requestBody/responses, and a named schemas
map for reused/ref'd types). UI and later parsers depend only on
this shape, never on OpenAPI's own types.

$ref targets are kept as named entries in schemas and pointed to via
{ type: "ref", name } rather than inlined everywhere, mirroring
OpenAPI's components/schemas, so the UI can show/reuse named types.

issue/004 documents the design rationale and a worked OpenAPI ->
model mapping example covering every element the task called for
(method, path, description, parameters, request body, response,
schema, enum, examples, deprecated). Verified: npm run build, npm
test, npm run format:check.
Validate the model against every protocol issue #1 lists (gRPC,
GraphQL, AsyncAPI/Kafka, standalone JSON Schema) in
docs/unified-interface-model.md before locking in field names —
merging InterfaceOperation with OpenAPI-only method/path fields
would have meant a guaranteed breaking rename the moment a second
protocol parser landed.

Renames UnifiedApiModel -> UnifiedInterfaceModel and drops the "Api"
prefix throughout (InterfaceOperation, InterfaceParameter, etc.).
Replaces the required method/path pair with action/target, which
holds up across all four protocols examined (e.g. AsyncAPI: action
"PUBLISH", target the channel name). InterfaceResponse.status
becomes optional since gRPC/GraphQL/AsyncAPI don't have OpenAPI's
per-status-code response concept.

Parameter "in" locations and the shape of requestBody/responses stay
REST-shaped for now — those get extended when an actual second
parser is implemented, not guessed at here. Propagates the renamed
terminology through README and the other issue/*.md files that
mentioned "Unified API Model". Verified: npm run build, npm test,
npm run format:check.
@ningenMe ningenMe changed the title Unified API Modelを設計 Unified Interface Modelを設計 Aug 16, 2026
Other agents implement against this doc and humans read it to
understand the model; narrating the validation process ("検証した",
"確認できたため") gets in the way of that. State the mapping as
settled fact instead.
Comment thread src/core/model.ts Outdated
@@ -0,0 +1,54 @@
// Protocol-to-model mapping is validated in docs/unified-interface-model.md before changing this shape.
export interface UnifiedInterfaceModel {
service: string;

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このserviceって何?

Comment thread src/core/model.ts Outdated
deprecated?: boolean;
parameters: InterfaceParameter[];
requestBody?: InterfaceRequestBody;
responses: InterfaceResponse[];

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

summaryとか最初不要なような、yagniにしよう。もっとスリムに。

Review feedback: designing a recursive schema union, named-ref
resolution, and a cross-protocol action/target generalization before
any parser or UI exists is over-engineering. None of it has been
exercised against real code yet, so it's likely to be wrong in ways
that only show up once 005 (parser) and 008 (detail view) actually
need these fields.

Reverts to a minimal UnifiedInterfaceModel/InterfaceOperation with
just service/id/method/path/description/deprecated. Parameters,
request body, response, schema, enum, and examples are deliberately
left undefined until the tasks that need them (005, 008, ...) grow
the type against real data. Drops docs/unified-interface-model.md,
which validated the now-reverted action/target design; it can be
rewritten once a second protocol parser is actually underway.
@ningenMe ningenMe changed the title Unified Interface Modelを設計 Unified Interface Modelを最小限で定義 Aug 16, 2026
Nothing parses into it or reads it yet, and its meaning wasn't
settled (service name? source name? application name?). Grouping a
parsed model with the sources.yaml entry it came from belongs to
006-implement-source-registration, not baked into the model itself.
Rolling everything about the earlier design back to method/path left
issue/004's decision log arguing for action/target while the code
used method/path — a naming choice that costs nothing extra and was
already validated across OpenAPI/gRPC/GraphQL/AsyncAPI shouldn't have
been swept up in the "don't over-build" rollback along with the
actually-complex parts (schema unions, ref resolution).
With only one field (operations), the wrapper was identical to
InterfaceOperation[] in practice — no parser or site-generation code
exists yet to say whether it needs to be anything more than that.
Bring the wrapper back once a second top-level field (e.g. schemas)
is actually needed.
README doesn't need to mirror core/model.ts's exact current shape —
that's what issue/004's decision log is for. Point there instead of
restating field names that just went through three rounds of
churn, and describe the directory by what's actually in it
(InterfaceOperation) rather than a wrapper type that no longer
exists.
@ningenMe
ningenMe merged commit ab40778 into main Aug 17, 2026
1 check passed
@ningenMe
ningenMe deleted the worktree-define-unified-api-model branch August 17, 2026 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant