1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//! JSON Schema generation for Ferry Remote Build Protocol v1.
use schemars::{JsonSchema, schema_for};
use crate::{
ArtifactDownloadRequest, ArtifactDownloadResult, ArtifactListRequest, ArtifactManifest,
CancellationAck, CancellationRequest, CleanupConfirmation, CleanupRequest, CompileHandoff,
CompilePhaseEvidence, EventPage, EventRequest, GitSnapshotDescriptor, HandshakeRequest,
HandshakeResponse, IosDeviceBuildRequest, IosDeviceBuildResult, JobHandle,
ProviderDoctorReport, ProviderDoctorRequest, RemoteBuildEvent, SealedUnsignedArchive,
SnapshotArtifactDescriptor, SnapshotArtifactReceipt, SnapshotBuildComplete, SnapshotBuildStart,
SnapshotJobAccepted, SnapshotSessionError, SourceBundleDescriptor,
};
/// Every standalone document exchanged or persisted by protocol v1.
///
/// The generated schema is a catalog expressed as `anyOf`; transport operations still determine
/// which concrete document is valid at each boundary.
#[derive(JsonSchema)]
#[schemars(title = "Ferry Remote Build Protocol v1", untagged)]
#[allow(clippy::large_enum_variant)]
pub enum RemoteProtocolV1Document {
/// Client-to-provider compatibility request.
HandshakeRequest(HandshakeRequest),
/// Provider-to-client compatibility response.
HandshakeResponse(HandshakeResponse),
/// Client-to-provider readiness request.
ProviderDoctorRequest(ProviderDoctorRequest),
/// Provider-to-client readiness report.
ProviderDoctorReport(ProviderDoctorReport),
/// Declarative physical-iPhone build request.
IosDeviceBuildRequest(IosDeviceBuildRequest),
/// Complete public compile-to-sign handoff.
CompileHandoff(CompileHandoff),
/// Initial declaration for one SSH snapshot session.
SnapshotBuildStart(SnapshotBuildStart),
/// Separately framed deterministic source descriptor.
SourceBundleDescriptor(SourceBundleDescriptor),
/// Operation-bound descriptor for one GitHub dirty-source snapshot.
GitSnapshotDescriptor(GitSnapshotDescriptor),
/// Worker acknowledgement for one snapshot job.
SnapshotJobAccepted(SnapshotJobAccepted),
/// Unsigned archive descriptor and compile evidence.
SnapshotArtifactDescriptor(SnapshotArtifactDescriptor),
/// Client proof of durable independent artifact verification.
SnapshotArtifactReceipt(SnapshotArtifactReceipt),
/// Terminal non-retaining snapshot cleanup proof.
SnapshotBuildComplete(SnapshotBuildComplete),
/// Secret-free terminal snapshot failure.
SnapshotSessionError(SnapshotSessionError),
/// Public credential-free compile evidence.
CompilePhaseEvidence(CompilePhaseEvidence),
/// Sealed unsigned archive descriptor.
SealedUnsignedArchive(SealedUnsignedArchive),
/// Accepted provider job handle.
JobHandle(JobHandle),
/// One NDJSON event envelope.
RemoteBuildEvent(RemoteBuildEvent),
/// Bounded event page.
EventPage(EventPage),
/// Event-page request.
EventRequest(EventRequest),
/// Cancellation request.
CancellationRequest(CancellationRequest),
/// Cancellation acknowledgement.
CancellationAck(CancellationAck),
/// Artifact-list request.
ArtifactListRequest(ArtifactListRequest),
/// Artifact download request.
ArtifactDownloadRequest(ArtifactDownloadRequest),
/// Verified artifact download result.
ArtifactDownloadResult(ArtifactDownloadResult),
/// Provider cleanup request.
CleanupRequest(CleanupRequest),
/// Provider cleanup proof.
CleanupConfirmation(CleanupConfirmation),
/// Terminal build result.
IosDeviceBuildResult(IosDeviceBuildResult),
/// Persisted artifact provenance and integrity manifest.
ArtifactManifest(ArtifactManifest),
}
/// Generate deterministic pretty-printed JSON Schema for protocol v1.
///
/// # Errors
///
/// Returns a serialization error if the in-memory schema cannot be encoded as JSON.
pub fn protocol_v1_schema_json() -> Result<String, serde_json::Error> {
let mut json = serde_json::to_string_pretty(&schema_for!(RemoteProtocolV1Document))?;
json.push('\n');
Ok(json)
}