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

Cannot convert value of type 'GraphQLNullable<[String]>' to expected argument type '[String?]' #3340

Closed
Spatel91111 opened this issue Feb 20, 2024 · 10 comments
Labels
question Issues that have a question which should be addressed

Comments

@Spatel91111
Copy link

Question

If I used [String?] array with GraphQLNullable then it's passed request value like some([Optional("black")]) and that create issue I want to pass value some(["black", "black1"]) like this. How to remove GraphQLNullable<[String?]> and used GraphQLNullable<[String]>

@Spatel91111 Spatel91111 added the question Issues that have a question which should be addressed label Feb 20, 2024
@calvincestari
Copy link
Member

GraphQLNullable is used for input types, so the field on the input type in your schema is probably [String] and not [String!].

@Spatel91111
Copy link
Author

Hello @calvincestari , yes I have used status: [String] in schema but still getting issue

@calvincestari
Copy link
Member

Create a sample app demonstrating the problem that we can look at please.

@Spatel91111
Copy link
Author

Spatel91111 commented Feb 20, 2024

Hello @calvincestari

Schema
Screenshot 2024-02-20 at 11 15 58 AM

code

Screenshot 2024-02-20 at 11 16 16 AM

@calvincestari
Copy link
Member

In the schema screenshot, flight_type: [String] is a list of nullable strings. That is correctly generated into Swift as GraphQLNullable<[String?]>. There is nothing wrong here.

flightTypeArray3 must be the same type (GraphQLNullable<[String?]>) if you want to assign it.

@Spatel91111
Copy link
Author

Hello @calvincestari ,

If I used type (GraphQLNullable<[String?]>) then it's pass input value like [Optional("black")]

@Spatel91111
Copy link
Author

@calvincestari , is there any way to configure the file to add any setting value handle automatically?, then let me know.

@calvincestari
Copy link
Member

If I used type (GraphQLNullable<[String?]>) then it's pass input value like [Optional("black")]

Is the JSON actually getting sent like that or only when you print it to the debug console?

is there any way to configure the file to add any setting value handle automatically?, then let me know.

I don't understand your question. A setting to handle what value? It is String? because that's what the type is in your schema.

@AnthonyMDev
Copy link
Contributor

I'm closing this issue due to inactivity. If this is still unresolved, feel free to provide more information and we can re-open this, or create a new issue.

@AnthonyMDev AnthonyMDev closed this as not planned Won't fix, can't repro, duplicate, stale Mar 8, 2024
Copy link
Contributor

github-actions bot commented Mar 8, 2024

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that have a question which should be addressed
Projects
None yet
Development

No branches or pull requests

3 participants