bkbnio / kompendium

Ktor OpenAPI Spec Generator
https://bkbn.gitbook.io/kompendium
MIT License
151 stars 22 forks source link

Unexpected types #642

Open oSumAtrIX opened 1 day ago

oSumAtrIX commented 1 day ago

My model:

image

Usage in Kompendium:

image

Result:

image

The type in question is kotlinx.datetime.LocalDateTime. The question is, why is createdAt an object?

brizzbuzz commented 18 hours ago

https://bkbn.gitbook.io/kompendium/index-1/notarized_application#custom-types

see the doc here

oSumAtrIX commented 17 hours ago

I am aware of custom types, my question is about the default behavior

brizzbuzz commented 17 hours ago

the doc explains exactly why this is the case

brizzbuzz commented 17 hours ago

object representations of scalars

LocalDateTime is an object representation of a scalar value. so kompendium see that it is an object, and tries to serialize it as such.

oSumAtrIX commented 17 hours ago

But so is a nullable of that, and yet it is serialized as a string

brizzbuzz commented 16 hours ago

oh interesting... worth looking into! It probably would have been more clear what you were saying if you had written that out instead of just screenshots lol

but thanks for explaining