Make using ObjectBooleanExpressionType an error (#1344)

<!-- The PR description should answer 2 important questions: -->

### What

These have been deprecated for a while, and we now have a codemod to fix
users metadata, so it's time to make these officially deprecated. Any
`ObjectBooleanExpressionType` will now raise an error.

V3_GIT_ORIGIN_REV_ID: f3dd18afba40e369e82a15a7fbbfe31004d44067
This commit is contained in:
Daniel Harvey 2024-11-14 16:35:56 +00:00 committed by hasura-bot
parent 4e89dd40eb
commit ee3c1a5a9a
4 changed files with 27 additions and 5 deletions

View File

@ -1,5 +1,5 @@
use crate::stages::{boolean_expressions, data_connectors};
use crate::types::error::ShouldBeAnError;
use crate::types::subgraph::Qualified;
use std::collections::BTreeMap;
@ -45,6 +45,16 @@ pub struct ObjectBooleanExpressionGraphqlConfig {
#[derive(Debug, thiserror::Error)]
pub enum ObjectBooleanExpressionIssue {
#[error("ObjectBooleanExpressionType is deprecated in favour of BooleanExpressionType. Please consider upgrading {name:}.")]
#[error("ObjectBooleanExpressionType is deprecated. Please consider upgrading {name:} to a BooleanExpressionType. https://hasura.io/docs/3.0/cli/commands/ddn_codemod_upgrade-object-boolean-expression-types/")]
PleaseUpgradeToBooleanExpression { name: Qualified<CustomTypeName> },
}
impl ShouldBeAnError for ObjectBooleanExpressionIssue {
fn should_be_an_error(&self, flags: &open_dds::flags::Flags) -> bool {
match self {
ObjectBooleanExpressionIssue::PleaseUpgradeToBooleanExpression { .. } => {
flags.disallow_object_boolean_expression_type
}
}
}
}

View File

@ -38,6 +38,7 @@ impl ShouldBeAnError for Warning {
match self {
Warning::DataConnectorIssue(issue) => issue.should_be_an_error(flags),
Warning::BooleanExpressionIssue(issue) => issue.should_be_an_error(flags),
Warning::ObjectBooleanExpressionIssue(issue) => issue.should_be_an_error(flags),
Warning::ScalarTypesIssue(issue) => issue.should_be_an_error(flags),
Warning::ModelGraphqlIssue(issue) => issue.should_be_an_error(flags),
Warning::CommandIssue(issue) => issue.should_be_an_error(flags),

View File

@ -3490,6 +3490,10 @@
"require_unique_model_graphql_names": {
"default": false,
"type": "boolean"
},
"disallow_object_boolean_expression_type": {
"default": false,
"type": "boolean"
}
},
"additionalProperties": false
@ -3534,7 +3538,8 @@
"json_session_variables": false,
"disallow_array_field_compared_with_scalar_boolean_type": false,
"allow_boolean_expression_fields_without_graphql": false,
"require_unique_model_graphql_names": false
"require_unique_model_graphql_names": false,
"disallow_object_boolean_expression_type": false
},
"allOf": [
{
@ -3590,7 +3595,8 @@
"json_session_variables": false,
"disallow_array_field_compared_with_scalar_boolean_type": false,
"allow_boolean_expression_fields_without_graphql": false,
"require_unique_model_graphql_names": false
"require_unique_model_graphql_names": false,
"disallow_object_boolean_expression_type": false
},
"allOf": [
{
@ -3636,7 +3642,8 @@
"json_session_variables": false,
"disallow_array_field_compared_with_scalar_boolean_type": false,
"allow_boolean_expression_fields_without_graphql": false,
"require_unique_model_graphql_names": false
"require_unique_model_graphql_names": false,
"disallow_object_boolean_expression_type": false
},
"allOf": [
{

View File

@ -47,6 +47,9 @@ pub struct Flags {
#[opendd(default, rename = "require_unique_model_graphql_names")]
pub require_unique_model_graphql_names: bool,
#[opendd(default, rename = "disallow_object_boolean_expression_type")]
pub disallow_object_boolean_expression_type: bool,
}
impl Flags {
@ -65,6 +68,7 @@ impl Flags {
disallow_array_field_compared_with_scalar_boolean_type: false,
allow_boolean_expression_fields_without_graphql: false,
require_unique_model_graphql_names: false,
disallow_object_boolean_expression_type: false,
}
}