[sessionauthentication] Code generation: update services and models#1943
[sessionauthentication] Code generation: update services and models#1943AdyenAutomationBot wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces SDK generation metadata and modifies the fromValue methods in ProductType and ResourceType enums to return null and log a warning instead of throwing an IllegalArgumentException. It also includes minor code cleanup and formatting in the clouddevice service. The review feedback points out that returning null is a breaking change that could lead to NullPointerException in client code and suggests adding a check to handle null inputs silently to avoid excessive log noise.
| // handling unexpected value | ||
| LOG.warning( | ||
| "ProductType: unexpected enum value '" | ||
| + value | ||
| + "' - Supported values are " | ||
| + Arrays.toString(ProductType.values())); | ||
| return null; |
There was a problem hiding this comment.
The change from throwing an IllegalArgumentException to returning null when an unexpected value is encountered is a breaking change. While this aids in forward compatibility (allowing the SDK to handle new API values without crashing), it may lead to NullPointerException in client code if the result is not checked.
Additionally, the method will log a warning for null inputs. If this enum is used for an optional field, a missing value in the JSON will trigger this warning, potentially causing excessive log noise. Consider adding a null check to return null silently when the input is null.
if (value == null) {
return null;
}
// handling unexpected value
LOG.warning(
"ProductType: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(ProductType.values()));
return null;| // handling unexpected value | ||
| LOG.warning( | ||
| "ResourceType: unexpected enum value '" | ||
| + value | ||
| + "' - Supported values are " | ||
| + Arrays.toString(ResourceType.values())); | ||
| return null; |
There was a problem hiding this comment.
The change from throwing an IllegalArgumentException to returning null when an unexpected value is encountered is a breaking change. While this aids in forward compatibility (allowing the SDK to handle new API values without crashing), it may lead to NullPointerException in client code if the result is not checked.
Additionally, the method will log a warning for null inputs. If this enum is used for an optional field, a missing value in the JSON will trigger this warning, potentially causing excessive log noise. Consider adding a null check to return null silently when the input is null.
if (value == null) {
return null;
}
// handling unexpected value
LOG.warning(
"ResourceType: unexpected enum value '"
+ value
+ "' - Supported values are "
+ Arrays.toString(ResourceType.values()));
return null;7c619d5 to
6a514a8
Compare
This PR contains the automated changes for the
sessionauthenticationservice.The commit history of this PR reflects the
adyen-openapicommits that have been applied.