Skip to content

Commit 932ef0a

Browse files
committed
Only add missing trustedtype conditionally (no longer needed in new versions)
1 parent c8d106e commit 932ef0a

File tree

1 file changed

+3
-1
lines changed
  • protocol-generator/cdp-kotlin-generator/src/main/kotlin/org/hildan/chrome/devtools/protocol/preprocessing

1 file changed

+3
-1
lines changed

protocol-generator/cdp-kotlin-generator/src/main/kotlin/org/hildan/chrome/devtools/protocol/preprocessing/JsonPreProcessor.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ internal fun List<JsonDomain>.preprocessed(): List<JsonDomain> = this
1616
// We both add the "trustedType" enum value because we know it pops uo even though it's not in the protocol,
1717
// but we also mark the enum as non-exhaustive, as suggested by Google folks, because more values may be unknown.
1818
.transformDomainTypeProperty("Runtime", "RemoteObject", "subtype") {
19-
it.copy(enum = it.enum.orEmpty() + "trustedtype", isNonExhaustiveEnum = true)
19+
// Temporarily conditional because the new protocol versions have this value now
20+
val newValues = if ("trustedtype" !in it.enum.orEmpty()) listOf("trustedtype") else emptyList()
21+
it.copy(enum = it.enum.orEmpty() + newValues, isNonExhaustiveEnum = true)
2022
}
2123
// Workaround for https://github.com/ChromeDevTools/devtools-protocol/issues/244
2224
.map { it.pullNestedEnumsToTopLevel() }

0 commit comments

Comments
 (0)