-
Notifications
You must be signed in to change notification settings - Fork 1
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
disussion from 1248 #11
Comments
MyObj
(not MySimpleObj
). Could you provide example scenario for that?
dynamic graphql is not designed to work with the default async-graphql schema. only federation attributes (shareable, tag, ...) are not supported yet in dynamic-graphql
use #[derive(SimpleObject)]
#[graphql(root)]
struct Query {
foo: String,
#[graphql(skip)]
example: Option<Example>,
}
#[derive(SimpleObject)]
struct Example {
field: String,
}
#[derive(ExpandObject)]
struct ExampleQuery<'a>(&'a Query); // expand Query object type
#[ExpandObjectFields]
impl<'a> ExampleQuery<'a> {
fn example(&self) -> Option<&'a Example> { // define field example for query
self.0.example.as_ref()
}
} |
Another piece of advice: make your graphql layer as thin as possible and move business logic, authorization, etc to the business logic layer, and graphql only call the business logic layer without conditions and logics see more in here: graphql-python/graphene-django#79 (comment) |
@smmoosavi Thanks. I have checked first scenario but I wasn't able to fit it into my case. The main problem is that I have part of GQL application that is defined as in above example with
MyObj
(notMySimpleObj
). Could you provide example scenario for that?As far as I understand I need to rewrite all Object defined with
async_graphql
to be defined withdynamic_graphql
? Then it's hard to go from one library to second and still keep compatible. For example below will not compile:Also in my scenario I don't know how to use states correctly with
dynamic-graphql
crateExtendedObject
don't accept self as parameter.Below I share code that compile but panic at runtime with
I would be glad if you could help me understand how can I fix it.
Originally posted by @xoac in async-graphql/async-graphql#1248 (comment)
The text was updated successfully, but these errors were encountered: