Skip to content

Commit 1628584

Browse files
authored
add form content body (#32)
1 parent 22a8ca4 commit 1628584

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//
2+
// File.swift
3+
//
4+
// Created by gerp83 on 28/08/2024
5+
//
6+
7+
import OpenAPIKit
8+
9+
public protocol FormBody: RequestBody {
10+
static var description: String { get }
11+
static var schema: Schema.Type { get }
12+
static var required: Bool { get }
13+
}
14+
15+
public extension FormBody {
16+
17+
static var required: Bool { true }
18+
19+
static func openAPIRequestBody() -> OpenAPI.Request {
20+
.init(
21+
description: description,
22+
content: [
23+
.form: schema.reference()
24+
],
25+
required: required
26+
)
27+
}
28+
}

0 commit comments

Comments
 (0)