mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-15 17:31:56 +03:00
Fixed arbitrary ordering of directions in GraphqlConfig causing error (#625)
## Description If the user specified their orderings in their GraphqlConfig in a different order, they would be presented with an error. ```yaml enumTypeNames: - directions: # Reversed ordering of this list - Desc - Asc typeName: OrderBy ``` > ERR Code=opendds-validation Message="invalid metadata: error building schema: unable to build schema: metadata is not consistent: invalid directions: Desc,Asc defined in orderByInput of GraphqlConfig , currenlty there is no support for partial directions. Please specify a type which has both 'asc' and 'desc' directions" 7:56PM ERR Supergraph Build failed. This has been fixed. ## Changelog ### Product _(Select all products this will be available in)_ - [x] community-edition - [x] cloud <!-- product : end : DO NOT REMOVE --> ### Type <!-- See changelog structure: https://github.com/hasura/graphql-engine-mono/wiki/Changelog-Guide#structure-of-our-changelog --> _(Select only one. In case of multiple, choose the most appropriate)_ - [ ] highlight - [ ] enhancement - [x] bugfix - [ ] behaviour-change - [ ] performance-enhancement - [ ] security-fix <!-- type : end : DO NOT REMOVE --> ### Changelog entry <!-- - Add a user understandable changelog entry - Include all details needed to understand the change. Try including links to docs or issues if relevant - For Highlights start with a H4 heading (#### <entry title>) - Get the changelog entry reviewed by your team --> Fixed arbitrary ordering of directions in GraphqlConfig causing invalid error <!-- changelog-entry : end : DO NOT REMOVE --> <!-- changelog : end : DO NOT REMOVE --> V3_GIT_ORIGIN_REV_ID: b27a0dd3b5c665f54ea58a40af8b2b1bfb0d2434
This commit is contained in:
parent
01711c20da
commit
a132759dac
@ -1,5 +1,7 @@
|
|||||||
//! This is where we will resolve graphql configuration
|
//! This is where we will resolve graphql configuration
|
||||||
|
|
||||||
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::helpers::types::mk_name;
|
use crate::helpers::types::mk_name;
|
||||||
use crate::types::error::{Error, GraphqlConfigError};
|
use crate::types::error::{Error, GraphqlConfigError};
|
||||||
use lang_graphql::ast::common as ast;
|
use lang_graphql::ast::common as ast;
|
||||||
@ -206,8 +208,8 @@ pub fn resolve_graphql_config(
|
|||||||
// TODO: Naveen: Currently we do not allow enabling a specific direction
|
// TODO: Naveen: Currently we do not allow enabling a specific direction
|
||||||
// for orderableField. In future when we support this, we would like to
|
// for orderableField. In future when we support this, we would like to
|
||||||
// build different enum types for different variations of directions.
|
// build different enum types for different variations of directions.
|
||||||
if order_by_enum_type.directions
|
if HashSet::from_iter(order_by_enum_type.directions.iter().cloned())
|
||||||
!= vec![OrderByDirection::Asc, OrderByDirection::Desc]
|
!= HashSet::from([OrderByDirection::Asc, OrderByDirection::Desc])
|
||||||
{
|
{
|
||||||
let invalid_directions = order_by_enum_type
|
let invalid_directions = order_by_enum_type
|
||||||
.directions
|
.directions
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"enumTypeNames": [
|
"enumTypeNames": [
|
||||||
{
|
{
|
||||||
"directions": ["Asc", "Desc"],
|
"directions": ["Desc", "Asc"],
|
||||||
"typeName": "OrderByAscDesc"
|
"typeName": "OrderByAscDesc"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user