-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Open
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When having next spec:
definitions:
UuidTest:
type: object
required:
- uuidReq
properties:
uuidReq:
type: string
format: uuid
example: 72f98069-206d-4f12-9f12-3d1e525a8e84
uuidNoReq:
type: string
format: uuid
example: 72f98069-206d-4f12-9f12-3d1e525a8e84the generator generates next code:
@Serializable
data class UuidTest(
val uuidReq: UUID,
var uuidNoReq: UUID,
)which causes next compilation error after running gradle assemble:
Details: kotlinx.serialization compiler plugin internal error: unable to transform declaration, see cause
...
Caused by: java.lang.IllegalStateException: Serializer for element of type java.util.UUID? has not been found
at org.jetbrains.kotlinx.serialization.compiler.backend.ir.SerializerSearchUtilKt.findTypeSerializerOrContext(SerializerSearchUtil.kt:84)
To solve this issue is it should generate next kotlin code with the annotation @Contextual from kotlinx.serialization package:
@Serializable
data class UuidTest(
@Contextual
val uuidReq: UUID,
@Contextual
var uuidNoReq: UUID,
)openapi-generator version
7.4.0
Generation Details
openapi-generator generate -i uuid-test.yaml -g kotlin-serverSuggest a fix
Reactions are currently unavailable