Skip to content

Commit ee4a88f

Browse files
authored
chore(datastore): Update comment to reflect breaking change (#989)
1 parent 7194840 commit ee4a88f

File tree

10 files changed

+88
-58
lines changed

10 files changed

+88
-58
lines changed

Amplify/Categories/DataStore/Model/Internal/Embedded.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ import Foundation
1313
/// `embedded(type:)` or `embeddedCollection(of:)` must comform to the `Embeddable` protocol except for Swift's Basic
1414
/// types embedded as a collection. A collection of String can be embedded in the `Model` as
1515
/// `embeddedCollection(of: String.self)` without needing to conform to Embeddable.
16-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
17-
/// by host applications. The behavior of this may change without warning.
16+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
17+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
18+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
19+
///
1820
public protocol Embeddable: Codable {
1921

2022
/// A reference to the `ModelSchema` associated with this embedded type.

Amplify/Categories/DataStore/Model/Internal/Model+Array.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ import Foundation
99

1010
extension Array where Element: Model {
1111

12-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
13-
/// by host applications. The behavior of this may change without warning.
12+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
13+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
14+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
1415
public func unique() throws -> Element? {
1516
guard (0 ... 1).contains(count) else {
1617
throw DataStoreError.nonUniqueResult(model: Element.modelName, count: count)
@@ -21,8 +22,9 @@ extension Array where Element: Model {
2122

2223
extension Array where Element == Model {
2324

24-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
25-
/// by host applications. The behavior of this may change without warning.
25+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
26+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
27+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
2628
public func unique() throws -> Element? {
2729
guard (0 ... 1).contains(count) else {
2830
let firstModelName = self[0].modelName

Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ extension Model where Self: Codable {
2020
/// - Returns: an instance of the concrete type conforming to `Model`
2121
/// - Throws: `DecodingError.dataCorrupted` in case data is not a valid JSON or any
2222
/// other decoding specific error that `JSONDecoder.decode()` might throw.
23-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
24-
/// by host applications. The behavior of this may change without warning.
23+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
24+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
25+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
2526
public static func from(json: String,
2627
decoder: JSONDecoder? = nil) throws -> Self {
2728
let resolvedDecoder: JSONDecoder
@@ -48,8 +49,9 @@ extension Model where Self: Codable {
4849
/// - Returns: an instance of the concrete type conforming to `Model`
4950
/// - Throws: `DecodingError.dataCorrupted` in case data is not a valid JSON or any
5051
/// other decoding specific error that `JSONDecoder.decode()` might throw.
51-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
52-
/// by host applications. The behavior of this may change without warning.
52+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
53+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
54+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
5355
public static func from(dictionary: [String: Any]) throws -> Self {
5456
let data = try JSONSerialization.data(withJSONObject: dictionary)
5557
let decoder = JSONDecoder(dateDecodingStrategy: ModelDateFormatting.decodingStrategy)
@@ -62,8 +64,9 @@ extension Model where Self: Codable {
6264
/// custom date formatter that encodes ISO8601 dates with fractional seconds
6365
/// - Returns: the JSON representation of the `Model`
6466
/// - seealso: https://developer.apple.com/documentation/foundation/jsonencoder/2895034-encode
65-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
66-
/// by host applications. The behavior of this may change without warning.
67+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
68+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
69+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
6770
public func toJSON(encoder: JSONEncoder? = nil) throws -> String {
6871
let resolvedEncoder: JSONEncoder
6972
if let encoder = encoder {

Amplify/Categories/DataStore/Model/Internal/Model+DateFormatting.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
import Foundation
99

10-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
11-
/// by host applications. The behavior of this may change without warning.
10+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
11+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
12+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
1213
public struct ModelDateFormatting {
1314

1415
public static let decodingStrategy: JSONDecoder.DateDecodingStrategy = {
@@ -34,8 +35,9 @@ public struct ModelDateFormatting {
3435

3536
public extension JSONDecoder {
3637

37-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
38-
/// by host applications. The behavior of this may change without warning.
38+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
39+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
40+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
3941
convenience init(dateDecodingStrategy: JSONDecoder.DateDecodingStrategy) {
4042
self.init()
4143
self.dateDecodingStrategy = dateDecodingStrategy
@@ -44,8 +46,9 @@ public extension JSONDecoder {
4446

4547
public extension JSONEncoder {
4648

47-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
48-
/// by host applications. The behavior of this may change without warning.
49+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
50+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
51+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
4952
convenience init(dateEncodingStrategy: JSONEncoder.DateEncodingStrategy) {
5053
self.init()
5154
self.dateEncodingStrategy = dateEncodingStrategy

Amplify/Categories/DataStore/Model/Internal/Model+Subscript.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
/// ```
1313
extension Model {
1414

15-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
16-
/// by host applications. The behavior of this may change without warning.
15+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
16+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
17+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
1718
public subscript(_ key: String) -> Any?? {
1819

1920
if let jsonModel = self as? JSONValueHolder {

Amplify/Categories/DataStore/Model/Internal/ModelRegistry+Syncable.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
public extension ModelRegistry {
99

10-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
11-
/// by host applications. The behavior of this may change without warning.
10+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
11+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
12+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
1213
static var hasSyncableModels: Bool {
1314
if #available(iOS 13.0, *) {
1415
return modelSchemas.contains { !$0.isSystem }

Amplify/Categories/DataStore/Model/Internal/Persistable.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ struct PersistableHelper {
4242
/// - lhs: a reference to a Persistable object
4343
/// - rhs: another reference
4444
/// - Returns: `true` in case both values are equal or `false` otherwise
45-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
46-
/// by host applications. The behavior of this may change without warning.
45+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
46+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
47+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
4748
public static func isEqual(_ lhs: Persistable?, _ rhs: Persistable?) -> Bool {
4849
if lhs == nil && rhs == nil {
4950
return true

Amplify/Categories/DataStore/Model/Internal/Schema/Model+Schema.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ import Foundation
99

1010
extension Model {
1111

12-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
13-
/// by host applications. The behavior of this may change without warning.
12+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
13+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
14+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
1415
public static var schema: ModelSchema {
1516
// TODO load schema from JSON when this it not overridden by specific models
1617
ModelSchema(name: modelName, fields: [:])
1718
}
1819

19-
/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly
20-
/// by host applications. The behavior of this may change without warning.
20+
/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly
21+
/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change
22+
/// to these `public` types should be backward compatible, otherwise it will be a breaking change.
2123
public var schema: ModelSchema {
2224
type(of: self).schema
2325
}

0 commit comments

Comments
 (0)