JacksonFieldMetadataRetrievalStrategy is incompatible with kotlinx.serialization @Serializable classes

This issue has been created since 2022-06-24.

Introduced in: #467 #687

The implementation uses the first constructor found:

However, a class annotated with @Serializable gets an extra constructor, and the code picks this one first.

@kotlinx.serialization.Serializable
data class ExampleDto(
    // This annotation DOES NOT WORK if you use kotlinx.serialization @Serializable on this class.
    @JsonPropertyDescription("The unique id for this entity")
    val id: String
)

REPL output:

 val size = ExampleDto::class.constructors.size
 val metadata = JacksonFieldMetadataRetrievalStrategy.invoke(ExampleDto("1"), "id")
 println("There are $size constructors and the metadata is ${metadata.extra}")

There are 2 constructors and the metadata is {}

If I remove only the @Serializable annotation and run the same code, I get this output:
There are 1 constructors and the metadata is {description=The unique id for this entity}

daviddenton wrote this answer on 2022-06-25

Interesting. As an aside, you can manually create the open API renderer instance and omitting the offending class from the list.

More Details About Repo
Owner Name http4k
Repo Name http4k
Full Name http4k/http4k
Language Kotlin
Created Date 2017-03-23
Updated Date 2022-09-20
Star Count 2097
Watcher Count 27
Fork Count 202
Issue Count 30

YOU MAY BE INTERESTED

Issue Title Created Date Comment Count Updated Date
Support for Multiline data for Fields 50F and 59F 5 2020-07-24 2022-08-30
Please provide Cargo.lock 2 2021-07-07 2022-05-26
This parser can't support a document that big 17 2021-08-19 2022-05-24
Locale path in AWS S3 14 2020-09-06 2022-07-18
Auto start entry points to temporary file on linux. 2 2020-03-26 2022-08-21
Cannot click outside dialog (not closing) 11 2022-01-24 2022-07-30
get_all_news() doesn't work 0 2020-10-02 2022-08-31
Failure in `OffsetForLeaderEpochTest.test_offset_for_leader_epoch` 7 2022-02-28 2022-07-15
remove reference to ansible.tower in the meta files for roles 1 2021-08-24 2022-09-26
Building MacOS package results . Lua files placed in the wrong directory 0 2022-04-26 2022-07-31
[Bug] Gamelog.txt isn't generated (generate system info on load/new game) 2 2022-05-22 2022-07-31
[Bug] RoleMembers completely broken 8 2021-07-17 2022-01-16
Lots of weird regressions since updating 21 2022-03-26 2022-09-24
[feature request] virtual keyboard support. 2 2022-03-23 2022-09-09
feat request: fallback pipe for missing emojis 2 2021-03-19 2022-09-13
URL not found for initial download 0 2021-11-28 2022-07-23
provide `finalized headers abstraction` that fetches "skipped" blocks when subscribing to `chain_finalizedHeads` 3 2022-08-23 2022-09-21
electrified crucible with stone 0 2021-09-21 2022-09-25
Integration with Plots.jl 28 2020-03-24 2022-09-21
Select Image in Task List 1 2022-07-21 2022-08-03
Don't have logic depend on document.title 0 2022-03-24 2022-09-15
Installation of a release should use that release's image tag 5 2022-04-11 2022-09-29
[BUG] 用戶可以把配置文件中max_port參數設置到65535之上以提高用戶注冊數量的限制 1 2021-07-16 2022-09-20
In docstrings, the parameter type "container" has ambiguous meaning 4 2022-03-08 2022-09-11
Polyvariant attributes: to bump or not to bump 3 2021-02-18 2022-09-09
It's very slowly when insert 400000 datas, and it will take 130 seconds 2 2021-02-23 2022-09-05
是否支持上传图片尺寸调整,增加编辑页面 Ctrl+S 保存页面功能 1 2021-06-30 2022-09-20
Web settings: Mantine 5.0.0 0 2022-07-25 2022-08-25
No result found using uuid_binary_ordered_time 4 2020-06-04 2022-09-07
Outdated Data Docs link appear in Slack notifications 2 2022-05-18 2022-09-27
Risk check from background not reliable 22 2021-11-17 2022-09-23
Access directories which look like files on Mac 3 2021-10-05 2022-09-17
Support for accessibility (and more props in MessageComponent) 1 2020-05-28 2022-09-28
Disable C99 format specifier support for newlib nano 1 2022-07-08 2022-09-20
Unable to upgrade to ERPNEXT v13.15.1 and FRAPPE v13.15.0 - /assets/* permission errors 8 2021-11-29 2022-01-28
Error when calling trained model: "AttributeError: tuple object has no attribute "as_list" 3 2021-11-01 2022-09-21
Node sync not happening at all 24 2022-06-21 2022-09-29
How can I reduce the storage usage 7 2022-06-21 2022-08-23
🛑 Matomo is down 1 2021-10-15 2021-10-31
Back button not functional when choosing custom wallpaper from photos 0 2021-09-15 2022-07-30
add test to check successful container restart 2 2021-05-11 2022-08-23
Exclude directories starting with . 1 2015-12-21 2022-09-29
Music missing in Phoenix (1980) 16 2021-07-02 2022-09-24
az login PersistenceDecryptionError 2 2022-08-10 2022-08-09
View has lost track of its superview, most likely through unsupported use of CALayer API on the view's layer 1 2020-12-24 2022-02-06
[CoE Starter Kit - BUG] - Search in App Access View is not working Power Platform Users for the maker 3 2021-11-26 2022-09-15
[🐛]🔥 Cloud Functions returning Unauthorized when adding App Check 6 2021-08-19 2022-09-14
Domain tip in wp-admin - link rephrasing request 4 2022-07-20 2022-09-20
problem in read arabic character 0 2021-01-20 2022-08-27
Disable the environment info contributor by default 2 2021-10-13 2022-09-10