Skip to content

Commit d3b7887

Browse files
committed
Merge remote-tracking branch 'origin/feature/v3' into tvaleev/feature/RUM-9899_2
# Conflicts: # features/dd-sdk-android-trace/src/main/kotlin/com/datadog/android/trace/internal/domain/event/CoreTracerSpanToSpanEventMapper.kt # features/dd-sdk-android-trace/src/main/kotlin/com/datadog/android/trace/internal/domain/event/DdSpanToSpanEventMapper.kt
2 parents e60b523 + 5957478 commit d3b7887

File tree

25 files changed

+1303
-236
lines changed

25 files changed

+1303
-236
lines changed

buildSrc/src/main/kotlin/com/datadog/gradle/plugin/jsonschema/JsonSchemaReader.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ class JsonSchemaReader(
6262
return loadDefinitionFromFileRef(path, localRef, fromFile)
6363
}
6464

65-
val name = REF_DEFINITION_REGEX.matchEntire(ref)?.groupValues?.get(1)
65+
val fieldGroups = REF_NAME_REGEX.matchEntire(ref)?.groupValues
66+
val type = fieldGroups?.get(1)
67+
val name = fieldGroups?.get(2)
6668
val id = REF_ID_REGEX.matchEntire(ref)?.groupValues?.get(0)
6769
if (name == null && id == null) return null
6870

@@ -73,7 +75,10 @@ class JsonSchemaReader(
7375
}
7476

7577
val match = knownSchemas[fromFile]
76-
?.definitions
78+
?.let {
79+
// only explicit properties lookup supported
80+
if (type == REF_TYPE_PROPERTIES) it.properties else it.definitions
81+
}
7782
?.entries
7883
?.firstOrNull { matcher(it.key, it.value) } ?: return null
7984

