-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatherOpenAPITestSuite.swift
More file actions
69 lines (54 loc) · 1.64 KB
/
FeatherOpenAPITestSuite.swift
File metadata and controls
69 lines (54 loc) · 1.64 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
59
60
61
62
63
64
65
66
67
68
69
//
// FeatherOpenAPITestSuite.swift
// feather-openapi
//
// Created by Tibor Bödecs on 2026. 02. 05..
//
import OpenAPIKit
import OpenAPIKit30
import OpenAPIKitCompat
import Testing
import Yams
@testable import FeatherOpenAPI
@Suite
struct FeatherOpenAPITestSuite {
@Test
func documentDeduplicatesTagsByName() {
let document = TagDedupDocument(
info: TagDedupInfo(),
paths: TagDedupPaths().pathMap,
components: Components()
)
let openAPIDoc = document.openAPIDocument()
let tags = openAPIDoc.tags ?? []
#expect(tags.map(\.name) == ["Dogs"])
}
@Test
func multipleVersions() throws {
let collection = MyPathCollection()
// collection.components.schemas.register(id: "", TodoFieldId())
let document = MyDocument(
info: MyInfo(),
paths: collection.pathMap,
components: collection.components,
)
let openAPIdoc = document.openAPIDocument()
let encoder = YAMLEncoder()
_ =
try openAPIdoc
.locallyDereferenced()
.resolved()
let result = try encoder.encode(openAPIdoc)
print("---- 3.0 ----")
print(result)
// let doc31 = openAPIdoc.convert(to: .v3_1_0)
// let result31 = try encoder.encode(doc31)
// print("---- 3.1 ----")
// print(result31)
//
// let doc32 = openAPIdoc.convert(to: .v3_2_0)
// let result32 = try encoder.encode(doc32)
// print("---- 3.2 ----")
// print(result32)
}
}