I want the Swagger generated classes to implement Serializable. Is there way i can say to swagger-codegen to implement this ??
swagger-codegen version : 2.2.1
```yaml
paths:
/pet:
get:
description: pet
tags:
- pet
responses:
'200':
description: got response ok
schema:
$ref: '#/definitions/PetTO'
definitions:
PetTO:
type: object
properties:
id:
type: string
description: pet id
petName:
type: string
description: pet name
```
(for YAML code) or
-->
java -jar swagger-codegen-cli.jar generate -i pet.yml -l java --library=okhttp-gson
-o generated_source_code
-c package_config.json
=> With the above Yaml, Swagger-codegen will generate a PetTO class. I want the PetTO class to implement serializable. Is there a way i can say to swagger-codegen to implement serializable for this class.
Have you tried the following option?
serializableModel
boolean - toggle "implements Serializable" for generated models (Default: false)
Ref: java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java
thanks. it is working with "serializableModel" : true
Hi, where to add this serializableModel" : true
please help
Hi, where to add this serializableModel" : true
please help
add it in the config.json, which you provide as input to the swagger-codegen.
For example, this how my config.json file looks like
{
"invokerPackage" : "com.xxxx.yyyy.zzzz",
"apiPackage" : "com.xxxx.yyyy.zzzz.api",
"modelPackage" : "com.xxxx.yyyy.zzzz.model",
"serializableModel" : true
}
Is it possible to implement Serializable just for a set of classes instead of all?
Most helpful comment
Have you tried the following option?
Ref:
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java