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

Removed strict validation and regenerate oneOfs #1110

Merged
merged 1 commit into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeCoercion = ctxt.isEnabled(MapperFeature.ALLOW_COERCION_OF_SCALARS);
int match = 0;
JsonToken token = tree.traverse(jp.getCodec()).nextToken();
// Local Object Mapper that forces strict validation
ObjectMapper localObjectMapper = JSON.getMapper();
localObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, true);

// deserialize AULocalAccountIdentification
try {
Expand All @@ -129,7 +126,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(AULocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), AULocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), AULocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'AULocalAccountIdentification'");
Expand Down Expand Up @@ -157,7 +154,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(BRLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), BRLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), BRLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'BRLocalAccountIdentification'");
Expand Down Expand Up @@ -185,7 +182,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(CALocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), CALocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), CALocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'CALocalAccountIdentification'");
Expand Down Expand Up @@ -213,7 +210,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(CZLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), CZLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), CZLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'CZLocalAccountIdentification'");
Expand Down Expand Up @@ -241,7 +238,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(DKLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), DKLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), DKLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'DKLocalAccountIdentification'");
Expand Down Expand Up @@ -269,7 +266,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(HKLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), HKLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), HKLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'HKLocalAccountIdentification'");
Expand Down Expand Up @@ -297,7 +294,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(HULocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), HULocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), HULocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'HULocalAccountIdentification'");
Expand Down Expand Up @@ -325,7 +322,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(IbanAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), IbanAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), IbanAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'IbanAccountIdentification'");
Expand Down Expand Up @@ -353,7 +350,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(NOLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), NOLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), NOLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'NOLocalAccountIdentification'");
Expand Down Expand Up @@ -381,7 +378,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(NZLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), NZLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), NZLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'NZLocalAccountIdentification'");
Expand Down Expand Up @@ -409,7 +406,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(NumberAndBicAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), NumberAndBicAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), NumberAndBicAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'NumberAndBicAccountIdentification'");
Expand Down Expand Up @@ -437,7 +434,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(PLLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), PLLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), PLLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'PLLocalAccountIdentification'");
Expand Down Expand Up @@ -465,7 +462,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(SELocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), SELocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), SELocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'SELocalAccountIdentification'");
Expand Down Expand Up @@ -493,7 +490,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(SGLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), SGLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), SGLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'SGLocalAccountIdentification'");
Expand Down Expand Up @@ -521,7 +518,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(UKLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), UKLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), UKLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'UKLocalAccountIdentification'");
Expand Down Expand Up @@ -549,7 +546,7 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
boolean typeMatch = Arrays.stream(USLocalAccountIdentification.TypeEnum.values()).anyMatch((t) -> t.getValue().contains(tree.findValue("type").asText()));
if (attemptParsing || typeMatch) {
// Strict deserialization for oneOf models
deserialized = localObjectMapper.readValue(tree.toString(), USLocalAccountIdentification.class);
deserialized = JSON.getMapper().readValue(tree.toString(), USLocalAccountIdentification.class);
// typeMatch should enforce proper deserialization
match++;
log.log(Level.FINER, "Input data matches schema 'USLocalAccountIdentification'");
Expand All @@ -568,7 +565,6 @@ public BankAccountIdentificationValidationRequestAccountIdentification deseriali
log.log(Level.WARNING, String.format("Warning, indecisive deserialization for BankAccountIdentificationValidationRequestAccountIdentification: %d classes match result, expected 1", match));
}

localObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
BankAccountIdentificationValidationRequestAccountIdentification ret = new BankAccountIdentificationValidationRequestAccountIdentification();
ret.setActualInstance(deserialized);
return ret;
Expand Down Expand Up @@ -991,5 +987,24 @@ public USLocalAccountIdentification getUSLocalAccountIdentification() throws Cla
return (USLocalAccountIdentification)super.getActualInstance();
}

/**
* Create an instance of BankAccountIdentificationValidationRequestAccountIdentification given an JSON string
*
* @param jsonString JSON string
* @return An instance of BankAccountIdentificationValidationRequestAccountIdentification
* @throws IOException if the JSON string is invalid with respect to BankAccountIdentificationValidationRequestAccountIdentification
*/
public static BankAccountIdentificationValidationRequestAccountIdentification fromJson(String jsonString) throws IOException {
return JSON.getMapper().readValue(jsonString, BankAccountIdentificationValidationRequestAccountIdentification.class);
}

/**
* Convert an instance of BankAccountIdentificationValidationRequestAccountIdentification to an JSON string
*
* @return JSON string
*/
public String toJson() throws JsonProcessingException {
return JSON.getMapper().writeValueAsString(this);
}
}

4 changes: 2 additions & 2 deletions src/main/java/com/adyen/model/balanceplatform/Card.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,10 +436,10 @@ public Card threeDSecure(String threeDSecure) {
}

/**
* Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySecure**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.
* Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.
* @return threeDSecure
**/
@ApiModelProperty(value = "Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySecure**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.")
@ApiModelProperty(value = "Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.")
@JsonProperty(JSON_PROPERTY_THREE_D_SECURE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/adyen/model/balanceplatform/CardInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ public CardInfo threeDSecure(String threeDSecure) {
}

/**
* Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySecure**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.
* Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.
* @return threeDSecure
**/
@ApiModelProperty(value = "Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySecure**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.")
@ApiModelProperty(value = "Allocates a specific product range for either a physical or a virtual card. Possible values: **fullySupported**, **secureCorporate**. >Reach out to your Adyen contact to get the values relevant for your integration.")
@JsonProperty(JSON_PROPERTY_THREE_D_SECURE)
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)

Expand Down
Loading