@@ -66,6 +66,7 @@ public struct ImageReference: Sendable, Equatable, CustomStringConvertible, Cust
6666 /// The tag or digest identifying the image.
6767 public var reference : Reference
6868
69+ /// Error thrown when an `ImageReference` string cannot be parsed.
6970 public enum ValidationError : Error {
7071 case unexpected( String )
7172 }
@@ -114,6 +115,11 @@ public struct ImageReference: Sendable, Equatable, CustomStringConvertible, Cust
114115 self . reference = reference
115116 }
116117
118+ /// Returns a Boolean value indicating whether two `ImageReference` values are equal.
119+ /// - Parameters:
120+ /// - lhs: First `ImageReference` to compare
121+ /// - rhs: Second `ImageReference` to compare
122+ /// - Returns: `True` if the `ImageReferences` are equal, otherwise `false`
117123 public static func == ( lhs: ImageReference , rhs: ImageReference ) -> Bool {
118124 " \( lhs) " == " \( rhs) "
119125 }
@@ -138,12 +144,16 @@ extension ImageReference {
138144 public struct Repository : Sendable , Equatable , CustomStringConvertible , CustomDebugStringConvertible {
139145 var value : String
140146
147+ /// Error thrown when a `Repository` string cannot be parsed.
141148 public enum ValidationError : Error , Equatable {
142149 case emptyString
143150 case containsUppercaseLetters( String )
144151 case invalidReferenceFormat( String )
145152 }
146153
154+ /// Creates an `ImageReference.Repository` instance from a string.
155+ /// - Parameter rawValue: A repository string
156+ /// - Throws: If `rawValue` cannot be parsed
147157 public init ( _ rawValue: String ) throws {
148158 // Reference handling in github.com/distribution reports empty and uppercase as specific errors.
149159 // All other errors caused are reported as generic format errors.
@@ -164,6 +174,7 @@ extension ImageReference {
164174 value = rawValue
165175 }
166176
177+ /// Printable description of a Reference in a form which can be understood by a runtime
167178 public var description : String {
168179 value
169180 }
@@ -185,12 +196,16 @@ extension ImageReference {
185196 public struct Tag : Reference , Sendable , Equatable , CustomStringConvertible , CustomDebugStringConvertible {
186197 var value : String
187198
199+ /// Error thrown when a `Tag` cannot be parsed.
188200 public enum ValidationError : Error , Equatable {
189201 case emptyString
190202 case invalidReferenceFormat( String )
191203 case tooLong( String )
192204 }
193205
206+ /// Creates a `Tag` instance from a string.
207+ /// - Parameter rawValue: A tag string
208+ /// - Throws: If `rawValue` cannot be parsed
194209 public init ( _ rawValue: String ) throws {
195210 guard rawValue. count > 0 else {
196211 throw ValidationError . emptyString
@@ -209,12 +224,19 @@ extension ImageReference {
209224 value = rawValue
210225 }
211226
227+ /// Returns a Boolean value indicating whether two `Tag` values are equal.
228+ /// - Parameters:
229+ /// - lhs: First `Tag` to compare
230+ /// - rhs: Second `Tag` to compare
231+ /// - Returns: `True` if the `Tag` are equal, otherwise `false`
212232 public static func == ( lhs: Tag , rhs: Tag ) -> Bool {
213233 lhs. value == rhs. value
214234 }
215235
236+ /// Value which separates the `tag` from the registry and repository parts of a image reference with a human readable tag
216237 public var separator : String = " : "
217238
239+ /// Printable description of a Tag in a form which can be understood by a runtime
218240 public var description : String {
219241 " \( value) "
220242 }
@@ -227,10 +249,14 @@ extension ImageReference {
227249
228250 /// Digest identifies a specific blob by the hash of the blob's contents.
229251 public struct Digest : Reference , Sendable , Equatable , CustomStringConvertible , CustomDebugStringConvertible {
252+ /// Represents a digest algorithm
230253 public enum Algorithm : String , Sendable {
231254 case sha256 = " sha256 "
232255 case sha512 = " sha512 "
233256
257+ /// Creates an `Algorithm` instance from a string.
258+ /// - Parameter rawValue: An algorithm string
259+ /// - Throws: If `rawValue` cannot be parsed
234260 init ( fromString rawValue: String ) throws {
235261 guard let algorithm = Algorithm ( rawValue: rawValue) else {
236262 throw RegistryClientError . invalidDigestAlgorithm ( rawValue)
@@ -242,11 +268,15 @@ extension ImageReference {
242268 var algorithm : Algorithm
243269 var value : String
244270
271+ /// Error thrown when a `Digest` cannot be parsed.
245272 public enum ValidationError : Error , Equatable {
246273 case emptyString
247274 case invalidReferenceFormat( String )
248275 }
249276
277+ /// Creates a `Digest` instance from a string.
278+ /// - Parameter rawValue: A digest string
279+ /// - Throws: If `rawValue` cannot be parsed
250280 public init ( _ rawValue: String ) throws {
251281 guard rawValue. count > 0 else {
252282 throw ValidationError . emptyString
@@ -271,12 +301,19 @@ extension ImageReference {
271301 throw ValidationError . invalidReferenceFormat ( rawValue)
272302 }
273303
304+ /// Returns a Boolean value indicating whether two `Digest` values are equal.
305+ /// - Parameters:
306+ /// - lhs: First `Digest` to compare
307+ /// - rhs: Second `Digest` to compare
308+ /// - Returns: `True` if the `Digest` are equal, otherwise `false`
274309 public static func == ( lhs: Digest , rhs: Digest ) -> Bool {
275310 lhs. algorithm == rhs. algorithm && lhs. value == rhs. value
276311 }
277312
313+ /// Value which separates the `digest` from the registry and repository parts of an image reference with a digest
278314 public var separator : String = " @ "
279315
316+ /// Printable description of a Digest in a form which can be understood by a runtime
280317 public var description : String {
281318 " \( algorithm) : \( value) "
282319 }
0 commit comments