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:
Mathew Polzin
2019-01-21 22:47:03 -08:00
parent 95f9d8084d
commit 5433dddc81
6 changed files with 57 additions and 13 deletions
+14
View File
@@ -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 {