small rename

This commit is contained in:
Mathew Polzin
2019-08-05 08:01:42 -07:00
parent e0b53236bb
commit 61e00c2de5
2 changed files with 9 additions and 9 deletions
@@ -1,11 +1,11 @@
//
// SparseField.swift
// SparseFieldset.swift
//
//
// Created by Mathew Polzin on 8/4/19.
//
public struct SparseField<
public struct SparseFieldset<
Description: JSONAPI.ResourceObjectDescription,
MetaType: JSONAPI.Meta,
LinksType: JSONAPI.Links,
@@ -33,8 +33,8 @@ public struct SparseField<
public extension ResourceObject where Description.Attributes: SparsableAttributes {
/// Get a Sparse Fieldset of this `ResourceObject` that can be encoded
/// as a `PrimaryResource`.
func sparse(with fields: [Description.Attributes.CodingKeys]) -> SparseField<Description, MetaType, LinksType, EntityRawIdType> {
return SparseField(self, fields: fields)
/// as a `SparsePrimaryResource`.
func sparse(with fields: [Description.Attributes.CodingKeys]) -> SparseFieldset<Description, MetaType, LinksType, EntityRawIdType> {
return SparseFieldset(self, fields: fields)
}
}
@@ -1,5 +1,5 @@
//
// SparseFieldEncodableTests.swift
// SparseFieldsetTests.swift
//
//
// Created by Mathew Polzin on 8/4/19.
@@ -13,7 +13,7 @@ import JSONAPITesting
class SparseFieldEncoderTests: XCTestCase {
func test_FullEncode() {
let jsonEncoder = JSONEncoder()
let sparseWithEverything = SparseField(testEverythingObject, fields: EverythingTest.Attributes.CodingKeys.allCases)
let sparseWithEverything = SparseFieldset(testEverythingObject, fields: EverythingTest.Attributes.CodingKeys.allCases)
let encoded = try! jsonEncoder.encode(sparseWithEverything)
@@ -30,7 +30,7 @@ class SparseFieldEncoderTests: XCTestCase {
XCTAssertEqual(type, EverythingTest.jsonType)
XCTAssertNil(relationships)
XCTAssertEqual(attributesDict?.count, 9) // note not 10 because one value is omitted
XCTAssertEqual(attributesDict?.count, 9) // note not 10 because one value is omitted intentionally at initialization
XCTAssertEqual(attributesDict?["bool"] as? Bool,
testEverythingObject[\.bool])
XCTAssertEqual(attributesDict?["int"] as? Int,
@@ -52,7 +52,7 @@ class SparseFieldEncoderTests: XCTestCase {
func test_PartialEncode() {
let jsonEncoder = JSONEncoder()
let sparseObject = SparseField(testEverythingObject, fields: [.string, .bool, .array])
let sparseObject = SparseFieldset(testEverythingObject, fields: [.string, .bool, .array])
let encoded = try! jsonEncoder.encode(sparseObject)