Skip to content

Commit 298f4d3

Browse files
authored
Merge branch 'main' into update/auxlib-0.5.4
2 parents 3cba491 + 83fa6fc commit 298f4d3

File tree

8 files changed

+35
-14
lines changed

8 files changed

+35
-14
lines changed

.github/workflows/ci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
runs-on: ${{ matrix.os }}
4343
timeout-minutes: 60
4444
steps:
45+
- name: Install sbt
46+
if: contains(runner.os, 'macos')
47+
run: brew install sbt
48+
4549
- name: Checkout current branch (full)
4650
uses: actions/checkout@v4
4751
with:
@@ -128,6 +132,10 @@ jobs:
128132
java: [temurin@11]
129133
runs-on: ${{ matrix.os }}
130134
steps:
135+
- name: Install sbt
136+
if: contains(runner.os, 'macos')
137+
run: brew install sbt
138+
131139
- name: Checkout current branch (full)
132140
uses: actions/checkout@v4
133141
with:
@@ -252,6 +260,10 @@ jobs:
252260
java: [temurin@11]
253261
runs-on: ${{ matrix.os }}
254262
steps:
263+
- name: Install sbt
264+
if: contains(runner.os, 'macos')
265+
run: brew install sbt
266+
255267
- name: Checkout current branch (full)
256268
uses: actions/checkout@v4
257269
with:

.scalafmt.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.8.2
1+
version = 3.8.3
22
runner.dialect = scala213
33
continuationIndent.defnSite = 2
44
docstrings.style = Asterisk

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.circe/circe-yaml_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.circe/circe-yaml_2.12)
66

