Document ActionFieldsG

<!-- Thank you for ss in the Title above ^ -->

## Description ✍️
<!-- Please fill this se-->
<!-- Describe the changes from a user's perspective -->

Add some documentation on `ActionFieldG` type.

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3945
GitOrigin-RevId: d9543ed7a8fe3ccfe9f5267c3a2ac71fb040f4db
This commit is contained in:
David Overton 2022-03-12 12:37:11 +11:00 committed by hasura-bot
parent d28c3bea49
commit ac87eff905
3 changed files with 17 additions and 8 deletions

View File

@ -139,9 +139,9 @@ resolveActionExecution env logger _userInfo AnnActionExecution {..} ActionExecCo
_aaeResponseTransform
-- | Build action response from the Webhook JSON response when there are no relationships defined
makeActionResponseNoRelations :: RA.ActionFieldsG Void -> ActionWebhookResponse -> AO.Value
makeActionResponseNoRelations :: RA.ActionFields -> ActionWebhookResponse -> AO.Value
makeActionResponseNoRelations annFields webhookResponse =
let mkResponseObject :: RA.ActionFieldsG Void -> HashMap Text J.Value -> AO.Value
let mkResponseObject :: RA.ActionFields -> HashMap Text J.Value -> AO.Value
mkResponseObject fields obj =
AO.object $
flip mapMaybe fields $ \(fieldName, annField) ->
@ -603,7 +603,7 @@ processOutputSelectionSet ::
RS.ArgumentExp v ->
GraphQLType ->
[(PGCol, PGScalarType)] ->
RA.ActionFieldsG Void ->
RA.ActionFields ->
StringifyNumbers ->
RS.AnnSimpleSelectG ('Postgres 'Vanilla) Void v
processOutputSelectionSet tableRowInput actionOutputType definitionList actionFields =

View File

@ -400,7 +400,7 @@ transformAnnFields fields = do
-- 'RemoteJoin'.
transformActionFields ::
ActionFieldsG (RemoteRelationshipField UnpreparedValue) ->
Collector (ActionFieldsG Void)
Collector ActionFields
transformActionFields fields = do
-- Produces a list of transformed fields that may or may not have an
-- associated remote join.

View File

@ -16,11 +16,20 @@ import Hasura.Prelude
import Hasura.RQL.Types.Common (FieldName, Fields)
import Language.GraphQL.Draft.Syntax qualified as G
-- | Internal representation for a selection of fields on the result of an action.
-- Type parameter r will be either
-- r ~ (RemoteRelationshipField UnpreparedValue) when the AST is emitted by the parser.
-- r ~ Void when an execution tree is constructed so that a backend is
-- absolved of dealing with remote relationships.
data ActionFieldG (r :: Type)
= ACFScalar G.Name
| ACFRemote (ActionRemoteRelationshipSelect r)
| ACFExpression Text
| ACFNestedObject G.Name !(ActionFieldsG r)
= -- | Scalar value. G.Name is the original field name from the object type.
ACFScalar G.Name
| -- | Remote relationship
ACFRemote (ActionRemoteRelationshipSelect r)
| -- | Constant text value (used for __typename fields)
ACFExpression Text
| -- | Nested object. G.Name is the original field name from the object type.
ACFNestedObject G.Name !(ActionFieldsG r)
deriving (Eq, Show, Functor, Foldable, Traversable)
type ActionFieldsG r = Fields (ActionFieldG r)