Fix impossible to specify both `name` and `input_name`. #987
This commit is contained in:
parent
fc30e51381
commit
69b09f2636
|
@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
# [4.0.5] 2022-07-18
|
||||
|
||||
- Fix serializing of JSON default values [#969](https://github.com/async-graphql/async-graphql/issues/969)
|
||||
- Bump `rocket-0.5.0-rc.1` to `rocket-0.5.0-rc.2` for `async-graphql-rocket` [#968](https://github.com/async-graphql/async-graphql/pull/968)
|
||||
- Implement `Default` for `StringNumber` [#980](https://github.com/async-graphql/async-graphql/issues/980)
|
||||
- Implement `Guard` for `Fn`
|
||||
- Fix impossible to specify both `name` and `input_name` [#987](https://github.com/async-graphql/async-graphql/issues/987)
|
||||
|
||||
|
||||
# [4.0.4] 2022-6-25
|
||||
|
||||
- Bump Actix-web from `4.0.1` to `4.1.0`
|
||||
|
|
|
@ -41,9 +41,9 @@ pub fn generate(object_args: &args::InputObject) -> GeneratorResult<TokenStream>
|
|||
}
|
||||
|
||||
let gql_typename = object_args
|
||||
.name
|
||||
.input_name
|
||||
.clone()
|
||||
.or_else(|| object_args.input_name.clone())
|
||||
.or_else(|| object_args.name.clone())
|
||||
.unwrap_or_else(|| RenameTarget::Type.rename(ident.to_string()));
|
||||
|
||||
let desc = get_rustdoc(&object_args.attrs)?
|
||||
|
|
|
@ -407,6 +407,23 @@ pub async fn test_both_input_output() {
|
|||
assert_eq!(<MyObject as OutputType>::type_name(), "MyObject");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
pub async fn test_both_input_output_2() {
|
||||
#[derive(SimpleObject, InputObject)]
|
||||
#[graphql(name = "MyObj", input_name = "MyObjectInput")]
|
||||
#[allow(dead_code)]
|
||||
struct MyObject {
|
||||
#[graphql(default = 10)]
|
||||
a: i32,
|
||||
b: bool,
|
||||
#[graphql(skip)]
|
||||
c: String,
|
||||
}
|
||||
|
||||
assert_eq!(<MyObject as InputType>::type_name(), "MyObjectInput");
|
||||
assert_eq!(<MyObject as OutputType>::type_name(), "MyObj");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic]
|
||||
pub fn test_both_input_output_with_same_name() {
|
||||
|
|
Loading…
Reference in New Issue