diff --git a/Amplify/Categories/DataStore/Model/Internal/Embedded.swift b/Amplify/Categories/DataStore/Model/Internal/Embedded.swift index 8af3e0b42c..205c6307c1 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Embedded.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Embedded.swift @@ -13,8 +13,10 @@ import Foundation /// `embedded(type:)` or `embeddedCollection(of:)` must comform to the `Embeddable` protocol except for Swift's Basic /// types embedded as a collection. A collection of String can be embedded in the `Model` as /// `embeddedCollection(of: String.self)` without needing to conform to Embeddable. -/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly -/// by host applications. The behavior of this may change without warning. +/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly +/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change +/// to these `public` types should be backward compatible, otherwise it will be a breaking change. +/// public protocol Embeddable: Codable { /// A reference to the `ModelSchema` associated with this embedded type. diff --git a/Amplify/Categories/DataStore/Model/Internal/Model+Array.swift b/Amplify/Categories/DataStore/Model/Internal/Model+Array.swift index 7a38f3084d..ee38c9700d 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Model+Array.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Model+Array.swift @@ -9,8 +9,9 @@ import Foundation extension Array where Element: Model { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public func unique() throws -> Element? { guard (0 ... 1).contains(count) else { throw DataStoreError.nonUniqueResult(model: Element.modelName, count: count) @@ -21,8 +22,9 @@ extension Array where Element: Model { extension Array where Element == Model { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public func unique() throws -> Element? { guard (0 ... 1).contains(count) else { let firstModelName = self[0].modelName diff --git a/Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift b/Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift index d15f8e0bd8..38bb3c4e8f 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Model+Codable.swift @@ -20,8 +20,9 @@ extension Model where Self: Codable { /// - Returns: an instance of the concrete type conforming to `Model` /// - Throws: `DecodingError.dataCorrupted` in case data is not a valid JSON or any /// other decoding specific error that `JSONDecoder.decode()` might throw. - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public static func from(json: String, decoder: JSONDecoder? = nil) throws -> Self { let resolvedDecoder: JSONDecoder @@ -48,8 +49,9 @@ extension Model where Self: Codable { /// - Returns: an instance of the concrete type conforming to `Model` /// - Throws: `DecodingError.dataCorrupted` in case data is not a valid JSON or any /// other decoding specific error that `JSONDecoder.decode()` might throw. - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public static func from(dictionary: [String: Any]) throws -> Self { let data = try JSONSerialization.data(withJSONObject: dictionary) let decoder = JSONDecoder(dateDecodingStrategy: ModelDateFormatting.decodingStrategy) @@ -62,8 +64,9 @@ extension Model where Self: Codable { /// custom date formatter that encodes ISO8601 dates with fractional seconds /// - Returns: the JSON representation of the `Model` /// - seealso: https://developer.apple.com/documentation/foundation/jsonencoder/2895034-encode - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public func toJSON(encoder: JSONEncoder? = nil) throws -> String { let resolvedEncoder: JSONEncoder if let encoder = encoder { diff --git a/Amplify/Categories/DataStore/Model/Internal/Model+DateFormatting.swift b/Amplify/Categories/DataStore/Model/Internal/Model+DateFormatting.swift index 34e6541804..f1ef154af8 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Model+DateFormatting.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Model+DateFormatting.swift @@ -7,8 +7,9 @@ import Foundation -/// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly -/// by host applications. The behavior of this may change without warning. +/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly +/// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change +/// to these `public` types should be backward compatible, otherwise it will be a breaking change. public struct ModelDateFormatting { public static let decodingStrategy: JSONDecoder.DateDecodingStrategy = { @@ -34,8 +35,9 @@ public struct ModelDateFormatting { public extension JSONDecoder { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. convenience init(dateDecodingStrategy: JSONDecoder.DateDecodingStrategy) { self.init() self.dateDecodingStrategy = dateDecodingStrategy @@ -44,8 +46,9 @@ public extension JSONDecoder { public extension JSONEncoder { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. convenience init(dateEncodingStrategy: JSONEncoder.DateEncodingStrategy) { self.init() self.dateEncodingStrategy = dateEncodingStrategy diff --git a/Amplify/Categories/DataStore/Model/Internal/Model+Subscript.swift b/Amplify/Categories/DataStore/Model/Internal/Model+Subscript.swift index 7bb3d3efa9..77f73eba7c 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Model+Subscript.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Model+Subscript.swift @@ -12,8 +12,9 @@ /// ``` extension Model { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public subscript(_ key: String) -> Any?? { if let jsonModel = self as? JSONValueHolder { diff --git a/Amplify/Categories/DataStore/Model/Internal/ModelRegistry+Syncable.swift b/Amplify/Categories/DataStore/Model/Internal/ModelRegistry+Syncable.swift index 3c14c26b5f..0b0020f3d9 100644 --- a/Amplify/Categories/DataStore/Model/Internal/ModelRegistry+Syncable.swift +++ b/Amplify/Categories/DataStore/Model/Internal/ModelRegistry+Syncable.swift @@ -7,8 +7,9 @@ public extension ModelRegistry { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. static var hasSyncableModels: Bool { if #available(iOS 13.0, *) { return modelSchemas.contains { !$0.isSystem } diff --git a/Amplify/Categories/DataStore/Model/Internal/Persistable.swift b/Amplify/Categories/DataStore/Model/Internal/Persistable.swift index 4a0cf51ccb..39b33d21bd 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Persistable.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Persistable.swift @@ -42,8 +42,9 @@ struct PersistableHelper { /// - lhs: a reference to a Persistable object /// - rhs: another reference /// - Returns: `true` in case both values are equal or `false` otherwise - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public static func isEqual(_ lhs: Persistable?, _ rhs: Persistable?) -> Bool { if lhs == nil && rhs == nil { return true diff --git a/Amplify/Categories/DataStore/Model/Internal/Schema/Model+Schema.swift b/Amplify/Categories/DataStore/Model/Internal/Schema/Model+Schema.swift index 1fe37a36d0..14ac67eb1b 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Schema/Model+Schema.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Schema/Model+Schema.swift @@ -9,15 +9,17 @@ import Foundation extension Model { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public static var schema: ModelSchema { // TODO load schema from JSON when this it not overridden by specific models ModelSchema(name: modelName, fields: [:]) } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var schema: ModelSchema { type(of: self).schema } diff --git a/Amplify/Categories/DataStore/Model/Internal/Schema/ModelField+Association.swift b/Amplify/Categories/DataStore/Model/Internal/Schema/ModelField+Association.swift index faa1d18de1..2fb110d03a 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Schema/ModelField+Association.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Schema/ModelField+Association.swift @@ -113,8 +113,9 @@ public enum ModelAssociation { extension ModelField { - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var hasAssociation: Bool { return association != nil } @@ -122,8 +123,9 @@ extension ModelField { /// If the field represents an association returns the `Model.Type`. /// - seealso: `ModelFieldType` /// - seealso: `ModelFieldAssociation` - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. @available(*, deprecated, message: """ Use of associated model type is deprecated, use `associatedModelName` instead. """) @@ -139,8 +141,9 @@ extension ModelField { /// If the field represents an association returns the `ModelName`. /// - seealso: `ModelFieldType` /// - seealso: `ModelFieldAssociation` - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var associatedModelName: ModelName? { switch type { case .model(let modelName), .collection(let modelName): @@ -157,8 +160,9 @@ extension ModelField { /// /// - Note: as a maintainer, make sure you use this computed property only when context /// allows (i.e. the field is a valid relationship, such as foreign keys). - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. @available(*, deprecated, message: """ Use of requiredAssociatedModel with Model.Type is deprecated, use `requiredAssociatedModelName` that return ModelName instead. @@ -180,8 +184,9 @@ extension ModelField { /// /// - Note: as a maintainer, make sure you use this computed property only when context /// allows (i.e. the field is a valid relationship, such as foreign keys). - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var requiredAssociatedModelName: ModelName { guard let modelName = associatedModelName else { preconditionFailure(""" @@ -192,8 +197,9 @@ extension ModelField { return modelName } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var isAssociationOwner: Bool { guard case .belongsTo = association else { return false @@ -201,8 +207,9 @@ extension ModelField { return true } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var associatedField: ModelField? { if hasAssociation { let associatedModel = requiredAssociatedModelName @@ -225,8 +232,9 @@ extension ModelField { return nil } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var isOneToOne: Bool { if case .hasOne = association { return true @@ -237,8 +245,9 @@ extension ModelField { return false } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var isOneToMany: Bool { if case .hasMany = association, case .belongsTo = associatedField?.association { return true @@ -246,8 +255,9 @@ extension ModelField { return false } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var isManyToOne: Bool { if case .belongsTo = association, case .hasMany = associatedField?.association { return true @@ -255,8 +265,9 @@ extension ModelField { return false } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. @available(*, deprecated, message: """ Use `embeddedType` is deprecated, use `embeddedTypeSchema` instead. """) @@ -272,8 +283,9 @@ extension ModelField { } } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var embeddedTypeSchema: ModelSchema? { switch type { case .embedded(_, let modelSchema), .embeddedCollection(_, let modelSchema): @@ -283,8 +295,9 @@ extension ModelField { } } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public var isEmbeddedType: Bool { switch type { case .embedded, .embeddedCollection: diff --git a/Amplify/Categories/DataStore/Model/Internal/Schema/ModelValueConverter.swift b/Amplify/Categories/DataStore/Model/Internal/Schema/ModelValueConverter.swift index f0750019be..47cbb22a91 100644 --- a/Amplify/Categories/DataStore/Model/Internal/Schema/ModelValueConverter.swift +++ b/Amplify/Categories/DataStore/Model/Internal/Schema/ModelValueConverter.swift @@ -47,15 +47,17 @@ extension ModelValueConverter { JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy) } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public static func toJSON(_ value: Encodable) throws -> String? { let data = try jsonEncoder.encode(value.eraseToAnyEncodable()) return String(data: data, encoding: .utf8) } - /// - Warning: Although this has `public` access, it is intended for internal use and should not be used directly - /// by host applications. The behavior of this may change without warning. + /// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used directly + /// by host applications. The behavior of this may change without warning. Though it is not used by host application making any change + /// to these `public` types should be backward compatible, otherwise it will be a breaking change. public static func fromJSON(_ value: String) throws -> Any? { guard let data = value.data(using: .utf8) else { return nil