2020-09-28 09:44:00 +00:00
|
|
|
use darling::ast::Data;
|
2020-03-01 10:54:34 +00:00
|
|
|
use proc_macro::TokenStream;
|
|
|
|
use quote::quote;
|
2022-04-19 04:25:11 +00:00
|
|
|
use syn::{ext::IdentExt, Error};
|
2020-03-01 10:54:34 +00:00
|
|
|
|
2022-04-19 04:25:11 +00:00
|
|
|
use crate::{
|
|
|
|
args::{self, RenameRuleExt, RenameTarget},
|
|
|
|
utils::{generate_default, get_crate_name, get_rustdoc, visible_fn, GeneratorResult},
|
|
|
|
};
|
2020-10-16 02:45:27 +00:00
|
|
|
|
2020-09-28 09:44:00 +00:00
|
|
|
pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream> {
|
2020-03-02 00:24:49 +00:00
|
|
|
let crate_name = get_crate_name(object_args.internal);
|
2021-01-14 03:27:15 +00:00
|
|
|
let (impl_generics, ty_generics, where_clause) = object_args.generics.split_for_impl();
|
2020-09-28 09:44:00 +00:00
|
|
|
let ident = &object_args.ident;
|
2022-08-18 09:40:04 +00:00
|
|
|
let inaccessible = object_args.inaccessible;
|
2022-08-22 09:44:02 +00:00
|
|
|
let tags = &object_args.tags;
|
2020-09-28 09:44:00 +00:00
|
|
|
let s = match &object_args.data {
|
2020-03-01 10:54:34 +00:00
|
|
|
Data::Struct(s) => s,
|
2020-09-28 09:44:00 +00:00
|
|
|
_ => {
|
|
|
|
return Err(
|
|
|
|
Error::new_spanned(ident, "InputObject can only be applied to an struct.").into(),
|
|
|
|
)
|
|
|
|
}
|
2020-03-01 10:54:34 +00:00
|
|
|
};
|
|
|
|
|
2020-03-03 03:48:00 +00:00
|
|
|
let mut struct_fields = Vec::new();
|
|
|
|
for field in &s.fields {
|
|
|
|
let vis = &field.vis;
|
|
|
|
let ty = &field.ty;
|
2021-05-06 08:44:36 +00:00
|
|
|
let ident = match &field.ident {
|
|
|
|
Some(ident) => ident,
|
|
|
|
None => return Err(Error::new_spanned(&ident, "All fields must be named.").into()),
|
|
|
|
};
|
2020-04-08 04:02:48 +00:00
|
|
|
let attrs = field
|
|
|
|
.attrs
|
|
|
|
.iter()
|
|
|
|
.filter(|attr| !attr.path.is_ident("field"))
|
|
|
|
.collect::<Vec<_>>();
|
2020-03-03 03:48:00 +00:00
|
|
|
struct_fields.push(quote! {
|
2020-04-08 04:02:48 +00:00
|
|
|
#(#attrs)*
|
2020-03-03 03:48:00 +00:00
|
|
|
#vis #ident: #ty
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-03-01 10:54:34 +00:00
|
|
|
let gql_typename = object_args
|
2022-07-18 08:34:57 +00:00
|
|
|
.input_name
|
2020-03-01 10:54:34 +00:00
|
|
|
.clone()
|
2022-07-18 08:34:57 +00:00
|
|
|
.or_else(|| object_args.name.clone())
|
2020-10-14 09:08:57 +00:00
|
|
|
.unwrap_or_else(|| RenameTarget::Type.rename(ident.to_string()));
|
2020-03-19 09:20:12 +00:00
|
|
|
|
2020-09-28 09:44:00 +00:00
|
|
|
let desc = get_rustdoc(&object_args.attrs)?
|
2020-10-16 10:37:59 +00:00
|
|
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
|
|
|
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
2020-03-01 10:54:34 +00:00
|
|
|
|
2020-03-01 13:35:39 +00:00
|
|
|
let mut get_fields = Vec::new();
|
2020-05-26 10:34:43 +00:00
|
|
|
let mut put_fields = Vec::new();
|
2020-03-01 13:35:39 +00:00
|
|
|
let mut fields = Vec::new();
|
2020-03-03 03:48:00 +00:00
|
|
|
let mut schema_fields = Vec::new();
|
2020-09-03 12:00:33 +00:00
|
|
|
let mut flatten_fields = Vec::new();
|
2021-02-21 13:29:03 +00:00
|
|
|
let mut federation_fields = Vec::new();
|
2020-03-01 16:52:05 +00:00
|
|
|
|
2020-03-01 10:54:34 +00:00
|
|
|
for field in &s.fields {
|
|
|
|
let ident = field.ident.as_ref().unwrap();
|
2020-03-01 13:35:39 +00:00
|
|
|
let ty = &field.ty;
|
2020-10-14 09:08:57 +00:00
|
|
|
let name = field.name.clone().unwrap_or_else(|| {
|
|
|
|
object_args
|
|
|
|
.rename_fields
|
|
|
|
.rename(ident.unraw().to_string(), RenameTarget::Field)
|
|
|
|
});
|
2022-08-18 09:40:04 +00:00
|
|
|
let inaccessible = field.inaccessible;
|
2022-08-22 09:44:02 +00:00
|
|
|
let tags = &field.tags;
|
2020-09-03 12:00:33 +00:00
|
|
|
|
2022-01-26 08:57:47 +00:00
|
|
|
if field.skip || field.skip_input {
|
2020-12-15 12:29:59 +00:00
|
|
|
get_fields.push(quote! {
|
|
|
|
let #ident: #ty = ::std::default::Default::default();
|
|
|
|
});
|
|
|
|
fields.push(ident);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-02-21 13:29:03 +00:00
|
|
|
federation_fields.push((ty, name.clone()));
|
|
|
|
|
2022-02-10 04:38:28 +00:00
|
|
|
let process_with = match field.process_with.as_ref() {
|
|
|
|
Some(fn_path) => {
|
2022-04-06 07:10:56 +00:00
|
|
|
let fn_path: syn::ExprPath = syn::parse_str(fn_path)?;
|
2022-02-10 04:38:28 +00:00
|
|
|
quote! {
|
|
|
|
#fn_path(&mut #ident);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
None => Default::default(),
|
|
|
|
};
|
|
|
|
|
2021-11-14 13:09:14 +00:00
|
|
|
let validators = field
|
|
|
|
.validator
|
|
|
|
.clone()
|
|
|
|
.unwrap_or_default()
|
|
|
|
.create_validators(
|
|
|
|
&crate_name,
|
|
|
|
quote!(&#ident),
|
2021-11-17 00:46:13 +00:00
|
|
|
quote!(#ty),
|
2021-11-15 01:12:13 +00:00
|
|
|
Some(quote!(.map_err(#crate_name::InputValueError::propagate))),
|
2021-11-15 03:08:56 +00:00
|
|
|
)?;
|
2021-11-14 13:09:14 +00:00
|
|
|
|
2020-09-28 09:44:00 +00:00
|
|
|
if field.flatten {
|
2020-09-03 12:00:33 +00:00
|
|
|
flatten_fields.push((ident, ty));
|
|
|
|
|
|
|
|
schema_fields.push(quote! {
|
2020-09-29 23:45:48 +00:00
|
|
|
#crate_name::static_assertions::assert_impl_one!(#ty: #crate_name::InputObjectType);
|
2022-08-05 06:50:29 +00:00
|
|
|
<#ty as #crate_name::InputType>::create_type_info(registry);
|
2020-10-20 03:49:31 +00:00
|
|
|
if let #crate_name::registry::MetaType::InputObject { input_fields, .. } =
|
2021-11-09 10:52:10 +00:00
|
|
|
registry.create_fake_input_type::<#ty>() {
|
2020-10-20 03:49:31 +00:00
|
|
|
fields.extend(input_fields);
|
2020-09-03 12:00:33 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
get_fields.push(quote! {
|
2022-02-10 04:38:28 +00:00
|
|
|
#[allow(unused_mut)]
|
|
|
|
let mut #ident: #ty = #crate_name::InputType::parse(
|
2020-10-16 19:21:46 +00:00
|
|
|
::std::option::Option::Some(#crate_name::Value::Object(::std::clone::Clone::clone(&obj)))
|
2020-10-03 23:49:56 +00:00
|
|
|
).map_err(#crate_name::InputValueError::propagate)?;
|
2022-02-10 04:38:28 +00:00
|
|
|
#process_with
|
2021-11-14 13:09:14 +00:00
|
|
|
#validators
|
2020-09-03 12:00:33 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
fields.push(ident);
|
|
|
|
|
|
|
|
put_fields.push(quote! {
|
2020-12-11 07:37:50 +00:00
|
|
|
if let #crate_name::Value::Object(values) = #crate_name::InputType::to_value(&self.#ident) {
|
2020-09-03 12:00:33 +00:00
|
|
|
map.extend(values);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2020-09-28 09:44:00 +00:00
|
|
|
let desc = get_rustdoc(&field.attrs)?
|
2020-10-16 10:37:59 +00:00
|
|
|
.map(|s| quote! { ::std::option::Option::Some(#s) })
|
|
|
|
.unwrap_or_else(|| quote! {::std::option::Option::None});
|
2020-09-28 09:44:00 +00:00
|
|
|
let default = generate_default(&field.default, &field.default_with)?;
|
|
|
|
let schema_default = default
|
2020-03-03 03:48:00 +00:00
|
|
|
.as_ref()
|
2020-05-26 10:34:43 +00:00
|
|
|
.map(|value| {
|
2020-10-16 19:21:46 +00:00
|
|
|
quote! {
|
|
|
|
::std::option::Option::Some(::std::string::ToString::to_string(
|
2020-12-11 07:37:50 +00:00
|
|
|
&<#ty as #crate_name::InputType>::to_value(&#value)
|
2020-10-16 19:21:46 +00:00
|
|
|
))
|
|
|
|
}
|
2020-03-03 03:48:00 +00:00
|
|
|
})
|
2020-10-16 19:21:46 +00:00
|
|
|
.unwrap_or_else(|| quote!(::std::option::Option::None));
|
2021-04-07 08:23:28 +00:00
|
|
|
let secret = field.secret;
|
2020-03-04 02:38:07 +00:00
|
|
|
|
2020-09-28 09:44:00 +00:00
|
|
|
if let Some(default) = default {
|
2020-03-04 02:38:07 +00:00
|
|
|
get_fields.push(quote! {
|
2020-10-14 09:08:57 +00:00
|
|
|
#[allow(non_snake_case)]
|
2020-05-26 10:34:43 +00:00
|
|
|
let #ident: #ty = {
|
2020-03-04 02:38:07 +00:00
|
|
|
match obj.get(#name) {
|
2020-10-16 10:37:59 +00:00
|
|
|
::std::option::Option::Some(value) => {
|
2022-02-10 04:38:28 +00:00
|
|
|
#[allow(unused_mut)]
|
|
|
|
let mut #ident = #crate_name::InputType::parse(::std::option::Option::Some(::std::clone::Clone::clone(&value)))
|
|
|
|
.map_err(#crate_name::InputValueError::propagate)?;
|
|
|
|
#process_with
|
|
|
|
#ident
|
|
|
|
|
2020-10-16 10:37:59 +00:00
|
|
|
},
|
|
|
|
::std::option::Option::None => #default,
|
2020-03-04 02:38:07 +00:00
|
|
|
}
|
|
|
|
};
|
2021-11-14 13:09:14 +00:00
|
|
|
#validators
|
2020-03-04 02:38:07 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
get_fields.push(quote! {
|
2022-02-10 04:38:28 +00:00
|
|
|
#[allow(non_snake_case, unused_mut)]
|
|
|
|
let mut #ident: #ty = #crate_name::InputType::parse(obj.get(#name).cloned())
|
2020-10-03 23:49:56 +00:00
|
|
|
.map_err(#crate_name::InputValueError::propagate)?;
|
2022-02-10 04:38:28 +00:00
|
|
|
#process_with
|
2021-11-14 13:09:14 +00:00
|
|
|
#validators
|
2020-03-04 02:38:07 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-05-26 10:34:43 +00:00
|
|
|
put_fields.push(quote! {
|
2020-09-08 08:21:27 +00:00
|
|
|
map.insert(
|
2020-10-11 12:24:31 +00:00
|
|
|
#crate_name::Name::new(#name),
|
2020-12-11 07:37:50 +00:00
|
|
|
#crate_name::InputType::to_value(&self.#ident)
|
2020-09-08 08:21:27 +00:00
|
|
|
);
|
2020-05-26 10:34:43 +00:00
|
|
|
});
|
|
|
|
|
2020-03-01 13:35:39 +00:00
|
|
|
fields.push(ident);
|
2020-12-11 08:03:28 +00:00
|
|
|
let visible = visible_fn(&field.visible);
|
2020-03-03 03:48:00 +00:00
|
|
|
schema_fields.push(quote! {
|
2020-10-16 19:21:46 +00:00
|
|
|
fields.insert(::std::borrow::ToOwned::to_owned(#name), #crate_name::registry::MetaInputValue {
|
2020-03-03 03:48:00 +00:00
|
|
|
name: #name,
|
|
|
|
description: #desc,
|
2021-11-09 10:52:10 +00:00
|
|
|
ty: <#ty as #crate_name::InputType>::create_type_info(registry),
|
2020-05-26 10:34:43 +00:00
|
|
|
default_value: #schema_default,
|
2020-12-11 08:03:28 +00:00
|
|
|
visible: #visible,
|
2022-08-18 09:40:04 +00:00
|
|
|
inaccessible: #inaccessible,
|
2022-08-22 09:44:02 +00:00
|
|
|
tags: &[ #(#tags),* ],
|
2021-04-07 08:23:28 +00:00
|
|
|
is_secret: #secret,
|
2020-04-05 08:00:26 +00:00
|
|
|
});
|
2020-03-03 03:48:00 +00:00
|
|
|
})
|
2020-03-01 10:54:34 +00:00
|
|
|
}
|
|
|
|
|
2020-10-20 03:49:31 +00:00
|
|
|
if get_fields.is_empty() {
|
|
|
|
return Err(Error::new_spanned(
|
|
|
|
&ident,
|
2020-10-22 02:11:47 +00:00
|
|
|
"A GraphQL Input Object type must define one or more input fields.",
|
2020-10-20 03:49:31 +00:00
|
|
|
)
|
|
|
|
.into());
|
|
|
|
}
|
|
|
|
|
2020-12-11 08:03:28 +00:00
|
|
|
let visible = visible_fn(&object_args.visible);
|
2021-01-14 03:27:15 +00:00
|
|
|
|
2021-02-21 13:29:03 +00:00
|
|
|
let get_federation_fields = {
|
|
|
|
let fields = federation_fields.into_iter().map(|(ty, name)| {
|
|
|
|
quote! {
|
|
|
|
if let ::std::option::Option::Some(fields) = <#ty as #crate_name::InputType>::federation_fields() {
|
|
|
|
res.push(::std::format!("{} {}", #name, fields));
|
|
|
|
} else {
|
|
|
|
res.push(::std::string::ToString::to_string(#name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
quote! {
|
|
|
|
let mut res = ::std::vec::Vec::new();
|
|
|
|
#(#fields)*
|
|
|
|
::std::option::Option::Some(::std::format!("{{ {} }}", res.join(" ")))
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
let expanded = if object_args.concretes.is_empty() {
|
|
|
|
quote! {
|
|
|
|
#[allow(clippy::all, clippy::pedantic)]
|
2021-11-09 10:52:10 +00:00
|
|
|
impl #crate_name::InputType for #ident {
|
2021-11-18 07:43:12 +00:00
|
|
|
type RawValueType = Self;
|
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
fn type_name() -> ::std::borrow::Cow<'static, ::std::primitive::str> {
|
|
|
|
::std::borrow::Cow::Borrowed(#gql_typename)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn create_type_info(registry: &mut #crate_name::registry::Registry) -> ::std::string::String {
|
2022-03-30 12:54:49 +00:00
|
|
|
registry.create_input_type::<Self, _>(#crate_name::registry::MetaTypeId::InputObject, |registry| #crate_name::registry::MetaType::InputObject {
|
2021-01-14 03:27:15 +00:00
|
|
|
name: ::std::borrow::ToOwned::to_owned(#gql_typename),
|
|
|
|
description: #desc,
|
|
|
|
input_fields: {
|
|
|
|
let mut fields = #crate_name::indexmap::IndexMap::new();
|
|
|
|
#(#schema_fields)*
|
|
|
|
fields
|
|
|
|
},
|
|
|
|
visible: #visible,
|
2022-08-18 09:40:04 +00:00
|
|
|
inaccessible: #inaccessible,
|
2022-08-22 09:44:02 +00:00
|
|
|
tags: &[ #(#tags),* ],
|
2021-11-08 01:33:20 +00:00
|
|
|
rust_typename: ::std::any::type_name::<Self>(),
|
2022-02-17 08:55:32 +00:00
|
|
|
oneof: false,
|
2021-01-14 03:27:15 +00:00
|
|
|
})
|
|
|
|
}
|
2020-03-03 03:48:00 +00:00
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
fn parse(value: ::std::option::Option<#crate_name::Value>) -> #crate_name::InputValueResult<Self> {
|
|
|
|
if let ::std::option::Option::Some(#crate_name::Value::Object(obj)) = value {
|
|
|
|
#(#get_fields)*
|
|
|
|
::std::result::Result::Ok(Self { #(#fields),* })
|
|
|
|
} else {
|
|
|
|
::std::result::Result::Err(#crate_name::InputValueError::expected_type(value.unwrap_or_default()))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn to_value(&self) -> #crate_name::Value {
|
2021-10-26 10:57:39 +00:00
|
|
|
let mut map = #crate_name::indexmap::IndexMap::new();
|
2021-01-14 03:27:15 +00:00
|
|
|
#(#put_fields)*
|
|
|
|
#crate_name::Value::Object(map)
|
|
|
|
}
|
2021-02-21 13:29:03 +00:00
|
|
|
|
|
|
|
fn federation_fields() -> ::std::option::Option<::std::string::String> {
|
|
|
|
#get_federation_fields
|
|
|
|
}
|
2021-11-18 07:43:12 +00:00
|
|
|
|
|
|
|
fn as_raw_value(&self) -> ::std::option::Option<&Self::RawValueType> {
|
|
|
|
::std::option::Option::Some(self)
|
|
|
|
}
|
2020-03-03 03:48:00 +00:00
|
|
|
}
|
2021-01-14 03:27:15 +00:00
|
|
|
|
|
|
|
impl #crate_name::InputObjectType for #ident {}
|
2020-03-01 10:54:34 +00:00
|
|
|
}
|
2021-01-14 03:27:15 +00:00
|
|
|
} else {
|
|
|
|
let mut code = Vec::new();
|
2020-03-01 10:54:34 +00:00
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
code.push(quote! {
|
|
|
|
#[allow(clippy::all, clippy::pedantic)]
|
|
|
|
impl #impl_generics #ident #ty_generics #where_clause {
|
2021-01-14 11:20:28 +00:00
|
|
|
fn __internal_create_type_info(registry: &mut #crate_name::registry::Registry, name: &str) -> ::std::string::String where Self: #crate_name::InputType {
|
2022-03-30 12:54:49 +00:00
|
|
|
registry.create_input_type::<Self, _>(#crate_name::registry::MetaTypeId::InputObject, |registry| #crate_name::registry::MetaType::InputObject {
|
2021-01-14 11:20:28 +00:00
|
|
|
name: ::std::borrow::ToOwned::to_owned(name),
|
2021-01-14 03:27:15 +00:00
|
|
|
description: #desc,
|
|
|
|
input_fields: {
|
|
|
|
let mut fields = #crate_name::indexmap::IndexMap::new();
|
|
|
|
#(#schema_fields)*
|
|
|
|
fields
|
|
|
|
},
|
|
|
|
visible: #visible,
|
2022-08-18 09:40:04 +00:00
|
|
|
inaccessible: #inaccessible,
|
2022-08-22 09:44:02 +00:00
|
|
|
tags: &[ #(#tags),* ],
|
2021-11-08 01:33:20 +00:00
|
|
|
rust_typename: ::std::any::type_name::<Self>(),
|
2022-02-17 08:55:32 +00:00
|
|
|
oneof: false,
|
2021-01-14 03:27:15 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
fn __internal_parse(value: ::std::option::Option<#crate_name::Value>) -> #crate_name::InputValueResult<Self> where Self: #crate_name::InputType {
|
|
|
|
if let ::std::option::Option::Some(#crate_name::Value::Object(obj)) = value {
|
|
|
|
#(#get_fields)*
|
|
|
|
::std::result::Result::Ok(Self { #(#fields),* })
|
|
|
|
} else {
|
|
|
|
::std::result::Result::Err(#crate_name::InputValueError::expected_type(value.unwrap_or_default()))
|
|
|
|
}
|
2020-03-01 13:35:39 +00:00
|
|
|
}
|
2020-05-26 10:34:43 +00:00
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
fn __internal_to_value(&self) -> #crate_name::Value where Self: #crate_name::InputType {
|
2021-10-26 10:57:39 +00:00
|
|
|
let mut map = #crate_name::indexmap::IndexMap::new();
|
2021-01-14 03:27:15 +00:00
|
|
|
#(#put_fields)*
|
|
|
|
#crate_name::Value::Object(map)
|
|
|
|
}
|
2021-02-21 13:29:03 +00:00
|
|
|
|
2022-03-14 01:46:06 +00:00
|
|
|
fn __internal_federation_fields() -> ::std::option::Option<::std::string::String> where Self: #crate_name::InputType {
|
2021-02-21 13:29:03 +00:00
|
|
|
#get_federation_fields
|
|
|
|
}
|
2020-05-26 10:34:43 +00:00
|
|
|
}
|
2021-01-14 03:27:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
for concrete in &object_args.concretes {
|
|
|
|
let gql_typename = &concrete.name;
|
|
|
|
let params = &concrete.params.0;
|
|
|
|
let concrete_type = quote! { #ident<#(#params),*> };
|
2020-09-27 07:32:55 +00:00
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
let expanded = quote! {
|
|
|
|
#[allow(clippy::all, clippy::pedantic)]
|
2021-11-09 10:52:10 +00:00
|
|
|
impl #crate_name::InputType for #concrete_type {
|
2021-11-18 07:43:12 +00:00
|
|
|
type RawValueType = Self;
|
|
|
|
|
2021-01-14 03:27:15 +00:00
|
|
|
fn type_name() -> ::std::borrow::Cow<'static, ::std::primitive::str> {
|
|
|
|
::std::borrow::Cow::Borrowed(#gql_typename)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn create_type_info(registry: &mut #crate_name::registry::Registry) -> ::std::string::String {
|
2021-01-14 11:20:28 +00:00
|
|
|
Self::__internal_create_type_info(registry, #gql_typename)
|
2021-01-14 03:27:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn parse(value: ::std::option::Option<#crate_name::Value>) -> #crate_name::InputValueResult<Self> {
|
|
|
|
Self::__internal_parse(value)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn to_value(&self) -> #crate_name::Value {
|
|
|
|
self.__internal_to_value()
|
|
|
|
}
|
2021-02-21 13:29:03 +00:00
|
|
|
|
|
|
|
fn federation_fields() -> ::std::option::Option<::std::string::String> {
|
|
|
|
Self::__internal_federation_fields()
|
|
|
|
}
|
2021-11-18 07:43:12 +00:00
|
|
|
|
|
|
|
fn as_raw_value(&self) -> ::std::option::Option<&Self::RawValueType> {
|
|
|
|
::std::option::Option::Some(self)
|
|
|
|
}
|
2021-01-14 03:27:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl #crate_name::InputObjectType for #concrete_type {}
|
|
|
|
};
|
|
|
|
code.push(expanded);
|
|
|
|
}
|
|
|
|
quote!(#(#code)*)
|
2020-03-01 10:54:34 +00:00
|
|
|
};
|
2022-03-14 01:46:06 +00:00
|
|
|
|
2020-03-01 10:54:34 +00:00
|
|
|
Ok(expanded.into())
|
|
|
|
}
|