swagger_parser icon indicating copy to clipboard operation
swagger_parser copied to clipboard

Package name for Kotlin classes

Open BsBrabi opened this issue 8 months ago • 0 comments

Use case

When generating Kotlin classes into a specific directory in my project, the package declaration should be present in all generated clients and models with the correct package.

Proposal

New parameter package to specify the package in which the files are located.

Swagger parser config:

swagger_parser:
  schema_url: https://petstore.swagger.io/v2/swagger.json
  output_directory: ../src/main/java/com/test/app/rest
  language: kotlin
  package: com.test.app.rest

All generated files contain package declaration in the beginning of the file, for example:

  • PetClient.kt: package com.test.app.rest.pet
  • Pet.kt: package com.test.app.rest.models

BsBrabi avatar Jun 27 '24 08:06 BsBrabi