Skip to content

Commit

Permalink
feat(kotlin): add companion object to enums
Browse files Browse the repository at this point in the history
GoNZooo authored Aug 23, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 0beb953 + 8948e5e commit 0959d54
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: gotyno-hs
version: 1.2.12
version: 1.2.13
synopsis: A type definition compiler supporting multiple output languages.
description: Compiles type definitions into F#, TypeScript and Python, with validators, decoders and encoders.
license: BSD2
2 changes: 2 additions & 0 deletions src/CodeGeneration/Kotlin.hs
Original file line number Diff line number Diff line change
@@ -163,7 +163,9 @@ outputEnumeration name values' =
in mconcat
[ mconcat ["enum class ", nameOf name, "(val data: Any) {\n"],
valuesOutput,
";\n",
"\n",
" companion object {}\n",
"}"
]

4 changes: 3 additions & 1 deletion test/reference-output/basic.kt
Original file line number Diff line number Diff line change
@@ -70,7 +70,9 @@ enum class StillSize(val data: Any) {
@JsonProperty("w185") W185("w185"),
@JsonProperty("w300") W300("w300"),
@JsonProperty("h632") H632("h632"),
@JsonProperty("original") ORIGINAL("original")
@JsonProperty("original") ORIGINAL("original");

companion object {}
}

@Serializable

0 comments on commit 0959d54

Please sign in to comment.