Skip to content

Commit

Permalink
Expose Parameter.Location's required property on the Parameter struct
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpolzin committed Oct 9, 2019
1 parent f8c252a commit 215a7ad
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Sources/OpenAPIKit/Path Item/Parameter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ extension OpenAPI.PathItem {
self.description = description
self.deprecated = deprecated
}

public var required: Bool {
switch parameterLocation {
case .query(required: let required, allowEmptyValue: _),
.header(required: let required),
.cookie(required: let required):
return required
case .path:
return true
}
}
}
}

Expand Down

0 comments on commit 215a7ad

Please sign in to comment.