Skip to content

Commit eea90b4

Browse files
authored
chore(gwkt): migrate to snakeyaml-engine-kmp (#1338)
1 parent 3d62dd6 commit eea90b4

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

github-workflows-kt/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ group = rootProject.group
1919
version = rootProject.version
2020

2121
dependencies {
22-
implementation("org.snakeyaml:snakeyaml-engine:2.7")
22+
implementation("it.krzeminski:snakeyaml-engine-kmp:2.7.5")
2323
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.6.3")
2424
implementation(projects.sharedInternal)
2525

github-workflows-kt/src/main/kotlin/io/github/typesafegithub/workflows/yaml/ObjectToYaml.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import org.snakeyaml.engine.v2.events.SequenceStartEvent
1616
import org.snakeyaml.engine.v2.events.StreamEndEvent
1717
import org.snakeyaml.engine.v2.events.StreamStartEvent
1818
import java.io.StringWriter
19-
import java.util.Optional
2019

2120
internal fun Any.toYaml(): String {
2221
val settings =
@@ -33,7 +32,7 @@ internal fun Any.toYaml(): String {
3332
}
3433
val emitter = Emitter(settings, writer)
3534
emitter.emit(StreamStartEvent())
36-
emitter.emit(DocumentStartEvent(false, Optional.empty(), emptyMap()))
35+
emitter.emit(DocumentStartEvent(false, null, emptyMap()))
3736

3837
this.elementToYaml(emitter)
3938

@@ -52,14 +51,14 @@ private fun Any?.elementToYaml(emitter: Emitter) {
5251
}
5352

5453
private fun Map<*, *>.mapToYaml(emitter: Emitter) {
55-
emitter.emit(MappingStartEvent(Optional.empty(), Optional.empty(), true, FlowStyle.BLOCK))
54+
emitter.emit(MappingStartEvent(null, null, true, FlowStyle.BLOCK))
5655

5756
this.forEach { (key, value) ->
5857
// key
5958
emitter.emit(
6059
ScalarEvent(
61-
Optional.empty(),
62-
Optional.empty(),
60+
null,
61+
null,
6362
ImplicitTuple(true, true),
6463
key.toString(),
6564
ScalarStyle.PLAIN,
@@ -73,7 +72,7 @@ private fun Map<*, *>.mapToYaml(emitter: Emitter) {
7372
}
7473

7574
private fun List<*>.listToYaml(emitter: Emitter) {
76-
emitter.emit(SequenceStartEvent(Optional.empty(), Optional.empty(), true, FlowStyle.BLOCK))
75+
emitter.emit(SequenceStartEvent(null, null, true, FlowStyle.BLOCK))
7776

7877
this.forEach { value ->
7978
value.elementToYaml(emitter)
@@ -94,6 +93,6 @@ private fun Any?.scalarToYaml(emitter: Emitter) {
9493
ScalarStyle.PLAIN
9594
}
9695
emitter.emit(
97-
ScalarEvent(Optional.empty(), Optional.empty(), ImplicitTuple(true, true), this.toString(), scalarStyle),
96+
ScalarEvent(null, null, ImplicitTuple(true, true), this.toString(), scalarStyle),
9897
)
9998
}

0 commit comments

Comments
 (0)