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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//! The escape hatches, and what using one costs.
//!
//! `unchecked` is not in the `full` feature and never will be:
//!
//! ```text
//! cargo run -p kynos --example unchecked --features unchecked
//! ```
//!
//! Everything in this file is a documented anti-pattern. It exists because a
//! framework that says "no" without saying "and here is the door" gets
//! forked — but the door is where the guarantee ends, so it is deliberately
//! visible from both sides.
//!
//! Three things are worth noticing:
//!
//! * **Nothing is dropped silently.** An opaque route is recorded under
//! `x-kynos-opaque-routes`, an untyped layer flags every operation beneath
//! it, and the document as a whole is stamped
//! `x-kynos-document-not-authoritative`. A consumer reading the description
//! can see exactly where it stops being true.
//! * **`has_unchecked` is the check a build should make.** It is what a CI job
//! asserts is false, or what a team allows deliberately with a comment. The
//! escape hatch is a decision, and this is where the decision is recorded.
//! * **Two of the three are not temporary gaps.** A catch-all has no path
//! template that is true of it, and a connection upgraded away from HTTP is
//! outside what any version of OpenAPI can express. `AsyncAPI` covers the
//! second, and Kynos would rather point at it than pretend.
//!
//! `layer_unchecked` *is* a gap worth closing, and the remedy is barely more
//! work: an `Interceptor` names the responses it can answer with and the
//! headers it adds as associated types, and every covered operation is
//! documented correctly and automatically. See
//! [`middleware.rs`](middleware.rs).
use Ipv4Addr;
use ;
use ;
/// A user of the service.
/// Lists users.
///
/// An ordinary operation, fully described. It shares a router with the
/// undescribed ones below, and its own `paths` entry stays exactly as complete
/// as it would be alone — the stamp is on the document, not on this.
async
/// Serves a file out of a directory tree.
///
/// The path is `/assets/{*path}`, which has no OpenAPI equivalent: a path
/// parameter value must not contain an unescaped `/`, so no template is true of
/// it and every key that could be minted would be a claim the service does not
/// honour.
///
/// For anything past a handful of files a reverse proxy or a CDN is the better
/// answer, and leaves the description intact.
///
/// The signature is the blanket implementation's: any
/// `async fn(Request) -> Response`. No extractor, no `Describe` -- which is
/// precisely what makes it undescribable, and why the door is separate.
async
/// Upgrades a connection to a WebSocket.
///
/// Not a gap that will close. OpenAPI describes HTTP request and response
/// semantics, and a socket that stops being either is outside what the
/// specification models at any version.
async
async