Comments (6)
Hey @TizianoCoroneo! I thought I was going to have to say no to this request (because ID is reserved as a specific type in the GraphQL Spec), but after reviewing the spec, it just says that ID must be serialized to a String
. So I think this is totally acceptable!
@calvincestari @BobaFetters do you see any reason why we shouldn't allow this?
If you want to make a PR for this, I think we can accept it!
from apollo-ios.
We can't allow complete customization of the type since it will still need to be bound by the serializable-to-string requirement in the GraphQL spec. I don't know exactly how this would work yet but it'd need to conform to ExpressibleByStringLiteral
and CustomStringConvertible
, or something like that. There is also a ton of helper extensions that we've got on the basic scalar types already that String
benefits from, so it could be complicated to untangle.
Happy to work with you in figuring this out though @TizianoCoroneo.
from apollo-ios.
We can't allow complete customization of the type since it will still need to be bound by the serializable-to-string requirement in the GraphQL spec.
I'm not sure how much that matters? Client devs are going to implement their custom scalars to consume the scalar specified by their schema. If your schema is trying to use the ID
type as something that isn't serializable to a String
, your server itself isn't spec-compliant. But honestly, in that case, is there any value in apollo-ios
refusing to work?
There is also a ton of helper extensions that we've got on the basic scalar types already that
String
benefits from, so it could be complicated to untangle.
I'm not sure if any of these are relevant. ID
really does function just as any other custom scalar would. If your ID
scalar is just a String
, then you're good to go. If not, this proposal would allow you to implement the CustomScalarType
protocol and then you would get all the required functionality that a Custom Scalar needs to work.
Maybe I'm missing something, but if so, I think we need to be more clear on what specifically would go wrong with this. I can't actually come up with a situation in which this would be problematic.
@TizianoCoroneo, we aren't going to allocate time to implement this ourselves in the near future, but if it's something you want, please go ahead and try it out. If you get it working in your project and that doesn't reveal any problems that we had missed, we'll do a little more thinking and investigation, but I'm hoping it should be mergeable.
from apollo-ios.
Implemented in #363. Should be included in next release!
from apollo-ios.
Hey 👋
I had a half baked implementation of this, but you were quicker 😂
Thanks for the fast response!
from apollo-ios.
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.
from apollo-ios.
Related Issues (20)
- Add debugDescription api for Apollo generated types
- Circular reference Build Error HOT 6
- Invalid redeclaration of synthesized property '_id' HOT 7
- Split/Hybrid Caching between InMemory and SQL review and thoughts HOT 2
- Bug: Cache writes of incremental responses uses incorrect parent key (custom cache keys)
- Incorrect PR link in release notes for version 1.11.0 HOT 2
- apollo-ios-cli deprecated --schema-name HOT 2
- Confused about cache behavior HOT 2
- CLI fails to run with 1.12.0 HOT 4
- Response value getting nil HOT 2
- Version mismatch between package and CLI HOT 3
- Pagination: Pager does not provide updates during a refresh HOT 5
- Slow compilation speed when migrating from 0.x to 1.12.2 HOT 4
- clearCache for SQLiteNormalizedCache doesn't clear the sqlite file HOT 3
- Crash on com.apollographql.websocket on _inputStreamCallbackFunc HOT 2
- Naming conflict with Foundation in Xcode 16 HOT 2
- Xcode 15 Beta "Expression" name collision HOT 4
- ApolloSQLite doesn't compile on Xcode 16 due to `Expression` symbol clash with new `Foundation.Expression` HOT 3
- Request to clear derived data when switch from build for test to build for run HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apollo-ios.