-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExampleDocument.swift
More file actions
58 lines (48 loc) · 1.49 KB
/
ExampleDocument.swift
File metadata and controls
58 lines (48 loc) · 1.49 KB
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
//
// ExampleDocument.swift
// feather-openapi
//
// Created by Tibor Bödecs on 2026. 01. 25..
import FeatherOpenAPI
import OpenAPIKit30
struct ExampleLocation: LocationRepresentable {
let location: String
}
struct ExampleContact: ContactRepresentable {
var name: String? { "Binary Birds" }
var url: LocationRepresentable? {
ExampleLocation(location: "https://binarybirds.com")
}
var email: String? { "info@binarybirds.com" }
}
struct ExampleInfo: InfoRepresentable {
var title: String { "Example" }
var description: String? {
"""
Example API description
"""
}
var contact: OpenAPIContactRepresentable? { ExampleContact() }
var version: String { "1.0.0" }
}
struct ExampleServer: ServerRepresentable {
var url: LocationRepresentable {
ExampleLocation(location: "http://localhost:8080")
}
var description: String? { "dev" }
}
struct ExamplePathCollection: PathCollectionRepresentable {
var pathMap: PathMap {
[
"/example/models": Example.Model.MainPathItem(),
"/example/models/{id}": Example.Model.IdentifiedPathItem(),
]
}
}
struct ExampleDocument: DocumentRepresentable {
let collection = ExamplePathCollection()
var info: OpenAPIInfoRepresentable { ExampleInfo() }
var servers: [OpenAPIServerRepresentable] { [ExampleServer()] }
var paths: PathMap { collection.pathMap }
var components: OpenAPIComponentsRepresentable { collection.components }
}