mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-10-26 10:20:54 +03:00
Rename get_underlying_object_type
(#506)
<!-- Thank you for submitting this PR! :) --> ## Description The function changed, the name did not, now it makes no sense. Also it's friend wasn't even used anymore. Functional no-op. V3_GIT_ORIGIN_REV_ID: 626316acd06f15d89e504365d21131177a41dada
This commit is contained in:
parent
89812dd1ee
commit
746b18c9c4
@ -8,7 +8,7 @@ use crate::metadata::resolved::subgraph::{
|
||||
ArgumentInfo, Qualified, QualifiedTypeReference,
|
||||
};
|
||||
use crate::metadata::resolved::types::{
|
||||
get_type_representation, get_underlying_object_type, unwrap_custom_type_name,
|
||||
get_type_representation, object_type_exists, unwrap_custom_type_name,
|
||||
};
|
||||
use crate::metadata::resolved::types::{mk_name, TypeMapping};
|
||||
use indexmap::IndexMap;
|
||||
@ -247,9 +247,7 @@ pub fn resolve_command_source(
|
||||
|
||||
// get object type name if it exists for the output type, and refers to a valid object
|
||||
let command_result_base_object_type_name = unwrap_custom_type_name(&command.output_type)
|
||||
.and_then(|custom_type_name| {
|
||||
get_underlying_object_type(custom_type_name, object_types).ok()
|
||||
});
|
||||
.and_then(|custom_type_name| object_type_exists(custom_type_name, object_types).ok());
|
||||
|
||||
let mut type_mappings = BTreeMap::new();
|
||||
|
||||
|
@ -255,7 +255,7 @@ pub fn get_type_representation<'a>(
|
||||
}
|
||||
|
||||
// check that `custom_type_name` exists in `object_types`
|
||||
pub fn get_underlying_object_type(
|
||||
pub fn object_type_exists(
|
||||
custom_type_name: &Qualified<CustomTypeName>,
|
||||
object_types: &HashMap<Qualified<CustomTypeName>, type_permissions::ObjectTypeWithPermissions>,
|
||||
) -> Result<Qualified<CustomTypeName>, Error> {
|
||||
@ -267,19 +267,6 @@ pub fn get_underlying_object_type(
|
||||
})
|
||||
}
|
||||
|
||||
// check that `custom_type_name` exists in `scalar_types`
|
||||
pub fn get_underlying_scalar_type(
|
||||
custom_type_name: &Qualified<CustomTypeName>,
|
||||
scalar_types: &HashMap<Qualified<CustomTypeName>, scalar_types::ScalarTypeRepresentation>,
|
||||
) -> Result<Qualified<CustomTypeName>, Error> {
|
||||
scalar_types
|
||||
.get(custom_type_name)
|
||||
.map(|_| custom_type_name.clone())
|
||||
.ok_or_else(|| Error::UnknownScalarType {
|
||||
data_type: custom_type_name.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
/// given a type like `Thing!` or `[Thing!]!` - try and extract `Thing`
|
||||
pub fn unwrap_custom_type_name(
|
||||
type_reference: &QualifiedTypeReference,
|
||||
|
@ -6,7 +6,7 @@ use crate::metadata::resolved::permission::resolve_value_expression;
|
||||
use crate::metadata::resolved::stages::type_permissions;
|
||||
use crate::metadata::resolved::subgraph::{Qualified, QualifiedTypeReference};
|
||||
use crate::metadata::resolved::types::{
|
||||
get_underlying_object_type, unwrap_custom_type_name, FieldMapping, TypeMapping,
|
||||
object_type_exists, unwrap_custom_type_name, FieldMapping, TypeMapping,
|
||||
};
|
||||
use crate::metadata::resolved::{self};
|
||||
use crate::schema::Role;
|
||||
@ -232,7 +232,7 @@ fn build_annotations_from_input_object_type_permissions(
|
||||
role_presets_map: &mut HashMap<Role, types::ArgumentPresets>,
|
||||
) -> Result<(), schema::Error> {
|
||||
if let Some(custom_typename) = unwrap_custom_type_name(type_reference) {
|
||||
if let Ok(object_type) = get_underlying_object_type(custom_typename, object_types) {
|
||||
if let Ok(object_type) = object_type_exists(custom_typename, object_types) {
|
||||
if let Some(object_type_repr) = object_types.get(&object_type) {
|
||||
let field_mappings =
|
||||
type_mappings
|
||||
|
Loading…
Reference in New Issue
Block a user