@@ -79,6 +79,7 @@ final class DocumentTests: XCTestCase {
7979 }
8080
8181 func test_getAllOperationIds( ) {
82+ // paths, no operation ids, no components, no webhooks
8283 let t1 = OpenAPI . Document (
8384 info: . init( title: " test " , version: " 1.0 " ) ,
8485 servers: [ ] ,
@@ -93,6 +94,7 @@ final class DocumentTests: XCTestCase {
9394
9495 XCTAssertEqual ( t1. allOperationIds, [ ] )
9596
97+ // paths, one operation id (second one nil), no components, no webhooks
9698 let t2 = OpenAPI . Document (
9799 info: . init( title: " test " , version: " 1.0 " ) ,
98100 servers: [ ] ,
@@ -107,6 +109,7 @@ final class DocumentTests: XCTestCase {
107109
108110 XCTAssertEqual ( t2. allOperationIds, [ " test " ] )
109111
112+ // paths, multiple operation ids, no components, no webhooks
110113 let t3 = OpenAPI . Document (
111114 info: . init( title: " test " , version: " 1.0 " ) ,
112115 servers: [ ] ,
@@ -121,6 +124,7 @@ final class DocumentTests: XCTestCase {
121124
122125 XCTAssertEqual ( t3. allOperationIds, [ " test " , " two " ] )
123126
127+ // paths, one operation id (first one nil), no components, no webhooks
124128 let t4 = OpenAPI . Document (
125129 info: . init( title: " test " , version: " 1.0 " ) ,
126130 servers: [ ] ,
@@ -134,6 +138,36 @@ final class DocumentTests: XCTestCase {
134138 )
135139
136140 XCTAssertEqual ( t4. allOperationIds, [ " two " ] )
141+
142+ // paths, one operation id, one component reference, no webhooks
143+ let t5 = OpenAPI . Document (
144+ info: . init( title: " test " , version: " 1.0 " ) ,
145+ servers: [ ] ,
146+ paths: [
147+ " /hello " : . init(
148+ get: . init( operationId: " test " , responses: [ : ] ) ) ,
149+ " /hello/world " : . reference( . component( named: " hello-world " ) )
150+ ] ,
151+ components: . init(
152+ pathItems: [ " hello-world " : . init( put: . init( operationId: " two " , responses: [ : ] ) ) ]
153+ )
154+ )
155+
156+ XCTAssertEqual ( t5. allOperationIds, [ " test " , " two " ] )
157+
158+ // no paths, one webhook with an operation id
159+ let t6 = OpenAPI . Document (
160+ info: . init( title: " test " , version: " 1.0 " ) ,
161+ servers: [ ] ,
162+ paths: [ : ] ,
163+ webhooks: [
164+ " /hello " : . init(
165+ get: . init( operationId: " test " , responses: [ : ] ) )
166+ ] ,
167+ components: . noComponents
168+ )
169+
170+ XCTAssertEqual ( t6. allOperationIds, [ " test " ] )
137171 }
138172
139173 func test_allServersEmpty( ) {
0 commit comments