- src/adapters/forward.rs: shared HTTP forwarding core (extracted from old from_openapi) — HttpServiceConfig/HttpAuthScheme, build_request with capabilities-based credential injection (no env vars), forward + forward_stream (SSE projection), parse_sse_frames - src/adapters/from_jsonschema.rs: FromJsonSchema OperationAdapter (ADR-066) — one registration per call, FromJsonSchema provenance (leaf, Internal default), Sub -> HandlerKind::Stream (text/event-stream) - adapted to alkcall 0.1.1: OperationType::Sub, alkcall::client adapter traits Verified: cargo test (106 lib tests), clippy -D warnings, fmt.
2.3 KiB
id, name, status, depends_on, scope, risk, impact, level, tags
| id | name | status | depends_on | scope | risk | impact | level | tags | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| adapter-from-jsonschema | from_jsonschema single-endpoint adapter | completed |
|
narrow | low | component | implementation |
|
Description
Port adapters/from_jsonschema.rs from
/workspace/@alkdev/alknet/crates/alknet-http/src/adapters/from_jsonschema.rs
per ADR-066: caller supplies OperationSpec + HttpServiceConfig + path
template + method; one HandlerRegistration with a reqwest forwarding
handler (same shape as from_openapi's), FromJsonSchema provenance
(leaf, Internal default). Sub op type → StreamingHandler expecting
text/event-stream. Shares the forwarding-handler code path with
from_openapi.
Acceptance Criteria
- Adapter ported; one registration per call, correct provenance
- Forwarding round-trip test against a local mock server
cargo testpasses
References
- docs/architecture/decisions/066-from-jsonschema-as-http-adapter.md
- docs/architecture/http-adapters.md (§from_jsonschema)
- alkcall ADR-027 (FromJsonSchema provenance)
Notes
Agent fills during implementation.
Summary
Ported src/adapters/from_jsonschema.rs per ADR-066, plus the shared
forwarding core it depends on:
src/adapters/forward.rs: extracted from old from_openapi — HttpServiceConfig/HttpAuthScheme, build_request (path templates, query split, body key, credential injection from OperationContext.capabilities), forward (2xx -> JSON/text/bytes envelope; non-2xx -> declared code or HTTP_), forward_stream (SSE -> ResponseEnvelope stream, ADR-049), parse_sse_frames. Pre-positions the from_openapi port to reuse the same core.src/adapters/from_jsonschema.rs: FromJsonSchema OperationAdapter — one HandlerRegistration per call (spec + path template + method), FromJsonSchema provenance (leaf, composition_authority None, scoped_env None, Internal default), Sub op type -> HandlerKind::Stream expecting text/event-stream.
Adaptations for alkcall 0.1.1: OperationType::Sub (not Subscription), adapter imports via alkcall::client::{AdapterError, OperationAdapter}.
11 tests: registration shape, handler kinds (Query/Sub/Mutation), build_request bearer-from-capabilities + path/query split, forwarding round-trip vs local mock server (200/404/500), SSE subscription stream, no-env-vars invariant. 106 lib tests green.