-
Notifications
You must be signed in to change notification settings - Fork 734
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
Custom Scalar | ApolloAPI.JSONDecodingError.couldNotConvert(value: AnyHashable to: Swift.String #3367
Comments
Hi @PareshPatel721 - since you mention the build phase script it sounds like you're familiar with the old 0.x versions. 1.0 has changed code generation quite a bit. We have a 1.0 migration guide and there is a specific section about custom scalars. tl;dr - you need to write the custom scalar code yourself, just like before but in a different place now. |
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. |
I've written custom scalar code, but it still not working In same file I've try to extend many ways
`extension JSON: JSONDecodable {
} `extension SchemaConfiguration {
}` `extension Schema {
}` `extension JSON: JSONDecodable, JSONEncodable {
}` ` extension SchemaConfiguration {
} ` Please help me out where and how i can write custom scalar code, so my response get automatically parsed and confirmed to custom scalar Thank you |
Codegen is generating You are able to edit this file and the codegen engine will not overwrite it during the next code generation. So, if your custom scalar is not a Firstly you need to delete Of the code you posted above this one looks correct but you might not need to put it inside an extension depending on how you created your schema module:
|
@calvincestari |
Question
I'm using Apollo 1.9.3 with local package support.
So there are no any run script is needed to set in build phase.
When i invoke My API from graphql server I'm getting error as ApolloAPI.JSONDecodingError.couldNotConvert(value: AnyHashable to: Swift.String
Local framework default generate JSON file in CustomScalar folder and file only contains
public typealias JSON = String
The text was updated successfully, but these errors were encountered: