Skip to content

Commit

Permalink
Fix for enum
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmveel committed Nov 4, 2023
1 parent 337223e commit 407955f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ class JavaEmitter(
.joinToString(", ") { it.emit() }
}

private fun List<Type.Shape.Field>.emitMap() = joinToString(", ", "java.util.Map.of(", ")") { "\"${it.identifier.value}\", java.util.List.of(${it.identifier.emit()})" }
private fun List<Type.Shape.Field>.emitMap() = joinToString(", ", "java.util.Map.ofEntries(", ")") { "java.util.Map.entry(\"${it.identifier.value}\", java.util.List.of(${it.identifier.emit()}))" }

private fun List<Endpoint.Segment>.emitSegment() = "/" + joinToString("/") {
when (it) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 407955f

Please sign in to comment.