From 61e00c2de56d16e6f78701b8894f472d9535d221 Mon Sep 17 00:00:00 2001 From: Mathew Polzin Date: Mon, 5 Aug 2019 08:01:42 -0700 Subject: [PATCH] small rename --- ...SparseFieldEncodable.swift => SparseFieldset.swift} | 10 +++++----- ...dEncodableTests.swift => SparseFieldsetTests.swift} | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) rename Sources/JSONAPI/SparseFields/{SparseFieldEncodable.swift => SparseFieldset.swift} (83%) rename Tests/JSONAPITests/SparseFields/{SparseFieldEncodableTests.swift => SparseFieldsetTests.swift} (95%) diff --git a/Sources/JSONAPI/SparseFields/SparseFieldEncodable.swift b/Sources/JSONAPI/SparseFields/SparseFieldset.swift similarity index 83% rename from Sources/JSONAPI/SparseFields/SparseFieldEncodable.swift rename to Sources/JSONAPI/SparseFields/SparseFieldset.swift index bac54d2..8e0979b 100644 --- a/Sources/JSONAPI/SparseFields/SparseFieldEncodable.swift +++ b/Sources/JSONAPI/SparseFields/SparseFieldset.swift @@ -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 { - return SparseField(self, fields: fields) + /// as a `SparsePrimaryResource`. + func sparse(with fields: [Description.Attributes.CodingKeys]) -> SparseFieldset { + return SparseFieldset(self, fields: fields) } } diff --git a/Tests/JSONAPITests/SparseFields/SparseFieldEncodableTests.swift b/Tests/JSONAPITests/SparseFields/SparseFieldsetTests.swift similarity index 95% rename from Tests/JSONAPITests/SparseFields/SparseFieldEncodableTests.swift rename to Tests/JSONAPITests/SparseFields/SparseFieldsetTests.swift index 5a17075..7845119 100644 --- a/Tests/JSONAPITests/SparseFields/SparseFieldEncodableTests.swift +++ b/Tests/JSONAPITests/SparseFields/SparseFieldsetTests.swift @@ -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)