Plan updated with the alknet-tty findings: the drainer pattern (single ordered writer) makes outbound chunk-boundary parsing sound; TestStdinSink's try_send→Full→Pending is the inbound backpressure precedent; OQ-01(a) now cites the reference. Task graph (taskgraph-validated, 17 tasks, 6 generations, no cycles): - tasks/server/: core-types, auth, healthz-decoy, adapter - tasks/gateway/: dispatch, routes, publish - tasks/websocket/: byte-adapter (research POC), upgrade-session, overlay-ops - tasks/adapters/: from-openapi, from-jsonschema, to-openapi, from-wss, mcp - tasks/client/: http-host - tasks/infra/: integration-suite (phase 4) Critical path runs through server core → adapter → WS session → overlay tests → integration suite. High-risk tasks are the three WS tasks, de-risked by the ws-byte-adapter POC blocking upgrade-session.
47 lines
1.7 KiB
Markdown
47 lines
1.7 KiB
Markdown
---
|
|
id: adapter-from-openapi
|
|
name: from_openapi adapter (parse + forwarding handlers)
|
|
status: pending
|
|
depends_on: [client-http-host]
|
|
scope: broad
|
|
risk: medium
|
|
impact: component
|
|
level: implementation
|
|
tags: [adapters, phase-3]
|
|
---
|
|
|
|
## Description
|
|
|
|
Port `adapters/from_openapi.rs` (~2k lines, the largest port) from
|
|
`/workspace/@alkdev/alknet/crates/alknet-http/src/adapters/from_openapi.rs`:
|
|
OpenAPISpec (from_json/from_yaml/from_str JSON-first per ADR-051,
|
|
from_value), $ref resolution, HttpServiceConfig, per-op
|
|
HandlerRegistration construction (Internal by default, FromOpenAPI
|
|
leaf provenance), forwarding handlers (path-template substitution,
|
|
query params, auth header from capabilities, content-type branching),
|
|
SSE→StreamingHandler for Sub ops (HandlerKind::Stream), error fidelity
|
|
(`HTTP_<status>` codes). Type paths move to alkcall::client (adapter
|
|
contract) and alkcall::registry.
|
|
|
|
## Acceptance Criteria
|
|
|
|
- [ ] JSON + YAML + from_str detection ports with tests
|
|
- [ ] Handler construction: Query/Mutation→Once, Sub→Stream; Pub never produced (v1)
|
|
- [ ] Forwarding: path params, query params, auth injection from Capabilities, error mapping — unit tested (mock HTTP via local axum server)
|
|
- [ ] No env-var reads
|
|
- [ ] `cargo test` passes
|
|
|
|
## References
|
|
|
|
- docs/architecture/http-adapters.md (§from_openapi, §Forwarding handler, §Error Fidelity)
|
|
- docs/architecture/decisions/023-operation-error-schemas.md, 051-yaml-input-for-from-openapi.md
|
|
- Old source: `/workspace/@alkdev/alknet/crates/alknet-http/src/adapters/from_openapi.rs`
|
|
|
|
## Notes
|
|
|
|
> Agent fills during implementation. Largest single port — consider
|
|
> splitting internally (parse half / handler half) if review flags it.
|
|
|
|
## Summary
|
|
|
|
> Agent fills on completion. |