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

serializableModel config option does not work for JAX-RS spec #6650

Closed
GrahamJohnson opened this issue Oct 9, 2017 · 1 comment · Fixed by #6651
Closed

serializableModel config option does not work for JAX-RS spec #6650

GrahamJohnson opened this issue Oct 9, 2017 · 1 comment · Fixed by #6651

Comments

@GrahamJohnson
Copy link
Contributor

Description

JAX-RS spec serializableModel config option does not generate imports for java.io.Serializable, causing compile errors on implements Serializable.

Swagger-codegen version

2.2.3, master

Steps to reproduce
  1. Add -DserializableModel=true to jaxrs-spec-petstore-server.sh
  2. Run bin/jaxrs-spec-petstore-server.sh
  3. Observer that generated model classes are generated with implements Serializable but no import for java.io.Serializable:
package io.swagger.model;

import io.swagger.model.Category;
import io.swagger.model.Tag;
import java.util.ArrayList;
import java.util.List;
import javax.validation.constraints.*;


import io.swagger.annotations.*;
import java.util.Objects;


public class Pet  implements Serializable {
// ...
}
Suggest a fix/enhancement

Add the following to JavaJaxRS/spec/model.mustache:

{{#serializableModel}}
import java.io.Serializable;
{{/serializableModel}}

This matches https:/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/main/resources/JavaJaxRS/model.mustache#L13,L14,L15.

@GrahamJohnson
Copy link
Contributor Author

PR: #6651

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 a pull request may close this issue.

1 participant