Skip to content

Generated @Serializable classes with date-time (kotlin.time.Instant) fields fail to compile (missing serializer) #89

Description

@halotukozak

Description

date-time schema fields are mapped to kotlin.time.Instant, but no serializer is generated or registered for it. Generated @Serializable data classes with a date-time property fail to compile:

e: .../model/Pet.kt:27:25 Serializer has not been found for type 'Instant?'.
To use context serializer as fallback, explicitly annotate type or property with @Contextual

kotlinx-serialization (1.8.1) has no built-in serializer for the new stdlib kotlin.time.Instant. UUID fields already get a generated UuidSerializer + @UseSerializers; date-time needs equivalent handling.

How to reproduce

Generate a client from a spec with a property { type: string, format: date-time } inside a component schema, then compile the output.

Acceptance criteria

  • @Serializable classes with date-time properties compile
  • A serializer for kotlin.time.Instant is generated/registered (mirroring the UUID approach) or another supported mapping is chosen
  • Covered by the compilation test (re-add a date-time field to the feature-rich spec in JustworksPluginFunctionalTest)

Discovered in

PR #88 (compilation test for #46) — the date-time field was omitted from the test spec to keep that PR focused.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No fields configured for Bug.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions