Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:Generator fails if descriptions contains a % #55

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

gmazzo
Copy link
Contributor

@gmazzo gmazzo commented Jan 8, 2024

Summary

The generator code is misused in some cases, as you are passing the description of the events in Kotlin Poet's format:
image

propertyBuilder.addKdoc(description)

should be

propertyBuilder.addKdoc("%S", description)

This was causing the following error:

Exception in thread "main" java.lang.IllegalArgumentException: index 1 for '% ' not in range (received 0 arguments)
        at com.squareup.kotlinpoet.CodeBlock$Builder.add(CodeBlock.kt:310)
        at com.squareup.kotlinpoet.TypeSpec$Builder.addKdoc(TypeSpec.kt:473)
        at com.mparticle.smartype.generator.SmartypeObject.generateType(SmartypeObject.kt:161)
        at com.mparticle.smartype.generator.SmartypeObject.configureApi(SmartypeObject.kt:76)
        at com.mparticle.smartype.generator.Generate.run(Generator.kt:101)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:154)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:162)
        at com.github.ajalt.clikt.parsers.Parser.parse(Parser.kt:14)
        at com.github.ajalt.clikt.core.CliktCommand.parse(CliktCommand.kt:252)
        at com.github.ajalt.clikt.core.CliktCommand.parse$default(CliktCommand.kt:249)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:267)
        at com.github.ajalt.clikt.core.CliktCommand.main(CliktCommand.kt:290)
        at com.mparticle.smartype.generator.GeneratorKt.main(Generator.kt:226)

Replaced all usages (that I found) with the right syntax.

Testing Plan

  • Was this tested locally? If not, explain why.
  • Built a local version and ran against our Data Plan schema again.

@gmazzo gmazzo force-pushed the fix/description-used-as-format branch from 7ff3651 to de5a9af Compare January 8, 2024 14:07
Copy link

sonarqubecloud bot commented Jan 8, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@samdozor samdozor merged commit c9ef7ef into mParticle:main Jan 16, 2024
11 checks passed
@samdozor
Copy link
Member

fyi @gmazzo this has been released as 1.6.2. thank you!

@gmazzo gmazzo deleted the fix/description-used-as-format branch January 17, 2024 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants