Skip to content

Commit

Permalink
#9 fix 'can`t deserialize 8,9 result type'
Browse files Browse the repository at this point in the history
  • Loading branch information
hleb-albau committed Aug 26, 2020
1 parent 389ec07 commit 510129b
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 36 deletions.
3 changes: 1 addition & 2 deletions client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ src/main/generated/com/regula/documentreader/webclient/model/DetailsOptical.java
src/main/generated/com/regula/documentreader/webclient/model/DetailsRFID.java
src/main/generated/com/regula/documentreader/webclient/model/DocVisualExtendedField.java
src/main/generated/com/regula/documentreader/webclient/model/DocumentImageResult.java
src/main/generated/com/regula/documentreader/webclient/model/DocumentType.java
src/main/generated/com/regula/documentreader/webclient/model/DocumentTypesCandidatesList.java
src/main/generated/com/regula/documentreader/webclient/model/DocumentTypesCandidatesResult.java
src/main/generated/com/regula/documentreader/webclient/model/FDSIDList.java
src/main/generated/com/regula/documentreader/webclient/model/GraphicField.java
src/main/generated/com/regula/documentreader/webclient/model/GraphicFieldsList.java
src/main/generated/com/regula/documentreader/webclient/model/GraphicsResult.java
Expand All @@ -51,7 +51,6 @@ src/main/generated/com/regula/documentreader/webclient/model/StatusResult.java
src/main/generated/com/regula/documentreader/webclient/model/StringRecognitionResult.java
src/main/generated/com/regula/documentreader/webclient/model/SymbolCandidate.java
src/main/generated/com/regula/documentreader/webclient/model/SymbolRecognitionResult.java
src/main/generated/com/regula/documentreader/webclient/model/TFDSIDList.java
src/main/generated/com/regula/documentreader/webclient/model/TextAvailableSource.java
src/main/generated/com/regula/documentreader/webclient/model/TextDataResult.java
src/main/generated/com/regula/documentreader/webclient/model/TextField.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,10 @@ public void onResponse(Call call, Response response) throws IOException {
} catch (ApiException e) {
callback.onFailure(e, response.code(), response.headers().toMultimap());
return;
} catch (Exception e) {
callback.onFailure(
new ApiException(e), response.code(), response.headers().toMultimap());
return;
}
callback.onSuccess(result, response.code(), response.headers().toMultimap());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import java.util.Objects;

/** Extended document type info and Regula's 'Information Reference Systems' links */
public class TFDSIDList {
public class FDSIDList {
public static final String SERIALIZED_NAME_I_C_A_O = "ICAO";

@SerializedName(SERIALIZED_NAME_I_C_A_O)
Expand All @@ -32,7 +32,7 @@ public class TFDSIDList {
public static final String SERIALIZED_NAME_D_TYPE = "dType";

@SerializedName(SERIALIZED_NAME_D_TYPE)
private DocumentType dType;
private int dType;

public static final String SERIALIZED_NAME_D_FORMAT = "dFormat";

Expand Down Expand Up @@ -69,7 +69,7 @@ public class TFDSIDList {
@SerializedName(SERIALIZED_NAME_D_STATE_NAME)
private String dStateName;

public TFDSIDList withICAO(String ICAO) {
public FDSIDList withICAO(String ICAO) {
this.ICAO = ICAO;
return this;
}
Expand All @@ -88,12 +88,12 @@ public void setICAO(String ICAO) {
this.ICAO = ICAO;
}

public TFDSIDList withList(List<Integer> list) {
public FDSIDList withList(List<Integer> list) {
this.list = list;
return this;
}

public TFDSIDList addListItem(int listItem) {
public FDSIDList addListItem(int listItem) {
if (this.list == null) {
this.list = new ArrayList<Integer>();
}
Expand All @@ -115,7 +115,7 @@ public void setList(List<Integer> list) {
this.list = list;
}

public TFDSIDList withDType(DocumentType dType) {
public FDSIDList withDType(int dType) {
this.dType = dType;
return this;
}
Expand All @@ -126,15 +126,15 @@ public TFDSIDList withDType(DocumentType dType) {
* @return dType
*/
@javax.annotation.Nullable
public DocumentType getdType() {
public int getdType() {
return dType;
}

public void setdType(DocumentType dType) {
public void setdType(int dType) {
this.dType = dType;
}

public TFDSIDList withDFormat(int dFormat) {
public FDSIDList withDFormat(int dFormat) {
this.dFormat = dFormat;
return this;
}
Expand All @@ -153,7 +153,7 @@ public void setdFormat(int dFormat) {
this.dFormat = dFormat;
}

public TFDSIDList withDMRZ(Boolean dMRZ) {
public FDSIDList withDMRZ(Boolean dMRZ) {
this.dMRZ = dMRZ;
return this;
}
Expand All @@ -172,7 +172,7 @@ public void setdMRZ(Boolean dMRZ) {
this.dMRZ = dMRZ;
}

public TFDSIDList withDDescription(String dDescription) {
public FDSIDList withDDescription(String dDescription) {
this.dDescription = dDescription;
return this;
}
Expand All @@ -191,7 +191,7 @@ public void setdDescription(String dDescription) {
this.dDescription = dDescription;
}

public TFDSIDList withDYear(String dYear) {
public FDSIDList withDYear(String dYear) {
this.dYear = dYear;
return this;
}
Expand All @@ -210,7 +210,7 @@ public void setdYear(String dYear) {
this.dYear = dYear;
}

public TFDSIDList withDCountryName(String dCountryName) {
public FDSIDList withDCountryName(String dCountryName) {
this.dCountryName = dCountryName;
return this;
}
Expand All @@ -229,7 +229,7 @@ public void setdCountryName(String dCountryName) {
this.dCountryName = dCountryName;
}

public TFDSIDList withDStateCode(String dStateCode) {
public FDSIDList withDStateCode(String dStateCode) {
this.dStateCode = dStateCode;
return this;
}
Expand All @@ -248,7 +248,7 @@ public void setdStateCode(String dStateCode) {
this.dStateCode = dStateCode;
}

public TFDSIDList withDStateName(String dStateName) {
public FDSIDList withDStateName(String dStateName) {
this.dStateName = dStateName;
return this;
}
Expand All @@ -275,17 +275,17 @@ public boolean equals(java.lang.Object o) {
if (o == null || getClass() != o.getClass()) {
return false;
}
TFDSIDList tfDSIDList = (TFDSIDList) o;
return Objects.equals(this.ICAO, tfDSIDList.ICAO)
&& Objects.equals(this.list, tfDSIDList.list)
&& Objects.equals(this.dType, tfDSIDList.dType)
&& Objects.equals(this.dFormat, tfDSIDList.dFormat)
&& Objects.equals(this.dMRZ, tfDSIDList.dMRZ)
&& Objects.equals(this.dDescription, tfDSIDList.dDescription)
&& Objects.equals(this.dYear, tfDSIDList.dYear)
&& Objects.equals(this.dCountryName, tfDSIDList.dCountryName)
&& Objects.equals(this.dStateCode, tfDSIDList.dStateCode)
&& Objects.equals(this.dStateName, tfDSIDList.dStateName);
FDSIDList fdSIDList = (FDSIDList) o;
return Objects.equals(this.ICAO, fdSIDList.ICAO)
&& Objects.equals(this.list, fdSIDList.list)
&& Objects.equals(this.dType, fdSIDList.dType)
&& Objects.equals(this.dFormat, fdSIDList.dFormat)
&& Objects.equals(this.dMRZ, fdSIDList.dMRZ)
&& Objects.equals(this.dDescription, fdSIDList.dDescription)
&& Objects.equals(this.dYear, fdSIDList.dYear)
&& Objects.equals(this.dCountryName, fdSIDList.dCountryName)
&& Objects.equals(this.dStateCode, fdSIDList.dStateCode)
&& Objects.equals(this.dStateName, fdSIDList.dStateName);
}

@Override
Expand All @@ -306,7 +306,7 @@ public int hashCode() {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class TFDSIDList {\n");
sb.append("class FDSIDList {\n");
sb.append(" ICAO: ").append(toIndentedString(ICAO)).append("\n");
sb.append(" list: ").append(toIndentedString(list)).append("\n");
sb.append(" dType: ").append(toIndentedString(dType)).append("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class GraphicFieldType {
/**
* Cropped and rotated with perspective compensation (front side) of a document. Single input
* image can contain multiple document side/pages, which will be returned as separated results.
* Most coordinates in other types defined on that images.
* Most coordinates in other types defined on that image.
*/
public static final int DOCUMENT_FRONT = 207;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class OneCandidate {
public static final String SERIALIZED_NAME_FD_S_I_D_LIST = "FDSIDList";

@SerializedName(SERIALIZED_NAME_FD_S_I_D_LIST)
private TFDSIDList fdSIDList;
private FDSIDList fdSIDList;

public static final String SERIALIZED_NAME_NECESSARY_LIGHTS = "NecessaryLights";

Expand Down Expand Up @@ -141,7 +141,7 @@ public void setRfIDPresence(int rfIDPresence) {
this.rfIDPresence = rfIDPresence;
}

public OneCandidate withFdSIDList(TFDSIDList fdSIDList) {
public OneCandidate withFdSIDList(FDSIDList fdSIDList) {
this.fdSIDList = fdSIDList;
return this;
}
Expand All @@ -152,11 +152,11 @@ public OneCandidate withFdSIDList(TFDSIDList fdSIDList) {
* @return fdSIDList
*/
@javax.annotation.Nullable
public TFDSIDList getFdSIDList() {
public FDSIDList getFdSIDList() {
return fdSIDList;
}

public void setFdSIDList(TFDSIDList fdSIDList) {
public void setFdSIDList(FDSIDList fdSIDList) {
this.fdSIDList = fdSIDList;
}

Expand Down
Empty file.
2 changes: 1 addition & 1 deletion dev.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Then use next command from the project root.
ENUM_MAPPINGS="TextFieldType=Integer,GraphicFieldType=Integer,Scenario=String,DocumentFormat=Integer,\
Light=Integer,Result=Integer,VerificationResult=Integer,RfidLocation=Integer,\
DocumentTypeRecognitionResult=Integer,ProcessingStatus=Integer,Source=String,CheckResult=Integer,\
LCID=Integer" \
LCID=Integer,DocumentType=Integer" \
\
&& docker run --rm -v "${PWD}:/client" -v "${DEFINITION_FOLDER}:/definitions" \
openapitools/openapi-generator-cli generate \
Expand Down
Empty file modified example/README.md
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static void main(String[] args) throws IOException, ApiException {

var requestParams = new RecognitionParams()
.withScenario(Scenario.FULL_PROCESS)
.withResultTypeOutput(Result.STATUS, Result.TEXT, Result.IMAGES);
.withResultTypeOutput(Result.STATUS, Result.TEXT, Result.IMAGES, Result.DOCUMENT_TYPE);

RecognitionRequest request = new RecognitionRequest(requestParams, List.of(image));

Expand Down

0 comments on commit 510129b

Please sign in to comment.