brightdigit/MistKit

View on GitHub
Sources/MistKit/Models/RecordName.swift

Summary

Maintainability
A
0 mins
Test Coverage
import Foundation

public struct RecordName: Codable {
  public let uuid: UUID
  public init(from decoder: Decoder) throws {
    let uuidString = try decoder.singleValueContainer().decode(String.self)
    guard let uuid = RecordNameParser.uuid(fromRecordName: uuidString) else {
      throw MKError.invalidRecordName(uuidString)
    }
    self.uuid = uuid
  }
}