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

[BUG] Add Parameter preset in fulfillment builder doesn't accept boolean #187

Closed
smadnaik opened this issue May 8, 2024 · 0 comments · Fixed by #188
Closed

[BUG] Add Parameter preset in fulfillment builder doesn't accept boolean #187

smadnaik opened this issue May 8, 2024 · 0 comments · Fixed by #188
Assignees
Labels
bug Something isn't working

Comments

@smadnaik
Copy link

smadnaik commented May 8, 2024

DF CX allows us to set boolean values as parameter presets in the fulfillments. The current Scrapi implementation restricts this by only allowing string value

Expected Behavior

add_parameter_presets() in the class FulfillmentBuilder should allow boolean in the parameter_map parameter. The acceptable dict should be allow dict values to be boolean so it accepts Dict[str,boolean] instead of only Dict[str,str]
The DFCX console allows us to add boolean values as the parameter preset. The SetParameterAction method from Google's DFCX API allows values of type 'any'

Current Behavior

The add_parameter_presets() in the class FulfillmentBuilder expects the parameter_map to be Dict[str,str] which results in the following ValueError when a Dict[str,boolean] is passed

"Only strings are allowed as"
" dictionary keys and values in parameter_map."

Possible Solution

Steps to Reproduce

  1. Create a dfcx_scrapi.builders.fulfillments.FulfillmentBuilder object
  2. Call add_parameter_presets method using the FulfillmentBuilder object
    Eg. fulfillment_builder.add_parameter_presets({"var_name" : True})
  3. Scrapi API returns raise a Value Error

Context (Environment)

We often use boolean variables to set parameter preset for various routes. Currently we have to set any decision variables as "True" or "False" which is essentially string matching and not exactly if-else condition as it's efficient

Detailed Description

Possible Implementation

@smadnaik smadnaik added the bug Something isn't working label May 8, 2024
@MRyderOC MRyderOC self-assigned this May 28, 2024
@MRyderOC MRyderOC linked a pull request May 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants