You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to omit password_hash in the generated GraphQl type.
Is this possible at the moment or do I have to create another Struct?
A way of omitting some fields would be great.
Thanks.
The text was updated successfully, but these errors were encountered:
sporto
changed the title
Hide attr when using derive GraphQLObject
Omit field when using derive GraphQLObject
Aug 13, 2018
While there isn't a way to omit a field like serde's skip_serializing , but I think one should be able to do this like so:
#[derive(Queryable,Debug)]pubstructUser{pubid:i32,pubemail:String,pubpassword_hash:String,
...
}graphql_object!(User: () |&self| {
description: "A user in the database"
field id() -> &i32as"The user's unique identifier"{
&self.id
}
field email() -> &Stringas"The user's email"{
&self.email
}
... other fields to expose leaving out password_hash
});
However, I have to admit I haven't tried this.
LegNeato
added a commit
to LegNeato/juniper
that referenced
this issue
Aug 16, 2018
Fields can now be skipped with the `#[graphql(skip)]` annotation. Note this
doesn't really make sense for GraphQLInputObjects so this isn't supported there.
Fixesgraphql-rust#220.
Fields can now be skipped with the `#[graphql(skip)]` annotation. Note this
doesn't really make sense for GraphQLInputObjects so this isn't supported there.
Fixesgraphql-rust#220.
I have a struct like (which doubles as a diesel model):
I would like to omit
password_hash
in the generated GraphQl type.Is this possible at the moment or do I have to create another Struct?
A way of omitting some fields would be great.
Thanks.
The text was updated successfully, but these errors were encountered: