mirror of
https://github.com/encounter/JSONAPI.git
synced 2026-07-10 12:18:40 -07:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fcc1796731 | |||
| 921bcef05d | |||
| 661ff6eca5 | |||
| e36180c9b9 | |||
| abee0c4d0e | |||
| 9c8b2fbebb | |||
| a9ef71f383 |
@@ -11,7 +11,7 @@ Please enjoy these examples, but allow me the forced casting and the lack of err
|
|||||||
// MARK: - Create a request or response body with one Dog in it
|
// MARK: - Create a request or response body with one Dog in it
|
||||||
let dogFromCode = try! Dog(name: "Buddy", owner: nil)
|
let dogFromCode = try! Dog(name: "Buddy", owner: nil)
|
||||||
|
|
||||||
typealias SingleDogDocument = JSONAPIDocument<SingleResourceBody<Dog>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>
|
typealias SingleDogDocument = JSONAPI.Document<SingleResourceBody<Dog>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>
|
||||||
|
|
||||||
let singleDogDocument = SingleDogDocument(body: SingleResourceBody(entity: dogFromCode))
|
let singleDogDocument = SingleDogDocument(body: SingleResourceBody(entity: dogFromCode))
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ let dogs = try! [Dog(name: "Buddy", owner: personIds[0]), Dog(name: "Joy", owner
|
|||||||
let houses = [House(), House()]
|
let houses = [House(), House()]
|
||||||
let people = try! [Person(id: personIds[0], name: ["Gary", "Doe"], favoriteColor: "Orange-Red", friends: [], dogs: [dogs[0], dogs[1]], home: houses[0]), Person(id: personIds[1], name: ["Elise", "Joy"], favoriteColor: "Red", friends: [], dogs: [dogs[2]], home: houses[1])]
|
let people = try! [Person(id: personIds[0], name: ["Gary", "Doe"], favoriteColor: "Orange-Red", friends: [], dogs: [dogs[0], dogs[1]], home: houses[0]), Person(id: personIds[1], name: ["Elise", "Joy"], favoriteColor: "Red", friends: [], dogs: [dogs[2]], home: houses[1])]
|
||||||
|
|
||||||
typealias BatchPeopleDocument = JSONAPIDocument<ManyResourceBody<Person>, NoMetadata, NoLinks, Include2<Dog, House>, UnknownJSONAPIError>
|
typealias BatchPeopleDocument = JSONAPI.Document<ManyResourceBody<Person>, NoMetadata, NoLinks, Include2<Dog, House>, UnknownJSONAPIError>
|
||||||
|
|
||||||
let includes = dogs.map { BatchPeopleDocument.Include($0) } + houses.map { BatchPeopleDocument.Include($0) }
|
let includes = dogs.map { BatchPeopleDocument.Include($0) } + houses.map { BatchPeopleDocument.Include($0) }
|
||||||
let batchPeopleDocument = BatchPeopleDocument(body: .init(entities: people), includes: .init(values: includes))
|
let batchPeopleDocument = BatchPeopleDocument(body: .init(entities: people), includes: .init(values: includes))
|
||||||
@@ -47,3 +47,13 @@ if case let .data(bodyData) = peopleResponse.body {
|
|||||||
} else {
|
} else {
|
||||||
print("no body data")
|
print("no body data")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Work in the abstract
|
||||||
|
|
||||||
|
func process<T: JSONAPIDocument>(document: T) {
|
||||||
|
guard case let .data(body) = document.body else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let x: T.BodyData = body
|
||||||
|
}
|
||||||
|
process(document: peopleResponse)
|
||||||
|
|||||||
@@ -291,9 +291,9 @@ The second generic type of a `JSONAPIDocument` is a `Meta`. This structure is en
|
|||||||
You would then create the following `Meta` type:
|
You would then create the following `Meta` type:
|
||||||
```
|
```
|
||||||
struct PageMetadata: JSONAPI.Meta {
|
struct PageMetadata: JSONAPI.Meta {
|
||||||
let total: Int
|
let total: Int
|
||||||
let limit: Int
|
let limit: Int
|
||||||
let offset: Int
|
let offset: Int
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,19 @@
|
|||||||
// Created by Mathew Polzin on 11/5/18.
|
// Created by Mathew Polzin on 11/5/18.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
public protocol JSONAPIDocument: Codable, Equatable {
|
||||||
|
associatedtype PrimaryResourceBody: JSONAPI.ResourceBody
|
||||||
|
associatedtype MetaType: JSONAPI.Meta
|
||||||
|
associatedtype LinksType: JSONAPI.Links
|
||||||
|
associatedtype IncludeType: JSONAPI.Include
|
||||||
|
associatedtype Error: JSONAPIError
|
||||||
|
|
||||||
|
typealias Body = Document<PrimaryResourceBody, MetaType, LinksType, IncludeType, Error>.Body
|
||||||
|
typealias BodyData = Body.Data
|
||||||
|
|
||||||
|
var body: Body { get }
|
||||||
|
}
|
||||||
|
|
||||||
/// A JSON API Document represents the entire body
|
/// A JSON API Document represents the entire body
|
||||||
/// of a JSON API request or the entire body of
|
/// of a JSON API request or the entire body of
|
||||||
/// a JSON API response.
|
/// a JSON API response.
|
||||||
@@ -12,7 +25,7 @@
|
|||||||
/// API uses snake case, you will want to use
|
/// API uses snake case, you will want to use
|
||||||
/// a conversion such as the one offerred by the
|
/// a conversion such as the one offerred by the
|
||||||
/// Foundation JSONEncoder/Decoder: `KeyDecodingStrategy`
|
/// Foundation JSONEncoder/Decoder: `KeyDecodingStrategy`
|
||||||
public struct JSONAPIDocument<ResourceBody: JSONAPI.ResourceBody, MetaType: JSONAPI.Meta, LinksType: JSONAPI.Links, IncludeType: JSONAPI.Include, Error: JSONAPIError>: Equatable {
|
public struct Document<PrimaryResourceBody: JSONAPI.ResourceBody, MetaType: JSONAPI.Meta, LinksType: JSONAPI.Links, IncludeType: JSONAPI.Include, Error: JSONAPIError>: JSONAPIDocument {
|
||||||
public typealias Include = IncludeType
|
public typealias Include = IncludeType
|
||||||
|
|
||||||
public let body: Body
|
public let body: Body
|
||||||
@@ -23,10 +36,10 @@ public struct JSONAPIDocument<ResourceBody: JSONAPI.ResourceBody, MetaType: JSON
|
|||||||
case data(Data)
|
case data(Data)
|
||||||
|
|
||||||
public struct Data: Equatable {
|
public struct Data: Equatable {
|
||||||
let primary: ResourceBody
|
public let primary: PrimaryResourceBody
|
||||||
let includes: Includes<Include>
|
public let includes: Includes<Include>
|
||||||
let meta: MetaType
|
public let meta: MetaType
|
||||||
let links: LinksType
|
public let links: LinksType
|
||||||
}
|
}
|
||||||
|
|
||||||
public var isError: Bool {
|
public var isError: Bool {
|
||||||
@@ -39,7 +52,7 @@ public struct JSONAPIDocument<ResourceBody: JSONAPI.ResourceBody, MetaType: JSON
|
|||||||
return errors
|
return errors
|
||||||
}
|
}
|
||||||
|
|
||||||
public var primaryData: ResourceBody? {
|
public var primaryData: PrimaryResourceBody? {
|
||||||
guard case let .data(data) = self else { return nil }
|
guard case let .data(data) = self else { return nil }
|
||||||
return data.primary
|
return data.primary
|
||||||
}
|
}
|
||||||
@@ -76,54 +89,54 @@ public struct JSONAPIDocument<ResourceBody: JSONAPI.ResourceBody, MetaType: JSON
|
|||||||
body = .errors(errors, meta: meta, links: links)
|
body = .errors(errors, meta: meta, links: links)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(body: ResourceBody, includes: Includes<Include>, meta: MetaType, links: LinksType) {
|
public init(body: PrimaryResourceBody, includes: Includes<Include>, meta: MetaType, links: LinksType) {
|
||||||
self.body = .data(.init(primary: body, includes: includes, meta: meta, links: links))
|
self.body = .data(.init(primary: body, includes: includes, meta: meta, links: links))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where IncludeType == NoIncludes {
|
extension Document where IncludeType == NoIncludes {
|
||||||
public init(body: ResourceBody, meta: MetaType, links: LinksType) {
|
public init(body: PrimaryResourceBody, meta: MetaType, links: LinksType) {
|
||||||
self.body = .data(.init(primary: body, includes: .none, meta: meta, links: links))
|
self.body = .data(.init(primary: body, includes: .none, meta: meta, links: links))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where MetaType == NoMetadata {
|
extension Document where MetaType == NoMetadata {
|
||||||
public init(body: ResourceBody, includes: Includes<Include>, links: LinksType) {
|
public init(body: PrimaryResourceBody, includes: Includes<Include>, links: LinksType) {
|
||||||
self.body = .data(.init(primary: body, includes: includes, meta: .none, links: links))
|
self.body = .data(.init(primary: body, includes: includes, meta: .none, links: links))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where LinksType == NoLinks {
|
extension Document where LinksType == NoLinks {
|
||||||
public init(body: ResourceBody, includes: Includes<Include>, meta: MetaType) {
|
public init(body: PrimaryResourceBody, includes: Includes<Include>, meta: MetaType) {
|
||||||
self.body = .data(.init(primary: body, includes: includes, meta: meta, links: .none))
|
self.body = .data(.init(primary: body, includes: includes, meta: meta, links: .none))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where IncludeType == NoIncludes, LinksType == NoLinks {
|
extension Document where IncludeType == NoIncludes, LinksType == NoLinks {
|
||||||
public init(body: ResourceBody, meta: MetaType) {
|
public init(body: PrimaryResourceBody, meta: MetaType) {
|
||||||
self.body = .data(.init(primary: body, includes: .none, meta: meta, links: .none))
|
self.body = .data(.init(primary: body, includes: .none, meta: meta, links: .none))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where IncludeType == NoIncludes, MetaType == NoMetadata {
|
extension Document where IncludeType == NoIncludes, MetaType == NoMetadata {
|
||||||
public init(body: ResourceBody, links: LinksType) {
|
public init(body: PrimaryResourceBody, links: LinksType) {
|
||||||
self.body = .data(.init(primary: body, includes: .none, meta: .none, links: links))
|
self.body = .data(.init(primary: body, includes: .none, meta: .none, links: links))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where MetaType == NoMetadata, LinksType == NoLinks {
|
extension Document where MetaType == NoMetadata, LinksType == NoLinks {
|
||||||
public init(body: ResourceBody, includes: Includes<Include>) {
|
public init(body: PrimaryResourceBody, includes: Includes<Include>) {
|
||||||
self.body = .data(.init(primary: body, includes: includes, meta: .none, links: .none))
|
self.body = .data(.init(primary: body, includes: includes, meta: .none, links: .none))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument where IncludeType == NoIncludes, MetaType == NoMetadata, LinksType == NoLinks {
|
extension Document where IncludeType == NoIncludes, MetaType == NoMetadata, LinksType == NoLinks {
|
||||||
public init(body: ResourceBody) {
|
public init(body: PrimaryResourceBody) {
|
||||||
self.body = .data(.init(primary: body, includes: .none, meta: .none, links: .none))
|
self.body = .data(.init(primary: body, includes: .none, meta: .none, links: .none))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension JSONAPIDocument: Codable {
|
extension Document {
|
||||||
private enum RootCodingKeys: String, CodingKey {
|
private enum RootCodingKeys: String, CodingKey {
|
||||||
case data
|
case data
|
||||||
case errors
|
case errors
|
||||||
@@ -166,11 +179,11 @@ extension JSONAPIDocument: Codable {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let data: ResourceBody
|
let data: PrimaryResourceBody
|
||||||
if let noData = NoResourceBody() as? ResourceBody {
|
if let noData = NoResourceBody() as? PrimaryResourceBody {
|
||||||
data = noData
|
data = noData
|
||||||
} else {
|
} else {
|
||||||
data = try container.decode(ResourceBody.self, forKey: .data)
|
data = try container.decode(PrimaryResourceBody.self, forKey: .data)
|
||||||
}
|
}
|
||||||
|
|
||||||
let maybeIncludes = try container.decodeIfPresent(Includes<Include>.self, forKey: .included)
|
let maybeIncludes = try container.decodeIfPresent(Includes<Include>.self, forKey: .included)
|
||||||
@@ -228,8 +241,8 @@ extension JSONAPIDocument: Codable {
|
|||||||
|
|
||||||
// MARK: - CustomStringConvertible
|
// MARK: - CustomStringConvertible
|
||||||
|
|
||||||
extension JSONAPIDocument: CustomStringConvertible {
|
extension Document: CustomStringConvertible {
|
||||||
public var description: String {
|
public var description: String {
|
||||||
return "JSONAPIDocument(body: \(String(describing: body))"
|
return "Document(body: \(String(describing: body))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// ResourceBody.swift
|
// PrimaryResourceBody.swift
|
||||||
// JSONAPI
|
// JSONAPI
|
||||||
//
|
//
|
||||||
// Created by Mathew Polzin on 11/10/18.
|
// Created by Mathew Polzin on 11/10/18.
|
||||||
@@ -80,12 +80,12 @@ extension ManyResourceBody {
|
|||||||
|
|
||||||
extension SingleResourceBody: CustomStringConvertible {
|
extension SingleResourceBody: CustomStringConvertible {
|
||||||
public var description: String {
|
public var description: String {
|
||||||
return "ResourceBody(\(String(describing: value)))"
|
return "PrimaryResourceBody(\(String(describing: value)))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ManyResourceBody: CustomStringConvertible {
|
extension ManyResourceBody: CustomStringConvertible {
|
||||||
public var description: String {
|
public var description: String {
|
||||||
return "ResourceBody(\(String(describing: values)))"
|
return "PrimaryResourceBody(\(String(describing: values)))"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ public protocol EntityType: PrimaryResource {
|
|||||||
|
|
||||||
typealias Attributes = Description.Attributes
|
typealias Attributes = Description.Attributes
|
||||||
typealias Relationships = Description.Relationships
|
typealias Relationships = Description.Relationships
|
||||||
|
|
||||||
|
/// The `Entity`'s Id. This can be of type `Unidentified` if
|
||||||
|
/// the entity is being created clientside and the
|
||||||
|
/// server is being asked to create a unique Id. Otherwise,
|
||||||
|
/// this should be of a type conforming to `IdType`.
|
||||||
|
var id: Identifier { get }
|
||||||
|
|
||||||
|
/// The JSON API compliant attributes of this `Entity`.
|
||||||
|
var attributes: Attributes { get }
|
||||||
|
|
||||||
|
/// The JSON API compliant relationships of this `Entity`.
|
||||||
|
var relationships: Relationships { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An `Entity` is a single model type that can be
|
/// An `Entity` is a single model type that can be
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
/// Any type that you would like to be encoded to and
|
/// Any type that you would like to be encoded to and
|
||||||
/// decoded from JSON API ids should conform to this
|
/// decoded from JSON API ids should conform to this
|
||||||
/// protocol. Conformance for `String` is given.
|
/// protocol. Conformance for `String` is given.
|
||||||
public protocol RawIdType: Codable, Equatable {}
|
public protocol RawIdType: Codable, Hashable {}
|
||||||
|
|
||||||
/// If you would like to be able to create new
|
/// If you would like to be able to create new
|
||||||
/// Entities with Ids backed by a RawIdType then
|
/// Entities with Ids backed by a RawIdType then
|
||||||
@@ -32,7 +32,7 @@ public struct Unidentified<EntityDescription: JSONAPI.EntityDescription>: Identi
|
|||||||
public var description: String { return "Id(Unidentified)" }
|
public var description: String { return "Id(Unidentified)" }
|
||||||
}
|
}
|
||||||
|
|
||||||
public protocol IdType: Identifier, CustomStringConvertible {
|
public protocol IdType: Identifier, Hashable, CustomStringConvertible {
|
||||||
associatedtype RawType: RawIdType
|
associatedtype RawType: RawIdType
|
||||||
|
|
||||||
var rawValue: RawType { get }
|
var rawValue: RawType { get }
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import JSONAPI
|
|||||||
class DocumentTests: XCTestCase {
|
class DocumentTests: XCTestCase {
|
||||||
|
|
||||||
func test_singleDocumentNull() {
|
func test_singleDocumentNull() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_null)
|
data: single_document_null)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -23,12 +23,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNull_encode() {
|
func test_singleDocumentNull_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_null)
|
data: single_document_null)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentNoMeta() {
|
func test_unknownErrorDocumentNoMeta() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_no_metadata)
|
data: error_document_no_metadata)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
@@ -48,12 +48,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentNoMeta_encode() {
|
func test_unknownErrorDocumentNoMeta_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_no_metadata)
|
data: error_document_no_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentMissingMeta() {
|
func test_unknownErrorDocumentMissingMeta() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: error_document_no_metadata)
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: error_document_no_metadata)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
XCTAssertNil(document.body.meta)
|
XCTAssertNil(document.body.meta)
|
||||||
@@ -72,11 +72,11 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentMissingMeta_encode() {
|
func test_unknownErrorDocumentMissingMeta_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: error_document_no_metadata)
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: error_document_no_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_errorDocumentNoMeta() {
|
func test_errorDocumentNoMeta() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, NoMetadata, NoLinks, NoIncludes, TestError>.self,
|
let document = decoded(type: Document<NoResourceBody, NoMetadata, NoLinks, NoIncludes, TestError>.self,
|
||||||
data: error_document_no_metadata)
|
data: error_document_no_metadata)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
@@ -96,12 +96,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_errorDocumentNoMeta_encode() {
|
func test_errorDocumentNoMeta_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, NoMetadata, NoLinks, NoIncludes, TestError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, NoMetadata, NoLinks, NoIncludes, TestError>.self,
|
||||||
data: error_document_no_metadata)
|
data: error_document_no_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentWithMeta() {
|
func test_unknownErrorDocumentWithMeta() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_with_metadata)
|
data: error_document_with_metadata)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
@@ -120,12 +120,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentWithMeta_encode() {
|
func test_unknownErrorDocumentWithMeta_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_with_metadata)
|
data: error_document_with_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentWithMetaWithLinks() {
|
func test_unknownErrorDocumentWithMetaWithLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_with_metadata_with_links)
|
data: error_document_with_metadata_with_links)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
@@ -148,12 +148,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentWithMetaWithLinks_encode() {
|
func test_unknownErrorDocumentWithMetaWithLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_with_metadata_with_links)
|
data: error_document_with_metadata_with_links)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentWithLinks() {
|
func test_unknownErrorDocumentWithLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_with_links)
|
data: error_document_with_links)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
@@ -174,12 +174,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentWithLinks_encode() {
|
func test_unknownErrorDocumentWithLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_with_links)
|
data: error_document_with_links)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentMissingLinks() {
|
func test_unknownErrorDocumentMissingLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_no_metadata)
|
data: error_document_no_metadata)
|
||||||
|
|
||||||
XCTAssertTrue(document.body.isError)
|
XCTAssertTrue(document.body.isError)
|
||||||
@@ -197,12 +197,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_unknownErrorDocumentMissingLinks_encode() {
|
func test_unknownErrorDocumentMissingLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: error_document_no_metadata)
|
data: error_document_no_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_metaDataDocument() {
|
func test_metaDataDocument() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: metadata_document)
|
data: metadata_document)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -213,12 +213,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_metaDataDocument_encode() {
|
func test_metaDataDocument_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: metadata_document)
|
data: metadata_document)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_metaDataDocumentWithLinks() {
|
func test_metaDataDocumentWithLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: metadata_document_with_links)
|
data: metadata_document_with_links)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -233,18 +233,18 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_metaDataDocumentWithLinks_encode() {
|
func test_metaDataDocumentWithLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<NoResourceBody, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: metadata_document_with_links)
|
data: metadata_document_with_links)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_metaDocumentMissingMeta() {
|
func test_metaDocumentMissingMeta() {
|
||||||
XCTAssertThrowsError(try JSONDecoder().decode(JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, from: metadata_document_missing_metadata))
|
XCTAssertThrowsError(try JSONDecoder().decode(Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, from: metadata_document_missing_metadata))
|
||||||
|
|
||||||
XCTAssertThrowsError(try JSONDecoder().decode(JSONAPIDocument<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, from: metadata_document_missing_metadata2))
|
XCTAssertThrowsError(try JSONDecoder().decode(Document<NoResourceBody, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, from: metadata_document_missing_metadata2))
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludes() {
|
func test_singleDocumentNoIncludes() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes)
|
data: single_document_no_includes)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -256,12 +256,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludes_encode() {
|
func test_singleDocumentNoIncludes_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes)
|
data: single_document_no_includes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithMetadata() {
|
func test_singleDocumentNoIncludesWithMetadata() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes_with_metadata)
|
data: single_document_no_includes_with_metadata)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -273,12 +273,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithMetadata_encode() {
|
func test_singleDocumentNoIncludesWithMetadata_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes_with_metadata)
|
data: single_document_no_includes_with_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithLinks() {
|
func test_singleDocumentNoIncludesWithLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, NoMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes_with_links)
|
data: single_document_no_includes_with_links)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -295,12 +295,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithLinks_encode() {
|
func test_singleDocumentNoIncludesWithLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, NoMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes_with_links)
|
data: single_document_no_includes_with_links)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithMetadataWithLinks() {
|
func test_singleDocumentNoIncludesWithMetadataWithLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes_with_metadata_with_links)
|
data: single_document_no_includes_with_metadata_with_links)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -317,20 +317,20 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithMetadataWithLinks_encode() {
|
func test_singleDocumentNoIncludesWithMetadataWithLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: single_document_no_includes_with_metadata_with_links)
|
data: single_document_no_includes_with_metadata_with_links)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithMetadataMissingLinks() {
|
func test_singleDocumentNoIncludesWithMetadataMissingLinks() {
|
||||||
XCTAssertThrowsError(try JSONDecoder().decode(JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self, from: single_document_no_includes_with_metadata))
|
XCTAssertThrowsError(try JSONDecoder().decode(Document<SingleResourceBody<Article>, TestPageMetadata, TestLinks, NoIncludes, UnknownJSONAPIError>.self, from: single_document_no_includes_with_metadata))
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesMissingMetadata() {
|
func test_singleDocumentNoIncludesMissingMetadata() {
|
||||||
XCTAssertThrowsError(try JSONDecoder().decode(JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, from: single_document_no_includes))
|
XCTAssertThrowsError(try JSONDecoder().decode(Document<SingleResourceBody<Article>, TestPageMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, from: single_document_no_includes))
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentSomeIncludes() {
|
func test_singleDocumentSomeIncludes() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: single_document_some_includes)
|
data: single_document_some_includes)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -343,12 +343,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentSomeIncludes_encode() {
|
func test_singleDocumentSomeIncludes_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: single_document_some_includes)
|
data: single_document_some_includes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentSomeIncludesWithMetadata() {
|
func test_singleDocumentSomeIncludesWithMetadata() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, TestPageMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: single_document_some_includes_with_metadata)
|
data: single_document_some_includes_with_metadata)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -362,12 +362,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentSomeIncludesWithMetadata_encode() {
|
func test_singleDocumentSomeIncludesWithMetadata_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, TestPageMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: single_document_some_includes_with_metadata)
|
data: single_document_some_includes_with_metadata)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithSomeIncludesWithMetadataWithLinks() {
|
func test_singleDocumentNoIncludesWithSomeIncludesWithMetadataWithLinks() {
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, TestLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<SingleResourceBody<Article>, TestPageMetadata, TestLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: single_document_some_includes_with_metadata_with_links)
|
data: single_document_some_includes_with_metadata_with_links)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -385,24 +385,24 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocumentNoIncludesWithSomeIncludesMetadataWithLinks_encode() {
|
func test_singleDocumentNoIncludesWithSomeIncludesMetadataWithLinks_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Article>, TestPageMetadata, TestLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Article>, TestPageMetadata, TestLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: single_document_some_includes_with_metadata_with_links)
|
data: single_document_some_includes_with_metadata_with_links)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocument_PolyPrimaryResource() {
|
func test_singleDocument_PolyPrimaryResource() {
|
||||||
let article = Article(id: Id(rawValue: "1"), relationships: .init(author: ToOneRelationship(id: Id(rawValue: "33"))))
|
let article = Article(id: Id(rawValue: "1"), relationships: .init(author: ToOneRelationship(id: Id(rawValue: "33"))))
|
||||||
let document = decoded(type: JSONAPIDocument<SingleResourceBody<Poly2<Article, Author>>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: single_document_no_includes)
|
let document = decoded(type: Document<SingleResourceBody<Poly2<Article, Author>>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: single_document_no_includes)
|
||||||
|
|
||||||
XCTAssertEqual(document.body.primaryData?.value?[Article.self], article)
|
XCTAssertEqual(document.body.primaryData?.value?[Article.self], article)
|
||||||
XCTAssertNil(document.body.primaryData?.value?[Author.self])
|
XCTAssertNil(document.body.primaryData?.value?[Author.self])
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_singleDocument_PolyPrimaryResource_encode() {
|
func test_singleDocument_PolyPrimaryResource_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<SingleResourceBody<Poly2<Article, Author>>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: single_document_no_includes)
|
test_DecodeEncodeEquality(type: Document<SingleResourceBody<Poly2<Article, Author>>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self, data: single_document_no_includes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_manyDocumentNoIncludes() {
|
func test_manyDocumentNoIncludes() {
|
||||||
let document = decoded(type: JSONAPIDocument<ManyResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<ManyResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: many_document_no_includes)
|
data: many_document_no_includes)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -416,12 +416,12 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_manyDocumentNoIncludes_encode() {
|
func test_manyDocumentNoIncludes_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<ManyResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<ManyResourceBody<Article>, NoMetadata, NoLinks, NoIncludes, UnknownJSONAPIError>.self,
|
||||||
data: many_document_no_includes)
|
data: many_document_no_includes)
|
||||||
}
|
}
|
||||||
|
|
||||||
func test_manyDocumentSomeIncludes() {
|
func test_manyDocumentSomeIncludes() {
|
||||||
let document = decoded(type: JSONAPIDocument<ManyResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
let document = decoded(type: Document<ManyResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: many_document_some_includes)
|
data: many_document_some_includes)
|
||||||
|
|
||||||
XCTAssertFalse(document.body.isError)
|
XCTAssertFalse(document.body.isError)
|
||||||
@@ -439,7 +439,7 @@ class DocumentTests: XCTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func test_manyDocumentSomeIncludes_encode() {
|
func test_manyDocumentSomeIncludes_encode() {
|
||||||
test_DecodeEncodeEquality(type: JSONAPIDocument<ManyResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
test_DecodeEncodeEquality(type: Document<ManyResourceBody<Article>, NoMetadata, NoLinks, Include1<Author>, UnknownJSONAPIError>.self,
|
||||||
data: many_document_some_includes)
|
data: many_document_some_includes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user