async-graphql/src/schema/type.rs

71 lines
2.5 KiB
Rust
Raw Normal View History

2020-03-02 11:25:21 +00:00
use crate::schema::{__EnumValue, __InputValue, __TypeKind};
use crate::{ContextField, Result};
2020-03-02 00:24:49 +00:00
use async_graphql_derive::Object;
2020-03-02 11:25:21 +00:00
#[Object(
internal,
desc = r#"
The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.
"#,
field(name = "kind", type = "__TypeKind", owned),
field(name = "name", type = "String", owned),
field(name = "description", type = "Option<String>", owned),
field(
name = "fields",
type = "Option<Vec<__Type>>",
owned,
arg(name = "includeDeprecated", type = "bool")
),
field(name = "interfaces", type = "Option<Vec<__Type>>", owned),
field(name = "possibleTypes", type = "Option<Vec<__Type>>", owned),
field(name = "enumValues", type = "Option<Vec<__EnumValue>>", owned),
field(name = "inputFields", type = "Option<Vec<__InputValue>>", owned),
field(name = "ofType", type = "Option<__Type>", owned)
)]
pub struct __Type {}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
#[async_trait::async_trait]
impl __TypeFields for __Type {
async fn kind<'a>(&'a self, _: &ContextField<'_>) -> Result<__TypeKind> {
todo!()
}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
async fn name<'a>(&'a self, _: &ContextField<'_>) -> Result<String> {
todo!()
}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
async fn description<'a>(&'a self, _: &ContextField<'_>) -> Result<Option<String>> {
todo!()
}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
async fn fields<'a>(
&'a self,
_: &ContextField<'_>,
include_deprecated: bool,
) -> Result<Option<Vec<__Type>>> {
todo!()
}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
async fn interfaces<'a>(&'a self, _: &ContextField<'_>) -> Result<Option<Vec<__Type>>> {
todo!()
}
async fn possible_types<'a>(&'a self, _: &ContextField<'_>) -> Result<Option<Vec<__Type>>> {
todo!()
}
async fn enum_values<'a>(&'a self, _: &ContextField<'_>) -> Result<Option<Vec<__EnumValue>>> {
todo!()
}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
async fn input_fields<'a>(&'a self, _: &ContextField<'_>) -> Result<Option<Vec<__InputValue>>> {
todo!()
}
2020-03-02 00:24:49 +00:00
2020-03-02 11:25:21 +00:00
async fn of_type<'a>(&'a self, _: &ContextField<'_>) -> Result<Option<__Type>> {
todo!()
}
2020-03-02 00:24:49 +00:00
}