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

[BUG][Kotlin] Data class generated with unneded { } and backspaces #20267

Open
3 of 6 tasks
Frasprite opened this issue Dec 6, 2024 · 0 comments
Open
3 of 6 tasks

[BUG][Kotlin] Data class generated with unneded { } and backspaces #20267

Frasprite opened this issue Dec 6, 2024 · 0 comments

Comments

@Frasprite
Copy link

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

I inherited a work project using Swagger and OpenAPI. When updating the classes with openapi-generator-cli , the DTO data classes have unwanted / unneeded { } at the end of the file:

data class MyModelRequestDto (
    ...
) {


}


openapi-generator version

I'm using openapi-generator-cli-7.9.0 (previous one was 7.4.0).

OpenAPI declaration file content or url

This is the script the previous developer used to launch the generator:

#!/bin/sh
echo "Start generation API for mobile"

java -jar openapi-generator-cli-7.9.0.jar generate \
 -i https://my.work/swagger/v7/swagger.json \
 -g kotlin \
 --package-name com.work.services.mobile \
 --library jvm-retrofit2 \
 --additional-properties=additionalModelTypeAnnotations=@kotlinx.serialization.Serializable \
 --additional-properties=dateLibrary=string \
 --additional-properties=useCoroutines=true \
 --additional-properties=omitGradleWrapper=true \
 --type-mappings=java.util.UUID=String \
 --language-specific-primitives=Int \
 --type-mappings=integer=Int \
 --language-specific-primitives=String \
 --type-mappings=string=String \
 --language-specific-primitives=Boolean \
 --type-mappings=boolean=Boolean \
 --additional-properties=groupId=com.work.services \
 --global-property=modelDocs=false \
 --global-property=modelTests=false \
 --global-property=apiDocs=false \
 --global-property=apiTests=false \
 -o ../mobile-api/

echo "Generation API for mobile ended"
Generation Details

Nothing to declare (I suppose).

Steps to reproduce

Update generator from a previous version.
Launch the script .sh above.
See issues on data classes.

Related issues/PRs

Didn't find any similar issues by searching with "kotlin", "data class", "{" keywords.

Suggest a fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant