Comments (10)
Branch dynamic-interface
supports the flatten
property, we may need sufficient validation to merge to the master
, because this will break the type safety of the interface.
Here are all the tests:
Line 4 in 8714185
Line 41 in 8714185
Line 73 in 8714185
from async-graphql.
This is pretty easy to implement, but I can't make an object that contains the flatten fields support Interface
.😭
from async-graphql.
Does that mean you cannot support the flatten attribute on interfaces or objects that use flatten cannot implement an interface? I think having flatten would kind of sort #35 in that you can combine a SimpleObject with an Object.
from async-graphql.
Yes, it's the same problem. I can't pass data between macros, which makes it impossible. But all of these problems can be solved with generic specialization, so let's wait for this feature to stabilize. 😂
from async-graphql.
So I poked around a little in the code base. I tried to manually (without macros) implement an "Object" by implementing ObjectType, OutputValueType and Type on a struct. I can't quite get create_type_info
to work correctly but I thought it should be possible to create a trait Merge
with required methods async fn base(&self) -> impl ObjectType
and async fn extend(&self) -> impl ObjectType
and then implement impl<T> ObjectType for T where T: Merge { ... }
so that it registers all fields on the object returned from a call to self.base()
and self.extend()
. Or maybe even a method like async fn objects(&self) -> Vec<Box<dyn ObjectType>>
. Could that work or have I hit a dead end?
from async-graphql.
The main reason is that Interface
cannot be supported. The field of Interface
is function forwarding, which can achieve the purpose of type safety.
from async-graphql.
If I don't need to support the Interface
, I've actually implemented it.😁
from async-graphql.
Unless you abandon the type-safety of the interface, which is not what this library is for.
from async-graphql.
The Edge
type actually does that, it moves the extra_type
to a higher level, but the field inside the extra_type
doesn't support interface.
fn Edge::node()
and fn Edge::cursor()
are actually intended to support the interface.
from async-graphql.
That is very nice! 👍
from async-graphql.
Related Issues (20)
- Adding `tracing` feature throws Cargo error HOT 1
- Support callback protocol for subscription HOT 2
- SDL only includes directives when `.federation()` is enabled. HOT 1
- Bug: Axum 0.7.2 integration trait implementation HOT 2
- [Question] I'm having an error requesting a lifetime on the macro [#Object] HOT 2
- `.sdl()` include anonymous lifetime on custom scalar and generate invalid GraphQL. HOT 1
- Result<Option<T>> doesn't return partial results. (while Option<Result<T>> does.) HOT 7
- How can we use methods outside of graphql request context? HOT 3
- Stack overflow at `Schema::new()` when generic type's method returns self
- Consider disable the default features in Axum
- Better documentation HOT 3
- Async-graphql actix_web subscriptions don't work HOT 1
- Share data between guard and resolver HOT 2
- Add #[graphql(optional)] for fields (provde less boilerplate and more correctness) HOT 2
- async-graph-axum 7.0.0 only works with axum 0.7.0
- Cannot use string to publish to async channel HOT 3
- How to extract the query name in middleware HOT 3
- Disable introspection, returns null in __typename--Dynamic Schema
- How to view the graphql endpoint in Apollo studio explorer? HOT 2
- How do you create a model that doesn't have hardcoded values? HOT 1
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 async-graphql.