@@ -417,8 +422,10 @@ class JsonSchemaReader(
417422
// endregion
418423

419424
companion object {
425+
private const val REF_TYPE_PROPERTIES = "properties"
426+
private const val REF_TYPE_DEFINITIONS = "definitions"
420427

421-
private val REF_DEFINITION_REGEX = Regex("#/definitions/([\\w]+)")
428+
private val REF_NAME_REGEX = Regex("#/($REF_TYPE_DEFINITIONS|$REF_TYPE_PROPERTIES)/([\\w]+)")
422429
private val REF_ID_REGEX = Regex("#[\\w]+")
423430
private val REF_FILE_REGEX = Regex("(file:)?(([^/]+/)*([^/]+)\\.json)(#(.*))?")
424431
}

buildSrc/src/test/kotlin/com/datadog/gradle/plugin/jsonschema/JsonSchemaReaderTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class JsonSchemaReaderTest(
8080
arrayOf("minimal", Person),
8181
arrayOf("required", Product),
8282
arrayOf("external_nested_description", Shipping),
83+
arrayOf("external_nested_description_properties", Shipping),
8384
arrayOf("enum", Style),
8485
arrayOf("all_of", User),
8586
arrayOf("all_of_merged", UserMerged),
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Shipping",
4+
"type": "object",
5+
"properties": {
6+
"item": {
7+
"type": "string"
8+
},
9+
"destination": {
10+
"$ref": "properties.json#/properties/billing_address"
11+
}
12+
},
13+
"required": [
14+
"item",
15+
"destination"
16+
]
17+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Customer",
4+
"type": "object",
5+
"properties": {
6+
"name": {
7+
"type": "string"
8+
},
9+
"billing_address": { "$ref": "#/definitions/address" },
10+
"shipping_address": { "$ref": "#/definitions/address" }
11+
},
12+
"definitions": {
13+
"address": {
14+
"type": "object",
15+
"properties": {
16+
"street_address": {
17+
"type": "string"
18+
},
19+
"city": {
20+
"type": "string"
21+
},
22+
"state": {
23+
"type": "string"
24+
}
25+
},
26+
"required": [
27+
"street_address",
28+
"city",
29+
"state"
30+
]
31+
}
32+
}
33+
}

features/dd-sdk-android-logs/api/apiSurface

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,29 @@ data class com.datadog.android.log.LogsConfiguration
3535
fun setEventMapper(com.datadog.android.event.EventMapper<com.datadog.android.log.model.LogEvent>): Builder
3636
fun build(): LogsConfiguration
3737
data class com.datadog.android.log.model.LogEvent
38-
constructor(Status, kotlin.String, kotlin.String, kotlin.String, Logger, Dd, Usr? = null, Account? = null, Network? = null, Error? = null, kotlin.String? = null, kotlin.String, kotlin.collections.MutableMap<kotlin.String, kotlin.Any?> = mutableMapOf())
38+
constructor(Device, Os, Status, kotlin.String, kotlin.String, kotlin.String, Logger, Usr? = null, Account? = null, Network? = null, Error? = null, kotlin.String? = null, kotlin.String, kotlin.collections.MutableMap<kotlin.String, kotlin.Any?> = mutableMapOf())
3939
fun toJson(): com.google.gson.JsonElement
4040
companion object
4141
fun fromJson(kotlin.String): LogEvent
4242
fun fromJsonObject(com.google.gson.JsonObject): LogEvent
43+
data class Device
44+
constructor(Type? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.collections.List<kotlin.String>? = null, kotlin.String? = null, kotlin.Number? = null, kotlin.Boolean? = null, kotlin.Number? = null)
45+
fun toJson(): com.google.gson.JsonElement
46+
companion object
47+
fun fromJson(kotlin.String): Device
48+
fun fromJsonObject(com.google.gson.JsonObject): Device
49+
data class Os
50+
constructor(kotlin.String, kotlin.String, kotlin.String? = null, kotlin.String)
51+
fun toJson(): com.google.gson.JsonElement
52+
companion object
53+
fun fromJson(kotlin.String): Os
54+
fun fromJsonObject(com.google.gson.JsonObject): Os
4355
data class Logger
4456
constructor(kotlin.String, kotlin.String? = null, kotlin.String)
4557
fun toJson(): com.google.gson.JsonElement
4658
companion object
4759
fun fromJson(kotlin.String): Logger
4860
fun fromJsonObject(com.google.gson.JsonObject): Logger
49-
data class Dd
50-
constructor(Device)
51-
fun toJson(): com.google.gson.JsonElement
52-
companion object
53-
fun fromJson(kotlin.String): Dd
54-
fun fromJsonObject(com.google.gson.JsonObject): Dd
5561
data class Usr
5662
constructor(kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.collections.MutableMap<kotlin.String, kotlin.Any?> = mutableMapOf())
5763
fun toJson(): com.google.gson.JsonElement
@@ -76,12 +82,6 @@ data class com.datadog.android.log.model.LogEvent
7682
companion object
7783
fun fromJson(kotlin.String): Error
7884
fun fromJsonObject(com.google.gson.JsonObject): Error
79-
data class Device
80-
constructor(kotlin.String)
81-
fun toJson(): com.google.gson.JsonElement
82-
companion object
83-
fun fromJson(kotlin.String): Device
84-
fun fromJsonObject(com.google.gson.JsonObject): Device
8585
data class Client
8686
constructor(SimCarrier? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String? = null, kotlin.String)
8787
fun toJson(): com.google.gson.JsonElement
@@ -112,3 +112,15 @@ data class com.datadog.android.log.model.LogEvent
112112
fun toJson(): com.google.gson.JsonElement
113113
companion object
114114
fun fromJson(kotlin.String): Status
115+
enum Type
116+
constructor(kotlin.String)
117+
- MOBILE
118+
- DESKTOP
119+
- TABLET
120+
- TV
121+
- GAMING_CONSOLE
122+
- BOT
123+
- OTHER
124+
fun toJson(): com.google.gson.JsonElement
125+
companion object
126+
fun fromJson(kotlin.String): Type

0 commit comments

Comments
 (0)