You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the project I'm working on, we have some scalars associated with java.time classes like LocalDateTime and Instant, and I wanted to map them to these classes with the scalars config, but the java.time classes are not imported. I tried using the add plugin to add an import java.time.*, but the import ended up on top of the package definition, causing an error
Am I configuring the plugin correctly? I have been working on this package a little while ago
My schema:
(...)
scalar LocalDateTime
scalar Instant
scalar Long
input AppointmentQueryInput {
userId: Long
time: LocalDateTime
}
(...)
The codegen.yml:
(...)
plugins:
- kotlin
config:
listType: List
scalars:
Long: Long
LocalDateTime: java.time#LocalDateTime
Instant: java.time#Instant
The generated class:
data class AppointmentQueryInput(
val time: LocalDateTime? = null,
val userId: Long? = null
) {
constructor(args: Map<String, Any>) : this(
args["time"] as LocalDateTime?,
args["userId"] as Long?
)
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi !
In the project I'm working on, we have some scalars associated with
java.time
classes likeLocalDateTime
andInstant
, and I wanted to map them to these classes with thescalars
config, but thejava.time
classes are not imported. I tried using theadd
plugin to add animport java.time.*
, but theimport
ended up on top of the package definition, causing an errorAm I configuring the plugin correctly? I have been working on this package a little while ago
My schema:
The
codegen.yml
:The generated class:
Thank you for your help!
PS. Thank you for this package! ❤️
Beta Was this translation helpful? Give feedback.
All reactions