77
This is a small library for parsing [YAML](https://yaml.org) into [circe](https://github.com/circe/circe)'s `Json` AST.
8-
* For parsing YAML 1.1 it uses [SnakeYAML](https://bitbucket.org/snakeyaml/snakeyaml).
9-
* For parsing YAML 1.2 it uses [snakeyaml-engine](https://bitbucket.org/snakeyaml/snakeyaml-engine).
8+
You can choose from multiple YAML backends:
9+
* `circe-yaml`: For parsing YAML 1.1 it uses [SnakeYAML](https://bitbucket.org/snakeyaml/snakeyaml).
10+
* `circe-yaml-v12`: For parsing YAML 1.2 it uses [snakeyaml-engine](https://bitbucket.org/snakeyaml/snakeyaml-engine).
11+
* `circe-yaml-scalayaml`: For parsing YAML on Scala.js or Scala Native (as well as Scala/JVM) it uses [scala-yaml](https://github.com/VirtusLab/scala-yaml).
1012

1113
## Why?
1214

@@ -24,11 +26,15 @@ The artifact is hosted by Sonatype, and release versions are synced to Maven Cen
2426

2527
For YAML 1.1
2628
```scala
27-
libraryDependencies += "io.circe" %% "circe-yaml" % "0.14.2"
29+
libraryDependencies += "io.circe" %% "circe-yaml" % "0.16.0"
2830
```
2931
or for YAML 1.2
3032
```scala
31-
libraryDependencies += "io.circe" %% "circe-yaml-v12" % "0.14.2"
33+
libraryDependencies += "io.circe" %% "circe-yaml-v12" % "0.16.0"
34+
```
35+
or for YAML on Scala.js or Scala Native (as well as Scala/JVM)
36+
```scala
37+
libraryDependencies += "io.circe" %% "circe-yaml-scalayaml" % "0.16.0"
3238
```
3339

3440
Snapshot versions are available by adding the Sonatype Snapshots resolver:

build.sbt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ThisBuild / tlBaseVersion := "0.15"
1+
ThisBuild / tlBaseVersion := "0.16"
22
ThisBuild / circeRootOfCodeCoverage := None
33
ThisBuild / startYear := Some(2016)
44
ThisBuild / tlFatalWarnings := false //TODO: ... fix this someday
@@ -33,7 +33,7 @@ val root = tlCrossRootProject.aggregate(
3333
lazy val `circe-yaml-common` = crossProject(JSPlatform, JVMPlatform, NativePlatform)
3434
.in(file("circe-yaml-common"))
3535
.settings(
36-
description := "Library for converting between SnakeYAML's AST (YAML 2.0) and circe's AST",
36+
description := "Common interface for circe-yaml.",
3737
libraryDependencies ++= Seq(
3838
"io.circe" %%% "circe-core" % Versions.circe
3939
),
@@ -44,7 +44,7 @@ lazy val `circe-yaml` = project
4444
.in(file("circe-yaml"))
4545
.dependsOn(`circe-yaml-common`.jvm)
4646
.settings(
47-
description := "Library for converting between SnakeYAML's AST (YAML 2.0) and circe's AST",
47+
description := "Library for converting between SnakeYAML's AST (YAML 1.1) and circe's AST",
4848
libraryDependencies ++= Seq(
4949
"org.yaml" % "snakeyaml" % Versions.snakeYaml,
5050
"io.circe" %% "circe-jawn" % Versions.circe % Test,
@@ -61,7 +61,7 @@ lazy val `circe-yaml-v12` = project
6161
.in(file("circe-yaml-v12"))
6262
.dependsOn(`circe-yaml-common`.jvm)
6363
.settings(
64-
description := "Library for converting between snakeyaml-engine's AST (YAML 2.0) and circe's AST",
64+
description := "Library for converting between snakeyaml-engine's AST (YAML 1.2) and circe's AST",
6565
libraryDependencies ++= Seq(
6666
"io.circe" %% "circe-jawn" % Versions.circe % Test,
6767
"org.snakeyaml" % "snakeyaml-engine" % Versions.snakeYamlEngine,
@@ -79,7 +79,7 @@ lazy val `circe-yaml-scalayaml` = crossProject(JSPlatform, JVMPlatform, NativePl
7979
.settings(
8080
description := "Library for converting between scala-yaml AST and circe's AST",
8181
libraryDependencies ++= Seq(
82-
"org.virtuslab" %%% "scala-yaml" % "0.1.0",
82+
"org.virtuslab" %%% "scala-yaml" % "0.3.0",
8383
"org.scalatest" %%% "scalatest" % Versions.scalaTest % Test
8484
),
8585
tlVersionIntroduced := List("2.13", "3").map(_ -> "0.15.3").toMap

circe-yaml-scalayaml/shared/src/main/scala/io/circe/yaml/scalayaml/Printer.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import io.circe.Json
2020
import org.virtuslab.yaml.Node
2121
import org.virtuslab.yaml.NodeOps
2222

23+
import scala.collection.immutable.ListMap
24+
2325
object Printer extends io.circe.yaml.common.Printer {
2426

2527
override def pretty(json: Json): String = {
@@ -31,7 +33,8 @@ object Printer extends io.circe.yaml.common.Printer {
3133
case Json.JArray(value) =>
3234
Node.SequenceNode(value.map(jsonToNode): _*)
3335
case Json.JObject(value) =>
34-
Node.MappingNode(value.toMap.map { case (key, value) => (Node.ScalarNode(key): Node) -> jsonToNode(value) })
36+
val mappings = value.toList.map { case (key, value) => (Node.ScalarNode(key): Node) -> jsonToNode(value) }
37+
Node.MappingNode(ListMap.from(mappings))
3538
case json =>
3639
Node.ScalarNode(json.toString)
3740
}

circe-yaml-scalayaml/shared/src/test/scala/io/circe/yaml/scalayaml/PrinterTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class PrinterTests extends AnyFreeSpec with Matchers {
7575

7676
"Drop null keys" in {
7777
val json = Json.obj("nullField" -> Json.Null, "nonNullField" -> Json.fromString("foo"))
78-
Printer.pretty(json) shouldEqual "nullField: null\nnonNullField: \"foo\"\n"
78+
Printer.pretty(json) shouldEqual "nullField: !!null\nnonNullField: \"foo\"\n"
7979
}
8080

8181
"Root integer" in {

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version = 1.10.0
1+
sbt.version = 1.10.1

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.1")
1+
addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.2")
22
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.4")
33
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
44
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")

0 commit comments

Comments
 (0)