Skip to content

Commit

Permalink
Fix crash when description contains %
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo authored and samdozor committed Jan 16, 2024
1 parent 6d30fe4 commit c9ef7ef
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class SmartypeObject(options: GeneratorOptions) {
}

file = FileSpec.builder(packageName(isWeb), libraryName)
.addComment("CODE GENERATED BY SMARTYPE, DO NOT MODIFY.")
.addComment("%S", "CODE GENERATED BY SMARTYPE, DO NOT MODIFY.")
file.addImport("com.mparticle.smartype.api", "Message")
file.addImport("kotlinx.serialization.json", "JsonElement")
file.addImport("kotlinx.serialization.json", "JsonObject")
Expand Down Expand Up @@ -157,8 +157,8 @@ class SmartypeObject(options: GeneratorOptions) {
val schemaDescription: JsonPrimitive?
if (definition.containsKey("description")) {
schemaDescription = definition["description"] as JsonPrimitive
if (!schemaDescription.content.isBlank()) {
dpClassPoint.addKdoc(schemaDescription.content)
if (schemaDescription.content.isNotBlank()) {
dpClassPoint.addKdoc("%S", schemaDescription.content)
}
}

Expand Down Expand Up @@ -449,8 +449,8 @@ class SmartypeObject(options: GeneratorOptions) {

propertyBuilder.addModifiers(KModifier.PUBLIC)

if (description != null && !description.isBlank()) {
propertyBuilder.addKdoc(description)
if (!description.isNullOrBlank()) {
propertyBuilder.addKdoc("%S", description)
}

dpClassPoint.addProperty(
Expand Down

0 comments on commit c9ef7ef

Please sign in to comment.