swagger-api / swagger-api/swagger-codegen
json array not generating proper model classes
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I am trying to generate swagger api from the following json:
https://watson-api-explorer.mybluemix.net/listings/conversation-v1.json
but it's not generating proper model classes, where ever it has following similar json:
"CreateWorkspace": {
"allOf": [
{
"$ref": "#/definitions/BaseEntity"
}
],
"x-java-builder": true
},
Generated Model Class doesn't have reference to BaseEntity Class
import java.util.Objects;
import com.ibm.mfp.adapters.sample.model.BaseEntity;
/**
* CreateWorkspace
*/
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2017-04-19T17:14:05.018+05:30")
public class CreateWorkspace {
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
return true;
}
@Override
public int hashCode() {
return Objects.hash();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class CreateWorkspace {\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
json looks correct only, as i am using watson json mentioned in above link.
Swagger-codegen version
2.2.2
Swagger declaration file content or url
https://watson-api-explorer.mybluemix.net/listings/conversation-v1.json
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the linked Watson conversation-v1.json using Swagger-codegen 2.2.2 and inspect the generated CreateWorkspace and BaseEntity classes. Start at the JavaClientCodegen path named in the generated annotation; done means the generated CreateWorkspace model preserves the allOf reference to BaseEntity.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100