diff --git a/server/src-lib/Hasura/LogicalModel/Schema.hs b/server/src-lib/Hasura/LogicalModel/Schema.hs index b8287fcc152..6f460fb5b7a 100644 --- a/server/src-lib/Hasura/LogicalModel/Schema.hs +++ b/server/src-lib/Hasura/LogicalModel/Schema.hs @@ -250,13 +250,22 @@ defaultLogicalModelSelectionSet logicalModel = runMaybeT do -- We entirely ignore Relay for now. implementsInterfaces = mempty - lift $ P.memoizeOn 'defaultLogicalModelSelectionSet fieldName do - -- we filter out parsers that return 'Nothing' as those we are no permitted to see. - parsers <- catMaybes <$> traverse (\(column, lmField, redactionExp) -> parseLogicalModelField mempty column lmField redactionExp) allowedColumns + -- we filter out parsers that return 'Nothing' as those we are no permitted to see. + parsers <- + catMaybes + <$> traverse + ( \(column, lmField, redactionExp) -> + lift (parseLogicalModelField mempty column lmField redactionExp) + ) + allowedColumns - pure - $ P.selectionSetObject fieldName description parsers implementsInterfaces - <&> parsedSelectionsToFields IR.AFExpression + -- if we have no fields, we can't create a parser + if null parsers + then hoistMaybe Nothing + else lift $ P.memoizeOn 'defaultLogicalModelSelectionSet fieldName do + pure + $ P.selectionSetObject fieldName description parsers implementsInterfaces + <&> parsedSelectionsToFields IR.AFExpression logicalModelSelectionList :: (MonadBuildSchema b r m n, BackendLogicalModelSelectSchema b) =>