pull method
Fetches a schema via introspection and persists both artifacts.
endpoint is required unless a transport is injected (tests and
fixture-driven flows). Nothing is written until the fetch AND the
schema parse both succeed — no partial artifacts on failure (US-1
scenario 3).
Implementation
Future<CachedSchema> pull(
String name, {
Uri? endpoint,
Map<String, String>? headers,
IntrospectionTransport? transport,
}) async {
if (endpoint == null && transport == null) {
throw SchemaCacheError(
"Cannot pull schema '$name': provide --endpoint (or a transport).",
);
}
final client = IntrospectionClient(transport: transport);
final data = await client.fetch(
endpoint ?? Uri.parse('fixture://$name'),
headers: headers,
);
return _persist(name, data);
}