mirror of
https://github.com/encounter/JSONAPI.git
synced 2026-03-30 11:18:38 -07:00
Add support for 'const' via OpenAPI 3.0 workaround suggested by others: Use 'enum' with one value. Add Sampleable support for requesting samples representing 'success' and 'failure' if available.
This commit is contained in:
@@ -15,6 +15,20 @@ public protocol Sampleable {
|
||||
/// same value every time, or it can be an arbitrarily random
|
||||
/// value each time.
|
||||
static var sample: Self { get }
|
||||
|
||||
/// Get an example of success, if that is meaningful and
|
||||
/// available. If not, will be nil.
|
||||
static var successSample: Self? { get }
|
||||
|
||||
/// Get an example of failure, if that is meaningful and
|
||||
/// available. If not, will be nil.
|
||||
static var failureSample: Self? { get }
|
||||
}
|
||||
|
||||
public extension Sampleable {
|
||||
public static var successSample: Self? { return nil }
|
||||
|
||||
public static var failureSample: Self? { return nil }
|
||||
}
|
||||
|
||||
extension Sampleable {
|
||||
|
||||
Reference in New Issue
Block a user