Skip to content

Commit

Permalink
Fix RUMModelGenerator to avoid "description" as a property.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzybinary committed Feb 25, 2025
1 parent e529d2c commit 3c2c93f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions DatadogInternal/Tests/Telemetry/TelemetryMocks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extension ConfigurationTelemetry {
imagePrivacyLevel: .mockRandom(),
touchPrivacyLevel: .mockRandom(),
initializationType: .mockRandom(),
invTimeThresholdMs: .mockRandom(),
mobileVitalsUpdatePeriod: .mockRandom(),
reactNativeVersion: .mockRandom(),
reactVersion: .mockRandom(),
Expand All @@ -35,6 +36,7 @@ extension ConfigurationTelemetry {
startRecordingImmediately: .mockRandom(),
telemetryConfigurationSampleRate: .mockRandom(),
telemetrySampleRate: .mockRandom(),
tnsTimeThresholdMs: .mockRandom(),
tracerAPI: .mockRandom(),
tracerAPIVersion: .mockRandom(),
traceSampleRate: .mockRandom(),
Expand Down
4 changes: 2 additions & 2 deletions DatadogObjc/Sources/RUM/RUMDataModels+objc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7119,7 +7119,7 @@ public class DDRUMVitalEventVital: NSObject {
}

@objc public var vitalDescription: String? {
root.swiftModel.vital.description
root.swiftModel.vital.vitalDescription
}

@objc public var duration: NSNumber? {
Expand Down Expand Up @@ -8467,4 +8467,4 @@ public class DDTelemetryConfigurationEventView: NSObject {

// swiftlint:enable force_unwrapping

// Generated from https://github.com/DataDog/rum-events-format/tree/f4f07ec83fc8eea25e6e2781d053d65d14eb89c1
// Generated from https://github.com/DataDog/rum-events-format/tree/69147431d689b3e59bff87e15bb0088a9bb319a9
6 changes: 3 additions & 3 deletions DatadogRUM/Sources/DataModels/RUMDataModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3595,7 +3595,7 @@ public struct RUMVitalEvent: RUMDataModel {
public let custom: [String: Double]?

/// Description of the vital. It can be used as a secondary identifier (URL, React component name...)
public let description: String?
public let vitalDescription: String?

/// Duration of the vital in nanoseconds
public let duration: Double?
Expand All @@ -3611,7 +3611,7 @@ public struct RUMVitalEvent: RUMDataModel {

enum CodingKeys: String, CodingKey {
case custom = "custom"
case description = "description"
case vitalDescription = "description"
case duration = "duration"
case id = "id"
case name = "name"
Expand Down Expand Up @@ -5591,4 +5591,4 @@ public struct RUMTelemetryOperatingSystem: Codable {
}
}

// Generated from https://github.com/DataDog/rum-events-format/tree/f4f07ec83fc8eea25e6e2781d053d65d14eb89c1
// Generated from https://github.com/DataDog/rum-events-format/tree/69147431d689b3e59bff87e15bb0088a9bb319a9
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ public class RUMCodeDecorator: SwiftCodeDecorator {
`struct`.conformance = [rumDataModelProtocol] // Conform root structs to `RUMDataModel`
}

// Vital has a member `description` that needs to be renamed for Obj-C
`struct`.properties = `struct`.properties.map {
var prop = $0
if prop.name == "description" {
prop.name = "\(`struct`.name.lowerCamelCased)Description"
}
return prop
}

return `struct`
}

Expand Down

0 comments on commit 3c2c93f

Please sign in to comment.