Skip to content

Commit 215a7ad

Browse files
committed
Expose Parameter.Location's required property on the Parameter struct
1 parent f8c252a commit 215a7ad

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Sources/OpenAPIKit/Path Item/Parameter.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ extension OpenAPI.PathItem {
3131
self.description = description
3232
self.deprecated = deprecated
3333
}
34+
35+
public var required: Bool {
36+
switch parameterLocation {
37+
case .query(required: let required, allowEmptyValue: _),
38+
.header(required: let required),
39+
.cookie(required: let required):
40+
return required
41+
case .path:
42+
return true
43+
}
44+
}
3445
}
3546
}
3647

0 commit comments

Comments
 (0)