Remove `SchemaBuilder::override_name` method. #437

This commit is contained in:
Sunli 2021-03-31 16:54:57 +08:00
parent 067ee207cc
commit 662454c103
4 changed files with 6 additions and 20 deletions

View File

@ -2,7 +2,11 @@
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).
nd this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
- Remove `SchemaBuilder::override_name` method. [#437](https://github.com/async-graphql/async-graphql/issues/437)
## [2.7.1]

@ -1 +1 @@
Subproject commit 5ed6f9829d3495ea9c182b08329c6026887dc551
Subproject commit 4a5cfe2fc16061e8febd74b0e18f2d30b1cc07e5

View File

@ -624,16 +624,4 @@ impl Registry {
None => {}
}
}
pub fn set_name<T: Type>(&mut self, new_name: String) {
match self.types.get_mut(&*T::type_name()) {
Some(MetaType::Scalar { name, .. }) => *name = new_name,
Some(MetaType::Object { name, .. }) => *name = new_name,
Some(MetaType::Interface { name, .. }) => *name = new_name,
Some(MetaType::Union { name, .. }) => *name = new_name,
Some(MetaType::Enum { name, .. }) => *name = new_name,
Some(MetaType::InputObject { name, .. }) => *name = new_name,
None => {}
}
}
}

View File

@ -119,12 +119,6 @@ impl<Query, Mutation, Subscription> SchemaBuilder<Query, Mutation, Subscription>
self
}
/// Override the name of the specified type.
pub fn override_name<T: Type>(mut self, new_name: impl Into<String>) -> Self {
self.registry.set_name::<T>(new_name.into());
self
}
/// Build schema.
pub fn finish(mut self) -> Schema<Query, Mutation, Subscription> {
// federation