mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 08:02:15 +03:00
Remove ModelsGraphqlOutput::graphql_types
, as it's not used. (#769)
### What This removes an unused field. The remaining struct had just one field and is private to the crate, so I converted it to a type alias. ### How In order to make `rustc` highlight the issue, I reduced the number of types we export as `pub`, changing some to `pub(crate)`. Then I just deleted the field once the warning showed up. V3_GIT_ORIGIN_REV_ID: 7a26e99f062ed0f2c7449e1f57bc76068f059afb
This commit is contained in:
parent
5b2e36cd4f
commit
00db411c6e
@ -154,10 +154,7 @@ pub fn resolve(
|
||||
|
||||
// Resolve the filter expressions and graphql settings for models
|
||||
// This is a separate step so we can look up resolved models and their sources
|
||||
let models_graphql::ModelsGraphqlOutput {
|
||||
models_with_graphql,
|
||||
graphql_types: _,
|
||||
} = models_graphql::resolve(
|
||||
let models_with_graphql = models_graphql::resolve(
|
||||
&metadata_accessor,
|
||||
&models,
|
||||
&data_connector_scalars,
|
||||
|
@ -1,23 +1,22 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use open_dds::{
|
||||
arguments::ArgumentName,
|
||||
data_connector::{DataConnectorColumnName, DataConnectorOperatorName},
|
||||
models::ModelName,
|
||||
permissions::Role,
|
||||
relationships::{RelationshipName, RelationshipType},
|
||||
types::{CustomTypeName, FieldName},
|
||||
};
|
||||
|
||||
use crate::stages::{data_connectors, models, models_graphql, object_types, relationships};
|
||||
use crate::types::error::{Error, RelationshipError};
|
||||
use crate::types::permission::ValueExpression;
|
||||
use crate::types::subgraph::{deserialize_qualified_btreemap, serialize_qualified_btreemap};
|
||||
use open_dds::{
|
||||
data_connector::{DataConnectorColumnName, DataConnectorOperatorName},
|
||||
models::ModelName,
|
||||
relationships::{RelationshipName, RelationshipType},
|
||||
types::CustomTypeName,
|
||||
};
|
||||
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use crate::types::subgraph::{Qualified, QualifiedTypeReference};
|
||||
|
||||
use ndc_models;
|
||||
|
||||
use open_dds::{arguments::ArgumentName, permissions::Role, types::FieldName};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub struct ModelWithPermissions {
|
||||
pub model: models::Model,
|
||||
|
@ -1,25 +1,27 @@
|
||||
mod filter;
|
||||
mod graphql;
|
||||
mod types;
|
||||
use crate::types::subgraph::Qualified;
|
||||
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
|
||||
use lang_graphql::ast::common as ast;
|
||||
use open_dds::{data_connector::DataConnectorName, models::ModelName, types::CustomTypeName};
|
||||
|
||||
use crate::stages::{
|
||||
boolean_expressions, data_connector_scalar_types, graphql_config, models,
|
||||
object_boolean_expressions, relationships,
|
||||
};
|
||||
use crate::types::error::Error;
|
||||
use crate::types::subgraph::Qualified;
|
||||
|
||||
pub(crate) use types::ModelWithGraphql;
|
||||
pub use types::{
|
||||
ModelExpressionType, ModelGraphQlApi, ModelOrderByExpression, ModelWithGraphql,
|
||||
ModelsGraphqlOutput, SelectAggregateGraphQlDefinition, SelectManyGraphQlDefinition,
|
||||
SelectUniqueGraphQlDefinition,
|
||||
ModelExpressionType, ModelGraphQlApi, ModelOrderByExpression, SelectAggregateGraphQlDefinition,
|
||||
SelectManyGraphQlDefinition, SelectUniqueGraphQlDefinition,
|
||||
};
|
||||
|
||||
use open_dds::{data_connector::DataConnectorName, models::ModelName, types::CustomTypeName};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use lang_graphql::ast::common::{self as ast};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
pub fn resolve(
|
||||
metadata_accessor: &open_dds::accessor::MetadataAccessor,
|
||||
models: &IndexMap<Qualified<ModelName>, models::Model>,
|
||||
@ -35,9 +37,11 @@ pub fn resolve(
|
||||
boolean_expression_types: &boolean_expressions::BooleanExpressionTypes,
|
||||
existing_graphql_types: &BTreeSet<ast::TypeName>,
|
||||
graphql_config: &graphql_config::GraphqlConfig,
|
||||
) -> Result<ModelsGraphqlOutput, Error> {
|
||||
let mut models_with_graphql = IndexMap::new();
|
||||
let mut graphql_types = existing_graphql_types.clone();
|
||||
) -> Result<types::ModelsWithGraphql, Error> {
|
||||
let mut models_with_graphql = types::ModelsWithGraphql::new();
|
||||
|
||||
// Used to ensure we don't resolve the same type twice.
|
||||
let mut existing_graphql_types = existing_graphql_types.clone();
|
||||
|
||||
for (model_name, model) in models.clone() {
|
||||
let filter_expression_type = match &model.raw.filter_expression_type {
|
||||
@ -70,18 +74,18 @@ pub fn resolve(
|
||||
metadata_accessor,
|
||||
model_graphql_definition,
|
||||
&model,
|
||||
&mut graphql_types,
|
||||
&mut existing_graphql_types,
|
||||
data_connector_scalars,
|
||||
&model.raw.description,
|
||||
&model.aggregate_expression,
|
||||
graphql_config,
|
||||
)?,
|
||||
None => ModelGraphQlApi::default(),
|
||||
None => types::ModelGraphQlApi::default(),
|
||||
};
|
||||
|
||||
models_with_graphql.insert(
|
||||
model_name,
|
||||
ModelWithGraphql {
|
||||
types::ModelWithGraphql {
|
||||
inner: model,
|
||||
graphql_api,
|
||||
filter_expression_type,
|
||||
@ -89,8 +93,5 @@ pub fn resolve(
|
||||
);
|
||||
}
|
||||
|
||||
Ok(ModelsGraphqlOutput {
|
||||
models_with_graphql,
|
||||
graphql_types,
|
||||
})
|
||||
Ok(models_with_graphql)
|
||||
}
|
||||
|
@ -1,31 +1,28 @@
|
||||
use crate::stages::{boolean_expressions, models, object_boolean_expressions};
|
||||
use crate::types::subgraph::{Qualified, QualifiedTypeReference};
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use lang_graphql::ast::common::{self as ast};
|
||||
use open_dds::{
|
||||
aggregates::AggregateExpressionName,
|
||||
data_connector::{DataConnectorColumnName, DataConnectorName},
|
||||
models::ModelName,
|
||||
types::FieldName,
|
||||
types::{Deprecated, FieldName},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
use crate::helpers::types::NdcColumnForComparison;
|
||||
use lang_graphql::ast::common::{self as ast};
|
||||
|
||||
use open_dds::aggregates::AggregateExpressionName;
|
||||
use open_dds::types::Deprecated;
|
||||
use crate::stages::{boolean_expressions, models, object_boolean_expressions};
|
||||
use crate::types::subgraph::{Qualified, QualifiedTypeReference};
|
||||
|
||||
/// A Model, once we have added filter expression and graphql for it
|
||||
pub struct ModelWithGraphql {
|
||||
pub(crate) struct ModelWithGraphql {
|
||||
pub inner: models::Model,
|
||||
pub filter_expression_type: Option<ModelExpressionType>,
|
||||
pub graphql_api: ModelGraphQlApi,
|
||||
}
|
||||
|
||||
pub struct ModelsGraphqlOutput {
|
||||
pub models_with_graphql: IndexMap<Qualified<ModelName>, ModelWithGraphql>,
|
||||
pub graphql_types: BTreeSet<ast::TypeName>,
|
||||
}
|
||||
pub(crate) type ModelsWithGraphql = IndexMap<Qualified<ModelName>, ModelWithGraphql>;
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||
pub enum ModelExpressionType {
|
||||
|
Loading…
Reference in New Issue
Block a user