fill out some of the relationship tests

This commit is contained in:
Mathew Polzin
2019-01-14 23:14:25 -08:00
parent a9e1e49a79
commit 3c29244540
3 changed files with 260 additions and 8 deletions
@@ -7,21 +7,33 @@
import JSONAPI
private protocol _Optional {}
extension Optional: _Optional {}
extension Attribute: OpenAPINodeType where RawValue: OpenAPINodeType {
static public var openAPINode: OpenAPI.JSONNode {
// If the RawValue is not required, we actually consider it
// nullable. To be not required is for the Attribute itself
// to be optional.
if !RawValue.openAPINode.required {
return RawValue.openAPINode.requiredNode().nullableNode()
}
return RawValue.openAPINode
}
}
extension TransformedAttribute: OpenAPINodeType where RawValue: OpenAPINodeType {
static public var openAPINode: OpenAPI.JSONNode {
// If the RawValue is not required, we actually consider it
// nullable. To be not required is for the Attribute itself
// to be optional.
if !RawValue.openAPINode.required {
return RawValue.openAPINode.requiredNode().nullableNode()
}
return RawValue.openAPINode
}
}
private protocol _Optional {}
extension Optional: _Optional {}
extension ToOneRelationship: OpenAPINodeType {
// TODO: const for json `type`
static public var openAPINode: OpenAPI.JSONNode {