Legacy Dev Forum Posts

 View Only

Sign Up

Breaking Change Python SDK 142.0.0

  • 1.  Breaking Change Python SDK 142.0.0

    Posted 06-05-2025 18:08

    Adrian_Santamaria | 2022-06-20 09:13:25 UTC | #1

    Hello

    I have noticed a breaking change in the Python SDK since version 142.0.0. The thing is that now there are some class property setters that include a validation for not allowing empty values. I think this was not included in the SDK Release Notes.

    Before that change, I used to set some properties as empty lists, and then I filled them with the proper values. Now, that is not possible, as it throws an error. For example, this code:

    import PureCloudPlatformClientV2 as sdk
    
    clause = sdk.SegmentDetailQueryClause()
    clause.type = 'or'
    clause.predicates = []
    
    for i in range(3):	# example loop
    	predicate = sdk.SegmentDetailQueryPredicate()
    	# ... fill the predicate properties
    	clause.predicates.append(predicate)

    works fine in versions <142.0.0, but in >=142.0.0 it throws

    alueError: Invalid value for `predicates`, must not be `None`
    

    It does so because the validation in the setter is:

    if not predicates:
        raise ValueError("Invalid value for `predicates`, must not be `None`")

    That checks if predicates is falsy, not just None. So, to the fixed version for the previous code would be something like:

    import PureCloudPlatformClientV2 as sdk
    
    clause = sdk.SegmentDetailQueryClause()
    clause.type = 'or'
    clause_predicates = []  # use a helper variable
    
    for i in range(3):    # example loop
        predicate = sdk.SegmentDetailQueryPredicate()
        # ... fill the predicate properties
        clause_predicates.append(predicate)
    
    clause.predicates = clause_predicates

    or

    import PureCloudPlatformClientV2 as sdk
    
    clause = sdk.SegmentDetailQueryClause()
    clause.type = 'or'
    clause.predicates = [None]  # fill it with one dummy item
    
    for i in range(3):    # example loop
        predicate = sdk.SegmentDetailQueryPredicate()
        # ... fill the predicate properties
        clause.predicates.append(predicate)
    
    clause.predicates.remove(None)    # remove dummy item

    Those look quite ugly to me. Therefore, I would like to suggest allowing empty lists as property values.


    anon11147534 | 2022-06-20 12:22:59 UTC | #2

    Hi Adrian,

    Apologies for that. I've released version 144.0.0 just now with the fix.


    Adrian_Santamaria | 2022-06-20 12:22:54 UTC | #3

    Wow, that was amazingly fast! Thank you very much Ronan!!


    system | 2022-07-21 12:23:24 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 15222