You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/OpenAPIKit/Document.swift
+91-12Lines changed: 91 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,11 @@ extension OpenAPI {
39
39
/// If the servers property is not provided, or is an
40
40
/// empty array, the default value is a Server Object with a url value of
41
41
/// "/".
42
+
///
43
+
/// - Important: If you want to get all servers mentioned anywhere in
44
+
/// the whole document (including servers that appear in path items
45
+
/// or operations but not at the root document level), use the
46
+
/// `allServers` property instead.
42
47
publicvarservers:[Server]
43
48
44
49
/// All routes supported by this API. This property maps the path of each
@@ -92,18 +97,6 @@ extension OpenAPI {
92
97
/// Additional external documentation.
93
98
publicvarexternalDocs:ExternalDocumentation?
94
99
95
-
/// Retrieve an array of all Operation Ids defined by
96
-
/// this API. These Ids are guaranteed to be unique by
97
-
/// the OpenAPI Specification.
98
-
///
99
-
/// See [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#operation-object) in the specifcation.
/// Retrieve an array of all Operation Ids defined by
156
+
/// this API. These Ids are guaranteed to be unique by
157
+
/// the OpenAPI Specification.
158
+
///
159
+
/// The ordering is not necessarily significant, but it will
160
+
/// be the order in which each operation is occurred within
161
+
/// each path, traversed in the order the paths appear in
162
+
/// the document.
163
+
///
164
+
/// See [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#operation-object) in the specifcation.
165
+
///
166
+
publicvarallOperationIds:[String]{
167
+
return paths.values
168
+
.flatMap{ $0.endpoints }
169
+
.compactMap{ $0.operation.operationId }
170
+
}
171
+
172
+
/// All servers referenced anywhere in the whole document.
173
+
///
174
+
/// This property contains all servers defined at any level the document
175
+
/// and therefore may or may not contain servers not found in the
176
+
/// root servers array.
177
+
///
178
+
/// The `servers` property on `OpenAPI.Document`, by contrast, contains
179
+
/// servers that are applicable to all paths and operations that
180
+
/// do not define their own `serves` array to override the root array.
181
+
///
182
+
/// - Important: For the purposes of returning one of each `Server`,
183
+
/// two servers are considered identical if they have the same `url`
184
+
/// and `variables`. Differing `description` properties for
185
+
/// otherwise identical servers are considered to be two ways to
186
+
/// describe the same server. `vendorExtensions` are also
187
+
/// ignored when determining server uniqueness.
188
+
///
189
+
/// The first `Server` encountered will be used, so if the only
190
+
/// difference between a server at the root document level and
191
+
/// one in an `Operation`'s override of the servers array is the
192
+
/// description, the description of the `Server` returned by this
193
+
/// property will be that of the root document definition.
194
+
///
195
+
publicvarallServers:[OpenAPI.Server]{
196
+
// We hash `Variable` without its
197
+
// `description` or `vendorExtensions`.
198
+
func hash(variable:OpenAPI.Server.Variable, into hasher:inoutHasher){
199
+
hasher.combine(variable.enum)
200
+
hasher.combine(variable.default)
201
+
}
202
+
203
+
// We hash `Server` without its `description` or
204
+
// `vendorExtensions`.
205
+
func hash(server:OpenAPI.Server, into hasher:inoutHasher){
/// See [OpenAPI Server Variable Object](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#server-variable-object).
0 commit comments