Skip to content

Commit

Permalink
Fix int
Browse files Browse the repository at this point in the history
  • Loading branch information
wilmveel committed Jul 19, 2024
1 parent 7fcf8d4 commit b514108
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import community.flock.wirespec.plugin.toDirectory
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonElement
import kotlinx.serialization.json.JsonPrimitive
import org.apache.maven.plugins.annotations.Mojo
import org.apache.maven.plugins.annotations.Parameter
import java.io.File
Expand Down Expand Up @@ -111,7 +112,10 @@ fun generate(
random: Random = kotlin.random.Random.Default,
): JsonElement {
if (type is Reference.Primitive) {
TODO("return a primitive")
return when(type.type){
Reference.Primitive.Type.Integer -> JsonPrimitive(random.nextInt())
else -> ast.generate(type, random)
}
} else {
return ast.generate(type, random)
}
Expand Down

0 comments on commit b514108

Please sign in to comment.