diff --git a/src/compiler/core/src/commonMain/kotlin/community/flock/wirespec/compiler/core/emit/JavaEmitter.kt b/src/compiler/core/src/commonMain/kotlin/community/flock/wirespec/compiler/core/emit/JavaEmitter.kt index 0c18f24e..6fc69708 100644 --- a/src/compiler/core/src/commonMain/kotlin/community/flock/wirespec/compiler/core/emit/JavaEmitter.kt +++ b/src/compiler/core/src/commonMain/kotlin/community/flock/wirespec/compiler/core/emit/JavaEmitter.kt @@ -239,7 +239,7 @@ class JavaEmitter( .joinToString(", ") { it.emit() } } - private fun List.emitMap() = joinToString(", ", "java.util.Map.of(", ")") { "\"${it.identifier.value}\", java.util.List.of(${it.identifier.emit()})" } + private fun List.emitMap() = joinToString(", ", "java.util.Map.ofEntries(", ")") { "java.util.Map.entry(\"${it.identifier.value}\", java.util.List.of(${it.identifier.emit()}))" } private fun List.emitSegment() = "/" + joinToString("/") { when (it) { diff --git a/src/openapi/src/commonMain/kotlin/community/flock/wirespec/openapi/v3/OpenApiParser.kt b/src/openapi/src/commonMain/kotlin/community/flock/wirespec/openapi/v3/OpenApiParser.kt index a3723575..452efbc8 100644 --- a/src/openapi/src/commonMain/kotlin/community/flock/wirespec/openapi/v3/OpenApiParser.kt +++ b/src/openapi/src/commonMain/kotlin/community/flock/wirespec/openapi/v3/OpenApiParser.kt @@ -470,8 +470,9 @@ class OpenApiParser(private val openApi: OpenAPIObject) { is SchemaObject -> { Field( identifier = Field.Identifier(key), - reference = when(value.type){ - OpenapiType.ARRAY -> value.toReference(className(name, key, "Array")) + reference = when{ + value.enum != null -> value.toReference(className(name, key)) + value.type == OpenapiType.ARRAY -> value.toReference(className(name, key, "Array")) else -> value.toReference(className(name, key)) }, isNullable = !(this.required?.contains(key) ?: false)