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
use bytes::{Bytes, BytesMut};
use indexmap::IndexMap;
use crate::{
openapi::{MediaType, Operation, RequestBody, Response},
operation::set_body,
OperationInput, OperationOutput,
};
impl OperationInput for Bytes {
fn operation_input(
ctx: &mut crate::gen::GenContext,
operation: &mut crate::openapi::Operation,
) {
set_body(
ctx,
operation,
RequestBody {
description: None,
content: IndexMap::from_iter([(
"application/octet-stream".into(),
MediaType::default(),
)]),
required: true,
extensions: IndexMap::default(),
},
);
}
}
impl OperationInput for BytesMut {
fn operation_input(
ctx: &mut crate::gen::GenContext,
operation: &mut crate::openapi::Operation,
) {
Bytes::operation_input(ctx, operation);
}
}
impl OperationOutput for Bytes {
type Inner = Self;
fn operation_response(
_ctx: &mut crate::gen::GenContext,
_operation: &mut Operation,
) -> Option<crate::openapi::Response> {
Some(Response {
description: "byte stream".into(),
content: IndexMap::from_iter([(
"application/octet-stream".into(),
MediaType::default(),
)]),
..Default::default()
})
}
}
impl OperationOutput for BytesMut {
type Inner = Self;
fn operation_response(
ctx: &mut crate::gen::GenContext,
operation: &mut Operation,
) -> Option<crate::openapi::Response> {
Bytes::operation_response(ctx, operation)
}
}