File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Sources/OpenAPIKitCore/Shared
Tests/OpenAPIKitTests/Path Item Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ extension Shared {
2828 }
2929
3030 public var rawValue : String {
31+ if components. isEmpty {
32+ return " / "
33+ }
34+
3135 let path =
3236 " / \( components. joined ( separator: " / " ) ) "
3337
Original file line number Diff line number Diff line change @@ -17,7 +17,8 @@ final class PathItemTests: XCTestCase {
1717 let t5 : OpenAPI . Path = " hello/world "
1818 let t6 : OpenAPI . Path = " hello/world/ "
1919 let t7 = OpenAPI . Path ( [ " hello " , " world " ] , trailingSlash: true )
20-
20+ let t8 = OpenAPI . Path ( rawValue: " / " )
21+
2122 XCTAssertEqual ( t1, t2)
2223 XCTAssertEqual ( t2, t3)
2324 XCTAssertEqual ( t3, t4)
@@ -31,6 +32,7 @@ final class PathItemTests: XCTestCase {
3132 XCTAssertEqual ( t4. rawValue, " /hello/world " )
3233 XCTAssertEqual ( t5. rawValue, " /hello/world " )
3334 XCTAssertEqual ( t6. rawValue, " /hello/world/ " )
35+ XCTAssertEqual ( t8. rawValue, " / " )
3436 }
3537
3638 func test_initializePathItem( ) {
You can’t perform that action at this time.
0 commit comments