Skip to content

Commit f85d064

Browse files
committed
Add convenience checks for which case a Parameter.Location is in
1 parent 215a7ad commit f85d064

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Sources/OpenAPIKit/Path Item/Parameter.swift

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ extension OpenAPI.PathItem.Parameter {
6161
public static var header: Location { return .header(required: false) }
6262

6363
public static var cookie: Location { return .cookie(required: false) }
64+
65+
public var isQuery: Bool {
66+
guard case .query = self else {
67+
return false
68+
}
69+
return true
70+
}
71+
72+
public var isHeader: Bool {
73+
guard case .header = self else {
74+
return false
75+
}
76+
return true
77+
}
78+
79+
public var isPath: Bool { return self == .path }
80+
81+
public var isCookie: Bool {
82+
guard case .cookie = self else {
83+
return false
84+
}
85+
return true
86+
}
6487
}
6588
}
6689

0 commit comments

Comments
 (0)