Skip to content

Commit 3185e9a

Browse files
committed
docs: document known issue with JsonConverter under Scala 2 and update site navigation
- Added documentation for the `JsonConverter` issue with `Any` on Scala 2. - Introduced a "Known Issues" section in the site navigation.
1 parent ff4b750 commit 3185e9a

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

docs/.vitepress/config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,17 @@ function sidebarDocumentation() {
141141
collapsible: true,
142142
collapsed: true,
143143
},
144+
{
145+
text: 'Known Issues',
146+
link: '/documentation/known-issues', items: [
147+
{text: 'Json Converter', link: '/documentation/known-issues/json-converter'},
148+
],
149+
collapsible: true,
150+
collapsed: true,
151+
},
144152
{
145153
text: 'LocalServer',
146154
link: '/documentation/local-server'
147-
}
155+
},
148156
]
149157
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Known Issues
2+
3+
* [Json Converter](json-converter.md)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Known Issues - Json Converter
2+
3+
## Scala 2
4+
Under scala 2 the json converter have some issues with the json parser and the Any Class in `toJson` Method and needs an explicit cast to `Any`. Circe does not support this format by default.
5+
6+
For scala 3 you can ignore this issue.
7+
8+
<<< @/../src/test/scala/dev/mongocamp/driver/mongodb/json/JsonConversionSuite.scala#known-issue-any-format{scala}

src/test/scala/dev/mongocamp/driver/mongodb/json/JsonConversionSuite.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class JsonConversionSuite extends munit.FunSuite {
2020
}
2121

2222
test("Convert Case Class with Any to Json") {
23+
// #region known-issue-any-format
2324
val isScala3 = scala.util.Properties.versionNumberString.startsWith("3.")
2425
val jString3: String = if (isScala3) {
2526
jsonConverter.toJson(HelloWorld3("servus", "welt"))
@@ -28,6 +29,7 @@ class JsonConversionSuite extends munit.FunSuite {
2829
jsonConverter.toJson(HelloWorld3("servus", "welt").asInstanceOf[Any])
2930
}
3031
assertEquals(jString3, "{\"greetings\":\"servus\",\"name\":\"welt\"}")
32+
// #endregion known-issue-any-format
3133
}
3234

3335
test("Convert Json to Case Class with Option using anyFormat") {

0 commit comments

Comments
 (0)