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

Passing nil for an optional parameter throws an error #1221

Open
Isuru-Nanayakkara opened this issue Nov 23, 2023 · 0 comments
Open

Passing nil for an optional parameter throws an error #1221

Isuru-Nanayakkara opened this issue Nov 23, 2023 · 0 comments

Comments

@Isuru-Nanayakkara
Copy link

Isuru-Nanayakkara commented Nov 23, 2023

I'm creating a checkout using the checkoutCreate mutation. According to the docs, the email parameter is optional. But if I pass nil to it, the APi call fails.

let checkoutInput = Storefront.CheckoutCreateInput.create(
    email: .value(email), // `email` is an optional string and I'm passing `nil` for that parameter
    lineItems: .value(lineItemInput),
    note: .value(note),
    allowPartialAddresses: .value(true)
)

The .value(:) case itself accepts an optional string value according to the docs.

Screenshot 2023-11-23 at 5 15 38 PM

So I'm not sure why it causes the API call to fail if I actually pass in nil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant