Skip to content

Commit 24ac97d

Browse files
committed
fix example documentation
1 parent 3c0e8c3 commit 24ac97d

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

docs/openapi/working_with_examples/configuring_example_encoding.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ install(OpenApi) {
4646
The plugin provides three built-in encoding options: internal encoding using Swagger's library, kotlinx.serialization-based encoding, and custom encoding logic.
4747

4848

49+
### Jackson Encoding
50+
51+
This encoder uses Jackson configured for use with kotlin to convert example values to JSON
52+
53+
```kotlin
54+
install(OpenApi) {
55+
examples {
56+
encoder(ExampleEncoder.jackson())
57+
}
58+
}
59+
```
60+
61+
This is the default encoder and usually requires no additional configuration.
62+
63+
4964
### Internal Encoding
5065

5166
The internal encoder uses the Swagger library's built-in serialization:
@@ -58,7 +73,7 @@ install(OpenApi) {
5873
}
5974
```
6075

61-
This is the default encoder and requires no additional configuration. It usually uses Jackson internally to convert example values to JSON.
76+
It usually uses Jackson internally to convert example values to JSON.
6277

6378

6479
### Kotlinx.Serialization Encoding

examples/src/main/kotlin/io/github/smiley4/ktoropenapi/examples/Basics.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ private fun Application.myModule() {
5858
url = "https://www.example.com"
5959
description = "Production Server"
6060
}
61+
examples {
62+
encoder(ExampleEncoder.jackson())
63+
}
6164
}
6265

6366
routing {

0 commit comments

Comments
 (0)