Update linuxmain, slightly update wording and indentation on example at bottom of README.

This commit is contained in:
Mathew Polzin
2019-07-24 19:43:11 -07:00
parent c996e7447c
commit 7b5b17918c
5 changed files with 233 additions and 175 deletions
@@ -4,65 +4,66 @@ import Poly
// MARK: - Preamble (setup)
// We make String a CreatableRawIdType. This is actually done in
// Make String a CreatableRawIdType. This is actually done in
// this Playground's Entities.swift file, so it is commented out here.
/*
var GlobalStringId: Int = 0
extension String: CreatableRawIdType {
public static func unique() -> String {
GlobalStringId += 1
return String(GlobalStringId)
}
}
*/
var globalStringId: Int = 0
extension String: CreatableRawIdType {
public static func unique() -> String {
globalStringId += 1
return String(globalStringId)
}
}
*/
// We create a typealias given that we do not expect JSON:API Resource
// Create a typealias because we do not expect JSON:API Resource
// Objects for this particular API to have Metadata or Links associated
// with them. We also expect them to have String Identifiers.
typealias JSONEntity<Description: ResourceObjectDescription> = JSONAPI.ResourceObject<Description, NoMetadata, NoLinks, String>
// Similarly, we create a typealias for unidentified entities. JSON:API
// Similarly, create a typealias for unidentified entities. JSON:API
// only allows unidentified entities (i.e. no "id" field) for client
// requests that create new entities. In these situations, the server
// is expected to assign the new entity a unique ID.
typealias UnidentifiedJSONEntity<Description: ResourceObjectDescription> = JSONAPI.ResourceObject<Description, NoMetadata, NoLinks, Unidentified>
// We create typealiases given that we do not expect JSON:API Relationships
// for this particular API to have Metadata or Links associated
// with them.
// Create relationship typealiases because we do not expect
// JSON:API Relationships for this particular API to have
// Metadata or Links associated with them.
typealias ToOneRelationship<Entity: Identifiable> = JSONAPI.ToOneRelationship<Entity, NoMetadata, NoLinks>
typealias ToManyRelationship<Entity: Relatable> = JSONAPI.ToManyRelationship<Entity, NoMetadata, NoLinks>
// We create a typealias for a Document given that we do not expect
// Create a typealias for a Document because we do not expect
// JSON:API Documents for this particular API to have Metadata, Links,
// useful Errors, or a JSON:API Object (i.e. APIDescription).
// useful Errors, or an APIDescription (The *SPEC* calls this
// "API Description" the "JSON:API Object").
typealias Document<PrimaryResourceBody: JSONAPI.ResourceBody, IncludeType: JSONAPI.Include> = JSONAPI.Document<PrimaryResourceBody, NoMetadata, NoLinks, IncludeType, NoAPIDescription, UnknownJSONAPIError>
// MARK: Entity Definitions
enum AuthorDescription: ResourceObjectDescription {
public static var jsonType: String { return "authors" }
public static var jsonType: String { return "authors" }
public struct Attributes: JSONAPI.Attributes {
public let name: Attribute<String>
}
public struct Attributes: JSONAPI.Attributes {
public let name: Attribute<String>
}
public typealias Relationships = NoRelationships
public typealias Relationships = NoRelationships
}
typealias Author = JSONEntity<AuthorDescription>
enum ArticleDescription: ResourceObjectDescription {
public static var jsonType: String { return "articles" }
public static var jsonType: String { return "articles" }
public struct Attributes: JSONAPI.Attributes {
public let title: Attribute<String>
public let abstract: Attribute<String>
}
public struct Attributes: JSONAPI.Attributes {
public let title: Attribute<String>
public let abstract: Attribute<String>
}
public struct Relationships: JSONAPI.Relationships {
public let author: ToOneRelationship<Author>
}
public struct Relationships: JSONAPI.Relationships {
public let author: ToOneRelationship<Author>
}
}
typealias Article = JSONEntity<ArticleDescription>
@@ -83,38 +84,38 @@ typealias SingleArticleDocument = Document<SingleResourceBody<Article>, NoInclud
// that creates a document. Note that this document is the entirety
// of a JSON:API response body.
func articleDocument(includeAuthor: Bool) -> Either<SingleArticleDocument, SingleArticleDocumentWithIncludes> {
// Let's pretend all of this is coming from a database:
// Let's pretend all of this is coming from a database:
let authorId = Author.Identifier(rawValue: "1234")
let authorId = Author.Identifier(rawValue: "1234")
let article = Article(id: .init(rawValue: "5678"),
attributes: .init(title: .init(value: "JSON:API in Swift"),
abstract: .init(value: "Not yet written")),
relationships: .init(author: .init(id: authorId)),
meta: .none,
links: .none)
let article = Article(id: .init(rawValue: "5678"),
attributes: .init(title: .init(value: "JSON:API in Swift"),
abstract: .init(value: "Not yet written")),
relationships: .init(author: .init(id: authorId)),
meta: .none,
links: .none)
let document = SingleArticleDocument(apiDescription: .none,
body: .init(resourceObject: article),
includes: .none,
meta: .none,
links: .none)
let document = SingleArticleDocument(apiDescription: .none,
body: .init(resourceObject: article),
includes: .none,
meta: .none,
links: .none)
switch includeAuthor {
case false:
return .a(document)
switch includeAuthor {
case false:
return .init(document)
case true:
let author = Author(id: authorId,
attributes: .init(name: .init(value: "Janice Bluff")),
relationships: .none,
meta: .none,
links: .none)
case true:
let author = Author(id: authorId,
attributes: .init(name: .init(value: "Janice Bluff")),
relationships: .none,
meta: .none,
links: .none)
let includes: Includes<SingleArticleDocumentWithIncludes.Include> = .init(values: [.init(author)])
let includes: Includes<SingleArticleDocumentWithIncludes.Include> = .init(values: [.init(author)])
return .b(document.including(.init(values: [.init(author)])))
}
return .init(document.including(.init(values: [.init(author)])))
}
}
let encoder = JSONEncoder()
@@ -124,8 +125,8 @@ encoder.outputFormatting = .prettyPrinted
let responseBody = articleDocument(includeAuthor: true)
let responseData = try! encoder.encode(responseBody)
// Next step would be encoding and setting as the HTTP body of a response.
// we will just print it out instead:
// Next step would be setting the HTTP body of a response.
// We will just print it out instead:
print("-----")
print(String(data: responseData, encoding: .utf8)!)
@@ -139,31 +140,31 @@ print(String(data: otherResponseData, encoding: .utf8)!)
// MARK: - Client Pseudo-example
enum NetworkError: Swift.Error {
case serverError
case quantityMismatch
case serverError
case quantityMismatch
}
// Skipping over all the API stuff, here's a chunk of code that will
// decode a document. We will assume we have made a request for a
// single article including the author.
func docode(articleResponseData: Data) throws -> (article: Article, author: Author) {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let articleDocument = try decoder.decode(SingleArticleDocumentWithIncludes.self, from: articleResponseData)
let articleDocument = try decoder.decode(SingleArticleDocumentWithIncludes.self, from: articleResponseData)
switch articleDocument.body {
case .data(let data):
let authors = data.includes[Author.self]
switch articleDocument.body {
case .data(let data):
let authors = data.includes[Author.self]
guard authors.count == 1 else {
throw NetworkError.quantityMismatch
}
guard authors.count == 1 else {
throw NetworkError.quantityMismatch
}
return (article: data.primary.value, author: authors[0])
case .errors(let errors, meta: _, links: _):
throw NetworkError.serverError
}
return (article: data.primary.value, author: authors[0])
case .errors(let errors, meta: _, links: _):
throw NetworkError.serverError
}
}
let response = try! docode(articleResponseData: responseData)
+66 -64
View File
@@ -640,38 +640,39 @@ The following serves as a sort of pseudo-example. It skips server/client impleme
### Preamble (Setup shared by server and client)
```swift
// We make String a CreatableRawIdType.
var GlobalStringId: Int = 0
// Make String a CreatableRawIdType.
var globalStringId: Int = 0
extension String: CreatableRawIdType {
public static func unique() -> String {
GlobalStringId += 1
return String(GlobalStringId)
globalStringId += 1
return String(globalStringId)
}
}
// We create a typealias given that we do not expect JSON:API Resource
// Create a typealias because we do not expect JSON:API Resource
// Objects for this particular API to have Metadata or Links associated
// with them. We also expect them to have String Identifiers.
typealias JSONResourceObject<Description: ResourceObjectDescription> = JSONAPI.ResourceObject<Description, NoMetadata, NoLinks, String>
typealias JSONEntity<Description: ResourceObjectDescription> = JSONAPI.ResourceObject<Description, NoMetadata, NoLinks, String>
// Similarly, we create a typealias for unidentified resource objects. JSON:API
// only allows unidentified resource objects (i.e. no "id" field) for client
// requests that create new resource objects. In these situations, the server
// is expected to assign the new resource object a unique ID.
typealias UnidentifiedJSONResourceObject<Description: ResourceObjectDescription> = JSONAPI.ResourceObject<Description, NoMetadata, NoLinks, Unidentified>
// Similarly, create a typealias for unidentified entities. JSON:API
// only allows unidentified entities (i.e. no "id" field) for client
// requests that create new entities. In these situations, the server
// is expected to assign the new entity a unique ID.
typealias UnidentifiedJSONEntity<Description: ResourceObjectDescription> = JSONAPI.ResourceObject<Description, NoMetadata, NoLinks, Unidentified>
// We create typealiases given that we do not expect JSON:API Relationships
// for this particular API to have Metadata or Links associated
// with them.
typealias ToOneRelationship<ResourceObject: Identifiable> = JSONAPI.ToOneRelationship<ResourceObject, NoMetadata, NoLinks>
typealias ToManyRelationship<ResourceObject: Relatable> = JSONAPI.ToManyRelationship<ResourceObject, NoMetadata, NoLinks>
// Create relationship typealiases because we do not expect
// JSON:API Relationships for this particular API to have
// Metadata or Links associated with them.
typealias ToOneRelationship<Entity: Identifiable> = JSONAPI.ToOneRelationship<Entity, NoMetadata, NoLinks>
typealias ToManyRelationship<Entity: Relatable> = JSONAPI.ToManyRelationship<Entity, NoMetadata, NoLinks>
// We create a typealias for a Document given that we do not expect
// Create a typealias for a Document because we do not expect
// JSON:API Documents for this particular API to have Metadata, Links,
// useful Errors, or a JSON:API Object (i.e. APIDescription).
// useful Errors, or an APIDescription (The *SPEC* calls this
// "API Description" the "JSON:API Object").
typealias Document<PrimaryResourceBody: JSONAPI.ResourceBody, IncludeType: JSONAPI.Include> = JSONAPI.Document<PrimaryResourceBody, NoMetadata, NoLinks, IncludeType, NoAPIDescription, UnknownJSONAPIError>
// MARK: ResourceObject Definitions
// MARK: Entity Definitions
enum AuthorDescription: ResourceObjectDescription {
public static var jsonType: String { return "authors" }
@@ -683,7 +684,7 @@ enum AuthorDescription: ResourceObjectDescription {
public typealias Relationships = NoRelationships
}
typealias Author = JSONResourceObject<AuthorDescription>
typealias Author = JSONEntity<AuthorDescription>
enum ArticleDescription: ResourceObjectDescription {
public static var jsonType: String { return "articles" }
@@ -698,7 +699,7 @@ enum ArticleDescription: ResourceObjectDescription {
}
}
typealias Article = JSONResourceObject<ArticleDescription>
typealias Article = JSONEntity<ArticleDescription>
// MARK: Document Definitions
@@ -707,47 +708,48 @@ typealias Article = JSONResourceObject<ArticleDescription>
typealias SingleArticleDocumentWithIncludes = Document<SingleResourceBody<Article>, Include1<Author>>
// ... and a typealias to represent a document containing one Article and
// not including any related resource objects.
// not including any related entities.
typealias SingleArticleDocument = Document<SingleResourceBody<Article>, NoIncludes>
```
### Server Pseudo-example
```swift
// Skipping over all the API and database stuff, here's a chunk of code
// that creates a document. Note that this document is the entirety
// of a JSON:API response body.
func articleDocument(includeAuthor: Bool) -> Either<SingleArticleDocument, SingleArticleDocumentWithIncludes> {
// Let's pretend all of this is coming from a database:
// Let's pretend all of this is coming from a database:
let authorId = Author.Identifier(rawValue: "1234")
let authorId = Author.Identifier(rawValue: "1234")
let article = Article(id: .init(rawValue: "5678"),
attributes: .init(title: .init(value: "JSON:API in Swift"),
abstract: .init(value: "Not yet written")),
relationships: .init(author: .init(id: authorId)),
meta: .none,
links: .none)
let article = Article(id: .init(rawValue: "5678"),
attributes: .init(title: .init(value: "JSON:API in Swift"),
abstract: .init(value: "Not yet written")),
relationships: .init(author: .init(id: authorId)),
meta: .none,
links: .none)
let document = SingleArticleDocument(apiDescription: .none,
body: .init(resourceObject: article),
includes: .none,
meta: .none,
links: .none)
let document = SingleArticleDocument(apiDescription: .none,
body: .init(resourceObject: article),
includes: .none,
meta: .none,
links: .none)
switch includeAuthor {
case false:
return .a(document)
switch includeAuthor {
case false:
return .init(document)
case true:
let author = Author(id: authorId,
attributes: .init(name: .init(value: "Janice Bluff")),
relationships: .none,
meta: .none,
links: .none)
case true:
let author = Author(id: authorId,
attributes: .init(name: .init(value: "Janice Bluff")),
relationships: .none,
meta: .none,
links: .none)
let includes: Includes<SingleArticleDocumentWithIncludes.Include> = .init(values: [.init(author)])
let includes: Includes<SingleArticleDocumentWithIncludes.Include> = .init(values: [.init(author)])
return .b(document.including(.init(values: [.init(author)])))
}
return .init(document.including(.init(values: [.init(author)])))
}
}
let encoder = JSONEncoder()
@@ -757,8 +759,8 @@ encoder.outputFormatting = .prettyPrinted
let responseBody = articleDocument(includeAuthor: true)
let responseData = try! encoder.encode(responseBody)
// Next step would be encoding and setting as the HTTP body of a response.
// we will just print it out instead:
// Next step would be setting the HTTP body of a response.
// We will just print it out instead:
print("-----")
print(String(data: responseData, encoding: .utf8)!)
@@ -773,31 +775,31 @@ print(String(data: otherResponseData, encoding: .utf8)!)
### Client Pseudo-example
```swift
enum NetworkError: Swift.Error {
case serverError
case quantityMismatch
case serverError
case quantityMismatch
}
// Skipping over all the API stuff, here's a chunk of code that will
// decode a document. We will assume we have made a request for a
// single article including the author.
func docode(articleResponseData: Data) throws -> (article: Article, author: Author) {
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let decoder = JSONDecoder()
decoder.keyDecodingStrategy = .convertFromSnakeCase
let articleDocument = try decoder.decode(SingleArticleDocumentWithIncludes.self, from: articleResponseData)
let articleDocument = try decoder.decode(SingleArticleDocumentWithIncludes.self, from: articleResponseData)
switch articleDocument.body {
case .data(let data):
let authors = data.includes[Author.self]
switch articleDocument.body {
case .data(let data):
let authors = data.includes[Author.self]
guard authors.count == 1 else {
throw NetworkError.quantityMismatch
}
guard authors.count == 1 else {
throw NetworkError.quantityMismatch
}
return (article: data.primary.value, author: authors[0])
case .errors(let errors, meta: _, links: _):
throw NetworkError.serverError
}
return (article: data.primary.value, author: authors[0])
case .errors(let errors, meta: _, links: _):
throw NetworkError.serverError
}
}
let response = try! docode(articleResponseData: responseData)
@@ -1,7 +1,11 @@
#if !canImport(ObjectiveC)
import XCTest
extension Attribute_LiteralTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__Attribute_LiteralTests = [
("test_ArrayLiteral", test_ArrayLiteral),
("test_BooleanLiteral", test_BooleanLiteral),
("test_DictionaryLiteral", test_DictionaryLiteral),
@@ -32,7 +36,10 @@ extension Attribute_LiteralTests {
}
extension EntityCheckTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__EntityCheckTests = [
("test_failsWithBadAttribute", test_failsWithBadAttribute),
("test_failsWithBadRelationship", test_failsWithBadRelationship),
("test_failsWithEnumAttributes", test_failsWithEnumAttributes),
@@ -42,27 +49,32 @@ extension EntityCheckTests {
}
extension Id_LiteralTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__Id_LiteralTests = [
("test_IntegerLiteral", test_IntegerLiteral),
("test_StringLiteral", test_StringLiteral),
]
}
extension Relationship_LiteralTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__Relationship_LiteralTests = [
("test_ArrayLiteral", test_ArrayLiteral),
("test_NilLiteral", test_NilLiteral),
("test_StringLiteral", test_StringLiteral),
]
}
#if !os(macOS)
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(Attribute_LiteralTests.__allTests),
testCase(EntityCheckTests.__allTests),
testCase(Id_LiteralTests.__allTests),
testCase(Relationship_LiteralTests.__allTests),
testCase(Attribute_LiteralTests.__allTests__Attribute_LiteralTests),
testCase(EntityCheckTests.__allTests__EntityCheckTests),
testCase(Id_LiteralTests.__allTests__Id_LiteralTests),
testCase(Relationship_LiteralTests.__allTests__Relationship_LiteralTests),
]
}
#endif
+72 -29
View File
@@ -1,7 +1,11 @@
#if !canImport(ObjectiveC)
import XCTest
extension APIDescriptionTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__APIDescriptionTests = [
("test_empty", test_empty),
("test_failsMissingMeta", test_failsMissingMeta),
("test_NoDescriptionString", test_NoDescriptionString),
@@ -12,7 +16,10 @@ extension APIDescriptionTests {
}
extension AttributeTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__AttributeTests = [
("test_AttributeConstructor", test_AttributeConstructor),
("test_EncodedPrimitives", test_EncodedPrimitives),
("test_NullableIsEqualToNonNullableIfNotNil", test_NullableIsEqualToNonNullableIfNotNil),
@@ -24,7 +31,10 @@ extension AttributeTests {
}
extension Attribute_FunctorTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__Attribute_FunctorTests = [
("test_mapGuaranteed", test_mapGuaranteed),
("test_mapOptionalFailure", test_mapOptionalFailure),
("test_mapOptionalSuccess", test_mapOptionalSuccess),
@@ -32,7 +42,10 @@ extension Attribute_FunctorTests {
}
extension ComputedPropertiesTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ComputedPropertiesTests = [
("test_ComputedAttributeAccess", test_ComputedAttributeAccess),
("test_ComputedNonAttributeAccess", test_ComputedNonAttributeAccess),
("test_ComputedRelationshipAccess", test_ComputedRelationshipAccess),
@@ -42,7 +55,10 @@ extension ComputedPropertiesTests {
}
extension CustomAttributesTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__CustomAttributesTests = [
("test_customDecode", test_customDecode),
("test_customEncode", test_customEncode),
("test_customKeysDecode", test_customKeysDecode),
@@ -51,7 +67,10 @@ extension CustomAttributesTests {
}
extension DocumentTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__DocumentTests = [
("test_errorDocumentFailsWithNoAPIDescription", test_errorDocumentFailsWithNoAPIDescription),
("test_errorDocumentNoMeta", test_errorDocumentNoMeta),
("test_errorDocumentNoMeta_encode", test_errorDocumentNoMeta_encode),
@@ -154,7 +173,10 @@ extension DocumentTests {
}
extension EntityTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__EntityTests = [
("test_copyIdentifiedByType", test_copyIdentifiedByType),
("test_copyIdentifiedByValue", test_copyIdentifiedByValue),
("test_copyWithNewId", test_copyWithNewId),
@@ -202,6 +224,7 @@ extension EntityTests {
("test_optional_relationship_operator_access", test_optional_relationship_operator_access),
("test_optionalNullableRelationshipNulled", test_optionalNullableRelationshipNulled),
("test_optionalNullableRelationshipNulled_encode", test_optionalNullableRelationshipNulled_encode),
("test_optionalNullableRelationshipOmitted", test_optionalNullableRelationshipOmitted),
("test_optionalToMany_relationship_opeartor_access", test_optionalToMany_relationship_opeartor_access),
("test_optionalToManyIsNotOmitted", test_optionalToManyIsNotOmitted),
("test_optionalToManyIsNotOmitted_encode", test_optionalToManyIsNotOmitted_encode),
@@ -227,7 +250,10 @@ extension EntityTests {
}
extension IncludedTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__IncludedTests = [
("test_appending", test_appending),
("test_EightDifferentIncludes", test_EightDifferentIncludes),
("test_EightDifferentIncludes_encode", test_EightDifferentIncludes_encode),
@@ -256,7 +282,10 @@ extension IncludedTests {
}
extension LinksTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__LinksTests = [
("test_linkFailsIfMetaNotFound", test_linkFailsIfMetaNotFound),
("test_linkWithMetadata", test_linkWithMetadata),
("test_linkWithMetadata_encode", test_linkWithMetadata_encode),
@@ -270,7 +299,10 @@ extension LinksTests {
}
extension NonJSONAPIRelatableTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__NonJSONAPIRelatableTests = [
("test_initialization1", test_initialization1),
("test_initialization2_all_relationships_missing", test_initialization2_all_relationships_missing),
("test_initialization2_all_relationships_there", test_initialization2_all_relationships_there),
@@ -278,7 +310,10 @@ extension NonJSONAPIRelatableTests {
}
extension PolyProxyTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PolyProxyTests = [
("test_AsymmetricEncodeDecodeUserA", test_AsymmetricEncodeDecodeUserA),
("test_AsymmetricEncodeDecodeUserB", test_AsymmetricEncodeDecodeUserB),
("test_generalReasonableness", test_generalReasonableness),
@@ -289,7 +324,10 @@ extension PolyProxyTests {
}
extension PolyTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__PolyTests = [
("test_init_Poly0", test_init_Poly0),
("test_init_Poly1", test_init_Poly1),
("test_init_Poly2", test_init_Poly2),
@@ -324,7 +362,10 @@ extension PolyTests {
}
extension RelationshipTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__RelationshipTests = [
("test_initToManyWithEntities", test_initToManyWithEntities),
("test_initToManyWithRelationships", test_initToManyWithRelationships),
("test_ToManyRelationship", test_ToManyRelationship),
@@ -351,7 +392,10 @@ extension RelationshipTests {
}
extension ResourceBodyTests {
static let __allTests = [
// DO NOT MODIFY: This is autogenerated, use:
// `swift test --generate-linuxmain`
// to regenerate.
static let __allTests__ResourceBodyTests = [
("test_initializers", test_initializers),
("test_manyResourceBody", test_manyResourceBody),
("test_manyResourceBody_encode", test_manyResourceBody_encode),
@@ -363,23 +407,22 @@ extension ResourceBodyTests {
]
}
#if !os(macOS)
public func __allTests() -> [XCTestCaseEntry] {
return [
testCase(APIDescriptionTests.__allTests),
testCase(AttributeTests.__allTests),
testCase(Attribute_FunctorTests.__allTests),
testCase(ComputedPropertiesTests.__allTests),
testCase(CustomAttributesTests.__allTests),
testCase(DocumentTests.__allTests),
testCase(EntityTests.__allTests),
testCase(IncludedTests.__allTests),
testCase(LinksTests.__allTests),
testCase(NonJSONAPIRelatableTests.__allTests),
testCase(PolyProxyTests.__allTests),
testCase(PolyTests.__allTests),
testCase(RelationshipTests.__allTests),
testCase(ResourceBodyTests.__allTests),
testCase(APIDescriptionTests.__allTests__APIDescriptionTests),
testCase(AttributeTests.__allTests__AttributeTests),
testCase(Attribute_FunctorTests.__allTests__Attribute_FunctorTests),
testCase(ComputedPropertiesTests.__allTests__ComputedPropertiesTests),
testCase(CustomAttributesTests.__allTests__CustomAttributesTests),
testCase(DocumentTests.__allTests__DocumentTests),
testCase(EntityTests.__allTests__EntityTests),
testCase(IncludedTests.__allTests__IncludedTests),
testCase(LinksTests.__allTests__LinksTests),
testCase(NonJSONAPIRelatableTests.__allTests__NonJSONAPIRelatableTests),
testCase(PolyProxyTests.__allTests__PolyProxyTests),
testCase(PolyTests.__allTests__PolyTests),
testCase(RelationshipTests.__allTests__RelationshipTests),
testCase(ResourceBodyTests.__allTests__ResourceBodyTests),
]
}
#endif
+2 -2
View File
@@ -1,10 +1,10 @@
import XCTest
import JSONAPITests
import JSONAPITestingTests
import JSONAPITests
var tests = [XCTestCaseEntry]()
tests += JSONAPITests.__allTests()
tests += JSONAPITestingTests.__allTests()
tests += JSONAPITests.__allTests()
XCTMain(tests)