File tree 2 files changed +7
-1
lines changed
Sources/OpenAPIKitCore/Shared
Tests/OpenAPIKitTests/Path Item
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ extension Shared {
28
28
}
29
29
30
30
public var rawValue : String {
31
+ if components. isEmpty {
32
+ return " / "
33
+ }
34
+
31
35
let path =
32
36
" / \( components. joined ( separator: " / " ) ) "
33
37
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ final class PathItemTests: XCTestCase {
17
17
let t5 : OpenAPI . Path = " hello/world "
18
18
let t6 : OpenAPI . Path = " hello/world/ "
19
19
let t7 = OpenAPI . Path ( [ " hello " , " world " ] , trailingSlash: true )
20
-
20
+ let t8 = OpenAPI . Path ( rawValue: " / " )
21
+
21
22
XCTAssertEqual ( t1, t2)
22
23
XCTAssertEqual ( t2, t3)
23
24
XCTAssertEqual ( t3, t4)
@@ -31,6 +32,7 @@ final class PathItemTests: XCTestCase {
31
32
XCTAssertEqual ( t4. rawValue, " /hello/world " )
32
33
XCTAssertEqual ( t5. rawValue, " /hello/world " )
33
34
XCTAssertEqual ( t6. rawValue, " /hello/world/ " )
35
+ XCTAssertEqual ( t8. rawValue, " / " )
34
36
}
35
37
36
38
func test_initializePathItem( ) {
You can’t perform that action at this time.
0 commit comments