swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

Default constructors missing in Generate Client (Java) - classes (models)

Open Trentan opened this issue 3 years ago • 0 comments

Might be up for discussion, default constructors are not included in the generation (important when said model is 'wrapped')

Why suggested (example problem from hosted swagger being called via postman): Cannot Construct Instance Of XYZ (No Creators, Like Default Construct, Exist): Cannot Deserialize From Object Value (No Delegate- Or Property-Based Creator)

Path to generated classes: java-client\src\main\java\io\swagger\client\model

I overcame the problem in the interim by manually editing the class - adding a default constructor(s).

public GeneratedModelClass(){
    super();
}

public GeneratedModelClass(int i, String s){
    this.i= i;
    this.s= s;
}

Trentan avatar May 19 '21 00:05 Trentan