2022-10-04 11:30:09 +03:00
|
|
|
cabal-version: 2.2
|
|
|
|
name: api-tests
|
|
|
|
version: 1.0.0
|
2022-12-01 17:47:34 +03:00
|
|
|
build-type: Simple
|
|
|
|
copyright: Hasura Inc.
|
|
|
|
extra-source-files: README.md
|
2022-11-18 04:33:00 +03:00
|
|
|
|
2023-01-30 14:23:08 +03:00
|
|
|
common common-all
|
|
|
|
ghc-options:
|
|
|
|
-Werror
|
|
|
|
-- Taken from https://medium.com/mercury-bank/enable-all-the-warnings-a0517bc081c3
|
|
|
|
-Weverything
|
|
|
|
-Wno-missing-exported-signatures
|
|
|
|
-Wno-missing-import-lists
|
|
|
|
-Wno-missed-specialisations
|
|
|
|
-Wno-all-missed-specialisations
|
|
|
|
-Wno-unsafe
|
|
|
|
-Wno-safe
|
|
|
|
-Wno-missing-local-signatures
|
|
|
|
-Wno-monomorphism-restriction
|
|
|
|
-Wno-missing-kind-signatures
|
|
|
|
-Wno-missing-safe-haskell-mode
|
|
|
|
-- We want these warnings, but the code doesn't satisfy them yet:
|
|
|
|
-Wno-missing-deriving-strategies
|
|
|
|
-Wno-unused-packages
|
|
|
|
-Wno-partial-fields
|
|
|
|
-Wno-missing-export-lists
|
|
|
|
-Wno-implicit-prelude
|
|
|
|
|
2022-11-18 04:33:00 +03:00
|
|
|
library
|
2023-01-30 14:23:08 +03:00
|
|
|
import: common-all
|
2022-10-04 11:30:09 +03:00
|
|
|
build-tool-depends: hspec-discover:hspec-discover
|
2022-11-18 04:33:00 +03:00
|
|
|
hs-source-dirs: src
|
2022-12-01 17:47:34 +03:00
|
|
|
default-language: GHC2021
|
2022-11-18 04:33:00 +03:00
|
|
|
|
|
|
|
default-extensions:
|
|
|
|
BlockArguments
|
|
|
|
DataKinds
|
|
|
|
DeriveGeneric
|
|
|
|
DerivingStrategies
|
|
|
|
ImportQualifiedPost
|
|
|
|
LambdaCase
|
|
|
|
MultiWayIf
|
|
|
|
NamedFieldPuns
|
|
|
|
NoImplicitPrelude
|
|
|
|
OverloadedStrings
|
|
|
|
PatternGuards
|
2022-11-25 18:39:12 +03:00
|
|
|
QuasiQuotes
|
2022-11-18 04:33:00 +03:00
|
|
|
RecordWildCards
|
|
|
|
ScopedTypeVariables
|
|
|
|
TypeApplications
|
|
|
|
TypeFamilies
|
|
|
|
|
2022-10-04 11:30:09 +03:00
|
|
|
build-depends:
|
|
|
|
, HUnit
|
|
|
|
, aeson
|
2022-12-22 14:25:28 +03:00
|
|
|
, aeson-pretty
|
2022-10-04 11:30:09 +03:00
|
|
|
, base
|
|
|
|
, bytestring
|
2023-03-22 12:54:22 +03:00
|
|
|
, data-has
|
2022-10-04 11:30:09 +03:00
|
|
|
, dc-api
|
2023-01-03 17:03:35 +03:00
|
|
|
, directory
|
2022-10-04 11:30:09 +03:00
|
|
|
, fast-logger
|
2023-01-03 17:03:35 +03:00
|
|
|
, filepath
|
2023-01-20 14:15:04 +03:00
|
|
|
, graphql-engine
|
2022-10-27 03:42:49 +03:00
|
|
|
, graphql-parser
|
2022-10-04 11:30:09 +03:00
|
|
|
, hasura-prelude
|
|
|
|
, hspec
|
2022-11-09 17:54:49 +03:00
|
|
|
, hspec-core
|
2022-10-04 11:30:09 +03:00
|
|
|
, http-conduit
|
|
|
|
, http-types
|
|
|
|
, lens
|
|
|
|
, lens-aeson
|
2022-11-10 11:36:36 +03:00
|
|
|
, managed
|
2022-10-04 11:30:09 +03:00
|
|
|
, morpheus-graphql
|
|
|
|
, pg-client
|
2022-11-10 12:42:41 +03:00
|
|
|
, postgres-options
|
2023-01-03 17:03:35 +03:00
|
|
|
, postgresql-simple
|
2022-10-04 11:30:09 +03:00
|
|
|
, safe-exceptions
|
2023-01-03 17:03:35 +03:00
|
|
|
, sop-core
|
2022-10-04 11:30:09 +03:00
|
|
|
, split
|
2022-11-30 14:01:33 +03:00
|
|
|
, string-interpolate
|
2022-10-04 11:30:09 +03:00
|
|
|
, test-harness
|
|
|
|
, text
|
|
|
|
, unordered-containers
|
|
|
|
, uuid
|
|
|
|
, vector
|
2023-02-01 11:44:50 +03:00
|
|
|
, time
|
2022-10-04 11:30:09 +03:00
|
|
|
|
2022-11-18 04:33:00 +03:00
|
|
|
exposed-modules:
|
|
|
|
Spec
|
2022-10-04 11:30:09 +03:00
|
|
|
SpecHook
|
2022-12-05 16:48:58 +03:00
|
|
|
Test.API.ConcurrentBulkSpec
|
2022-11-15 20:28:23 +03:00
|
|
|
Test.API.ExplainSpec
|
2023-02-02 00:31:23 +03:00
|
|
|
Test.API.GraphQL.ContentLengthSpec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.API.Metadata.ComputedFieldsSpec
|
|
|
|
Test.API.Metadata.InconsistentSpec
|
2023-02-21 16:45:12 +03:00
|
|
|
Test.API.Metadata.LogicalModelsSpec
|
2023-03-21 21:46:11 +03:00
|
|
|
Test.API.Metadata.LogicalModels.ValidationSpec
|
2023-01-30 19:04:56 +03:00
|
|
|
Test.API.Metadata.SuggestRelationshipsSpec
|
2023-01-25 10:12:53 +03:00
|
|
|
Test.API.Metadata.TestConnectionTemplateSpec
|
2022-12-07 01:33:54 +03:00
|
|
|
Test.API.Metadata.TransparentDefaultsSpec
|
2023-02-20 17:19:14 +03:00
|
|
|
Test.API.Metadata.WarningsSpec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.API.Schema.RunSQLSpec
|
|
|
|
Test.Auth.Authorization.DisableRootFields.Common
|
|
|
|
Test.Auth.Authorization.DisableRootFields.DefaultRootFieldsSpec
|
|
|
|
Test.Auth.Authorization.DisableRootFields.SelectPermission.DisableAllRootFieldsSpec
|
|
|
|
Test.Auth.Authorization.DisableRootFields.SelectPermission.EnableAggSpec
|
|
|
|
Test.Auth.Authorization.DisableRootFields.SelectPermission.EnableAllRootFieldsSpec
|
|
|
|
Test.Auth.Authorization.DisableRootFields.SelectPermission.EnablePKSpec
|
2022-11-17 14:53:17 +03:00
|
|
|
Test.Auth.Authorization.DisableRootFields.SelectPermission.RelationshipSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.DataConnector.AggregateQuerySpec
|
|
|
|
Test.DataConnector.MetadataApiSpec
|
|
|
|
Test.DataConnector.MockAgent.AggregateQuerySpec
|
|
|
|
Test.DataConnector.MockAgent.BasicQuerySpec
|
2022-12-01 03:07:16 +03:00
|
|
|
Test.DataConnector.MockAgent.CustomScalarsSpec
|
2023-01-24 07:17:31 +03:00
|
|
|
Test.DataConnector.MockAgent.DeleteMutationsSpec
|
2022-10-11 03:25:07 +03:00
|
|
|
Test.DataConnector.MockAgent.ErrorSpec
|
2023-01-17 03:33:56 +03:00
|
|
|
Test.DataConnector.MockAgent.InsertMutationsSpec
|
2022-12-02 11:01:06 +03:00
|
|
|
Test.DataConnector.MockAgent.MetadataApiSpec
|
2023-02-06 07:18:54 +03:00
|
|
|
Test.DataConnector.MockAgent.OrderBySpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.DataConnector.MockAgent.QueryRelationshipsSpec
|
2023-03-07 04:31:50 +03:00
|
|
|
Test.DataConnector.MockAgent.RemoteRelationshipsSpec
|
2023-03-20 07:00:34 +03:00
|
|
|
Test.DataConnector.MockAgent.TestHelpers
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.DataConnector.MockAgent.TransformedConfigurationSpec
|
2023-01-20 09:16:39 +03:00
|
|
|
Test.DataConnector.MockAgent.UpdateMutationsSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.DataConnector.QuerySpec
|
|
|
|
Test.DataConnector.SelectPermissionsSpec
|
2023-03-24 18:15:24 +03:00
|
|
|
Test.Databases.BigQuery.LogicalModelsSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.Databases.BigQuery.Queries.SpatialTypesSpec
|
|
|
|
Test.Databases.BigQuery.Queries.TypeInterpretationSpec
|
|
|
|
Test.Databases.BigQuery.Schema.ComputedFields.TableSpec
|
|
|
|
Test.Databases.Postgres.BackendOnlyPermissionsSpec
|
|
|
|
Test.Databases.Postgres.DataValidation.PermissionSpec
|
|
|
|
Test.Databases.Postgres.JsonbSpec
|
2023-03-23 15:24:05 +03:00
|
|
|
Test.Databases.Postgres.LogicalModelsSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.Databases.Postgres.TimestampSpec
|
|
|
|
Test.Databases.Postgres.UniqueConstraintsSpec
|
|
|
|
Test.Databases.SQLServer.DefaultValues.OnConflictSpec
|
|
|
|
Test.Databases.SQLServer.InsertVarcharColumnSpec
|
2023-03-27 19:54:27 +03:00
|
|
|
Test.Databases.SQLServer.LogicalModelsSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.Databases.SQLServer.VarcharLiteralsSpec
|
2023-01-10 11:49:32 +03:00
|
|
|
Test.EventTriggers.EventTriggersSpecialCharactersSpec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.EventTriggers.MSSQL.EventTriggerDropSourceCleanupSpec
|
2023-01-20 14:15:04 +03:00
|
|
|
Test.EventTriggers.MSSQL.EventTriggerNextRetryAtTimezoneSpec
|
2022-11-29 20:41:41 +03:00
|
|
|
Test.EventTriggers.MSSQL.EventTriggersForReplicationSpec
|
2023-01-03 09:46:23 +03:00
|
|
|
Test.EventTriggers.MSSQL.EventTriggersNameQuotingSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.EventTriggers.MSSQL.EventTriggersUniqueNameSpec
|
2022-12-01 19:42:11 +03:00
|
|
|
Test.EventTriggers.MSSQL.EventTriggersUntrackTableCleanupSpec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.EventTriggers.PG.EventTriggersExtensionSchemaSpec
|
2022-12-01 19:42:11 +03:00
|
|
|
Test.EventTriggers.PG.EventTriggersForReplicationSpec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.EventTriggers.PG.EventTriggersRecreationSpec
|
|
|
|
Test.EventTriggers.PG.EventTriggersReplaceMetadataCleanupSpec
|
2023-01-31 20:39:36 +03:00
|
|
|
Test.EventTriggers.PG.EventTriggersClearMetadataSpec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.EventTriggers.PG.EventTriggersRunSQLSpec
|
|
|
|
Test.EventTriggers.PG.EventTriggersUniqueNameSpec
|
|
|
|
Test.EventTriggers.PG.EventTriggersUntrackTableCleanupSpec
|
|
|
|
Test.Harness.Quoter.YamlSpec
|
2023-02-03 18:18:40 +03:00
|
|
|
Test.HealthCheckSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.HelloWorldSpec
|
2022-10-12 18:02:17 +03:00
|
|
|
Test.Mutations.Delete.AllSpec
|
|
|
|
Test.Mutations.Delete.FieldSpec
|
|
|
|
Test.Mutations.Delete.NestedFieldSpec
|
|
|
|
Test.Mutations.Delete.PrimaryKeySpec
|
2022-10-11 14:17:01 +03:00
|
|
|
Test.Mutations.Insert.MultipleSpec
|
|
|
|
Test.Mutations.Insert.SingleSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Mutations.MultiplePerRequest.UpdateManySpec
|
2022-10-11 18:17:21 +03:00
|
|
|
Test.Mutations.Update.FieldSpec
|
|
|
|
Test.Mutations.Update.PrimaryKeySpec
|
2022-11-15 16:15:52 +03:00
|
|
|
Test.Mutations.Upsert.OnConflictSpec
|
server: use kriti template to generate query param from list
## Description ✍️
This PR adds support to generate query params directly using a kriti template which can be used to flatten a list of parameter arguments as well.
### Changes in the Metadata API
Earlier the `query_params` key inside `request_transform` used to take in an object of key/value pairs where the `key` represents the query parameter name and `value` points to the value of the parameter or a kriti template which could be resolved to the value.
With this PR, we provide the user with more freedom to generate the complete query string using kriti template. The `query_params` can now take in a string as well which will be a kriti template. This new change needs to be incorporated on the console and CLI metadata import/export as well.
- [x] CLI: Compatible, no changes required
- [ ] Console
## Changelog ✍️
__Component__ : server
__Type__: feature
__Product__: community-edition
### Short Changelog
use kriti template to generate query param from list of arguments
### Related Issues ✍
https://hasurahq.atlassian.net/browse/GS-243
### Solution and Design ✍
We use a kriti template to generate the complete query parameter string.
| Query Template | Output |
|---|---|
| `{{ concat ([concat({{ range _, x := [\"apple\", \"banana\"] }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}`| `tags=apple&tags=banana&flag=smthng` |
| `{{ concat ([\"tags=\", concat({{ range _, x := $body.input }} \"{{x}},\" {{ end }})]) }}` | `tags=apple%2Cbanana%2C` |
### Steps to test and verify ✍
- start HGE and make the following request to `http://localhost:8080/v1/metadata`:
```json
{
"type": "test_webhook_transform",
"args": {
"webhook_url": "http://localhost:3000",
"body": {
"action": {
"name": "actionName"
},
"input": ["apple", "banana"]
},
"request_transform": {
"version": 2,
"url": "{{$base_url}}",
"query_params": "{{ concat ([concat({{ range _, x := $body.input }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}",
"template_engine": "Kriti"
}
}
}
```
- you should receive the following as output:
```json
{
"body": {
"action": {
"name": "actionName"
},
"input": [
"apple",
"banana"
]
},
"headers": [],
"method": "GET",
"webhook_url": "http://localhost:3000?tags=apple&tags=banana&flag=smthng"
}
```
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6961
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 712ba038f03009edc3e8eb0435e723304943399a
2022-11-29 23:26:04 +03:00
|
|
|
Test.PortedFromPytest.TestGraphQLQueryBasicCitus
|
2022-12-15 19:41:13 +03:00
|
|
|
Test.PortedFromPytest.TestGraphQLQueryFunctions
|
2022-10-05 15:36:59 +03:00
|
|
|
Test.Queries.AggregationSpec
|
2022-12-15 19:41:13 +03:00
|
|
|
Test.Queries.CustomFunctions.PortedSpec
|
2022-11-01 22:56:50 +03:00
|
|
|
Test.Queries.DistinctSpec
|
2023-02-03 12:58:46 +03:00
|
|
|
Test.Queries.Errors.EmptyRootsAreNotAvailableSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.Queries.Errors.InvalidQuerySpec
|
|
|
|
Test.Queries.Errors.MissingTableSpec
|
|
|
|
Test.Queries.Errors.NoQueriesAvailableSpec
|
2022-11-15 20:28:23 +03:00
|
|
|
Test.Queries.FilterSearch.AggregationPredicatesSpec
|
|
|
|
Test.Queries.FilterSearch.FilterSearchSpec
|
2023-02-21 16:45:12 +03:00
|
|
|
Test.Queries.LogicalModels.LogicalModelsQueriesSpec
|
2023-02-28 14:17:08 +03:00
|
|
|
Test.Queries.LogicalModels.SubscriptionsSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Queries.NestedObjectSpec
|
|
|
|
Test.Queries.Paginate.LimitSpec
|
|
|
|
Test.Queries.Paginate.OffsetSpec
|
|
|
|
Test.Queries.Simple.ObjectQueriesSpec
|
|
|
|
Test.Queries.Simple.OperationNameSpec
|
|
|
|
Test.Queries.Simple.PrimaryKeySpec
|
|
|
|
Test.Queries.SortSpec
|
2022-11-15 20:28:23 +03:00
|
|
|
Test.Queries.VariablesAliasesFragments.AliasesSpec
|
|
|
|
Test.Queries.VariablesAliasesFragments.Directives.DirectivesSpec
|
|
|
|
Test.Queries.VariablesAliasesFragments.Directives.IncludeAndSkipSpec
|
|
|
|
Test.Queries.VariablesAliasesFragments.Directives.IncludeSpec
|
|
|
|
Test.Queries.VariablesAliasesFragments.Directives.SkipSpec
|
|
|
|
Test.Queries.VariablesAliasesFragments.FragmentsSpec
|
|
|
|
Test.Queries.VariablesAliasesFragments.VariablesSpec
|
2022-10-21 16:27:14 +03:00
|
|
|
Test.Regression.AggregateBoolExpConflictSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Regression.ArrayLiteralTextEncodingSpec
|
|
|
|
Test.Regression.DoNotTruncateSessionVariables8158Spec
|
|
|
|
Test.Regression.DropColumnWithPermissions8415Spec
|
|
|
|
Test.Regression.InsertOnConflict8260Spec
|
2022-11-16 22:27:41 +03:00
|
|
|
Test.Regression.LongIdentifiers3796Spec
|
2022-11-15 20:28:23 +03:00
|
|
|
Test.Regression.MultiColumnObjectRelationshipsSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.Regression.MultiplexQuerySpec
|
2022-10-20 03:10:26 +03:00
|
|
|
Test.Regression.NullRemoteRelationship8345Spec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Regression.NullsOrderParsing8780Spec
|
|
|
|
Test.Regression.ObjectRelationshipsLimit7936Spec
|
2022-12-19 17:03:13 +03:00
|
|
|
Test.Regression.RemoteRelationshipStringifyNum8387Spec
|
2022-11-04 16:08:40 +03:00
|
|
|
Test.Regression.StreamConflictSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Regression.UsingTheSameFunctionForRootFieldAndComputedField8643Spec
|
2023-02-16 14:18:46 +03:00
|
|
|
Test.Regression.SqlServerIdentifierQuotingSpec
|
2023-03-14 15:27:17 +03:00
|
|
|
Test.ScheduledEvents.ScheduledEventsInvalidEnvVarSpec
|
2022-11-30 14:01:33 +03:00
|
|
|
Test.Schema.ComputedFields.ScalarSpec
|
2022-12-01 19:42:11 +03:00
|
|
|
Test.Schema.ComputedFields.TableSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Schema.ConflictsSpec
|
2022-10-05 15:36:59 +03:00
|
|
|
Test.Schema.CustomFieldNames.MutationSpec
|
|
|
|
Test.Schema.CustomFieldNames.QuerySpec
|
2022-11-16 16:22:42 +03:00
|
|
|
Test.Schema.CustomFieldsSpec
|
2022-11-15 16:15:52 +03:00
|
|
|
Test.Schema.DataValidations.Permissions.InsertSpec
|
|
|
|
Test.Schema.DataValidations.Permissions.SelectSpec
|
2022-12-08 11:02:44 +03:00
|
|
|
Test.Schema.DataValidations.Permissions.UpdateSpec
|
2022-11-18 01:34:02 +03:00
|
|
|
Test.Schema.DefaultValues.DefaultValuesSpec
|
|
|
|
Test.Schema.DefaultValues.OnConflictSpec
|
2022-11-15 16:15:52 +03:00
|
|
|
Test.Schema.EnumsSpec
|
|
|
|
Test.Schema.RemoteRelationships.FromRemoteSchemaSpec
|
|
|
|
Test.Schema.RemoteRelationships.MetadataAPI.ClearMetadataSpec
|
|
|
|
Test.Schema.RemoteRelationships.MetadataAPI.Common
|
|
|
|
Test.Schema.RemoteRelationships.MetadataAPI.DropSource.DBtoDBRelationshipSpec
|
|
|
|
Test.Schema.RemoteRelationships.MetadataAPI.DropSource.RSToDBRelationshipSpec
|
|
|
|
Test.Schema.RemoteRelationships.XToDBArrayRelationshipSpec
|
|
|
|
Test.Schema.RemoteRelationships.XToDBObjectRelationshipSpec
|
|
|
|
Test.Schema.RemoteRelationships.XToRemoteSchemaRelationshipSpec
|
2022-12-01 19:42:11 +03:00
|
|
|
Test.Schema.RemoteSchemaCustomizationSpec
|
2023-02-01 19:18:17 +03:00
|
|
|
Test.Schema.TableRelationships.ArrayRelationshipsSpec
|
2023-01-06 18:34:59 +03:00
|
|
|
Test.Schema.TableRelationships.CrossSchemaArrayRelationshipsSpec
|
|
|
|
Test.Schema.TableRelationships.CrossSchemaObjectRelationshipsSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Schema.TableRelationships.ObjectRelationshipsSpec
|
2022-11-25 18:39:12 +03:00
|
|
|
Test.Schema.TableRelationships.PortedSpec
|
2022-10-04 11:30:09 +03:00
|
|
|
Test.Schema.ViewsSpec
|
2022-11-04 14:52:34 +03:00
|
|
|
Test.Subscriptions.DerivedDataSpec
|
2022-11-16 16:22:42 +03:00
|
|
|
Test.Subscriptions.RowUpdatesSpec
|
2022-11-02 16:21:45 +03:00
|
|
|
Test.Subscriptions.StreamingSubscriptionsSpec
|
server: use kriti template to generate query param from list
## Description ✍️
This PR adds support to generate query params directly using a kriti template which can be used to flatten a list of parameter arguments as well.
### Changes in the Metadata API
Earlier the `query_params` key inside `request_transform` used to take in an object of key/value pairs where the `key` represents the query parameter name and `value` points to the value of the parameter or a kriti template which could be resolved to the value.
With this PR, we provide the user with more freedom to generate the complete query string using kriti template. The `query_params` can now take in a string as well which will be a kriti template. This new change needs to be incorporated on the console and CLI metadata import/export as well.
- [x] CLI: Compatible, no changes required
- [ ] Console
## Changelog ✍️
__Component__ : server
__Type__: feature
__Product__: community-edition
### Short Changelog
use kriti template to generate query param from list of arguments
### Related Issues ✍
https://hasurahq.atlassian.net/browse/GS-243
### Solution and Design ✍
We use a kriti template to generate the complete query parameter string.
| Query Template | Output |
|---|---|
| `{{ concat ([concat({{ range _, x := [\"apple\", \"banana\"] }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}`| `tags=apple&tags=banana&flag=smthng` |
| `{{ concat ([\"tags=\", concat({{ range _, x := $body.input }} \"{{x}},\" {{ end }})]) }}` | `tags=apple%2Cbanana%2C` |
### Steps to test and verify ✍
- start HGE and make the following request to `http://localhost:8080/v1/metadata`:
```json
{
"type": "test_webhook_transform",
"args": {
"webhook_url": "http://localhost:3000",
"body": {
"action": {
"name": "actionName"
},
"input": ["apple", "banana"]
},
"request_transform": {
"version": 2,
"url": "{{$base_url}}",
"query_params": "{{ concat ([concat({{ range _, x := $body.input }} \"tags={{x}}&\" {{ end }}), \"flag=smthng\"]) }}",
"template_engine": "Kriti"
}
}
}
```
- you should receive the following as output:
```json
{
"body": {
"action": {
"name": "actionName"
},
"input": [
"apple",
"banana"
]
},
"headers": [],
"method": "GET",
"webhook_url": "http://localhost:3000?tags=apple&tags=banana&flag=smthng"
}
```
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/6961
Co-authored-by: Tirumarai Selvan <8663570+tirumaraiselvan@users.noreply.github.com>
GitOrigin-RevId: 712ba038f03009edc3e8eb0435e723304943399a
2022-11-29 23:26:04 +03:00
|
|
|
Test.Webhook.WebhookTransformSpec
|
2022-11-25 18:39:12 +03:00
|
|
|
|
2022-11-18 04:33:00 +03:00
|
|
|
executable api-tests
|
2023-01-30 14:23:08 +03:00
|
|
|
import: common-all
|
2022-11-18 04:33:00 +03:00
|
|
|
build-depends:
|
2022-12-07 01:33:54 +03:00
|
|
|
, lens-aeson
|
2022-11-18 04:33:00 +03:00
|
|
|
, api-tests
|
|
|
|
, base
|
|
|
|
, hspec
|
|
|
|
|
|
|
|
-- Turning off optimizations is intentional; tests aren't
|
|
|
|
-- performance sensitive and waiting for compilation is a problem.
|
|
|
|
ghc-options:
|
|
|
|
-threaded
|
|
|
|
-rtsopts "-with-rtsopts=-N"
|
|
|
|
|
2022-12-01 17:47:34 +03:00
|
|
|
default-language: GHC2021
|
2022-11-18 04:33:00 +03:00
|
|
|
hs-source-dirs: test-runner
|
|
|
|
main-is: Main.hs
|
2022-11-11 01:57:45 +03:00
|
|
|
|
2022-12-01 17:47:34 +03:00
|
|
|
library feature-matrix
|
2023-01-30 14:23:08 +03:00
|
|
|
import: common-all
|
2022-11-11 01:57:45 +03:00
|
|
|
build-depends:
|
|
|
|
, aeson
|
|
|
|
, attoparsec
|
2022-12-01 22:25:11 +03:00
|
|
|
, base
|
2022-11-11 01:57:45 +03:00
|
|
|
, bytestring
|
|
|
|
, containers
|
|
|
|
, lucid2
|
|
|
|
, mtl
|
2022-12-01 22:25:11 +03:00
|
|
|
, raw-strings-qq
|
2022-11-11 01:57:45 +03:00
|
|
|
, text
|
|
|
|
|
2022-12-01 17:47:34 +03:00
|
|
|
default-language: GHC2021
|
2022-11-11 01:57:45 +03:00
|
|
|
default-extensions:
|
|
|
|
BlockArguments
|
|
|
|
DataKinds
|
|
|
|
DeriveGeneric
|
|
|
|
DerivingStrategies
|
|
|
|
ImportQualifiedPost
|
2022-12-01 17:47:34 +03:00
|
|
|
LambdaCase
|
2022-11-11 01:57:45 +03:00
|
|
|
MultiWayIf
|
|
|
|
NamedFieldPuns
|
|
|
|
NoImplicitPrelude
|
|
|
|
OverloadedStrings
|
|
|
|
PatternGuards
|
2022-12-01 22:25:11 +03:00
|
|
|
QuasiQuotes
|
2022-11-11 01:57:45 +03:00
|
|
|
RecordWildCards
|
|
|
|
ScopedTypeVariables
|
|
|
|
TypeApplications
|
|
|
|
TypeFamilies
|
|
|
|
|
2022-12-01 17:47:34 +03:00
|
|
|
hs-source-dirs: src-feature-matrix
|
|
|
|
|
|
|
|
exposed-modules:
|
|
|
|
Hasura.FeatureMatrix
|
|
|
|
|
|
|
|
executable render-feature-matrix
|
2023-01-30 14:23:08 +03:00
|
|
|
import: common-all
|
2022-12-01 17:47:34 +03:00
|
|
|
build-depends:
|
|
|
|
, base
|
|
|
|
, feature-matrix
|
|
|
|
, bytestring
|
|
|
|
|
|
|
|
default-language: GHC2021
|
|
|
|
default-extensions:
|
|
|
|
BlockArguments
|
|
|
|
DataKinds
|
|
|
|
DeriveGeneric
|
|
|
|
DerivingStrategies
|
|
|
|
ImportQualifiedPost
|
|
|
|
LambdaCase
|
|
|
|
MultiWayIf
|
|
|
|
NamedFieldPuns
|
|
|
|
NoImplicitPrelude
|
|
|
|
OverloadedStrings
|
|
|
|
PatternGuards
|
|
|
|
RecordWildCards
|
|
|
|
ScopedTypeVariables
|
|
|
|
TypeApplications
|
|
|
|
TypeFamilies
|
|
|
|
|
|
|
|
hs-source-dirs: app-render-feature-matrix
|
|
|
|
|
|
|
|
-- Turning off optimizations is intentional; tests aren't
|
|
|
|
-- performance sensitive and waiting for compilation is a problem.
|
|
|
|
ghc-options:
|
|
|
|
-threaded
|
|
|
|
-rtsopts "-with-rtsopts=-N"
|
|
|
|
|
|
|
|
main-is: Main.hs
|
|
|
|
|
|
|
|
executable produce-feature-matrix
|
2023-01-30 14:23:08 +03:00
|
|
|
import: common-all
|
2022-12-01 17:47:34 +03:00
|
|
|
build-depends:
|
|
|
|
, api-tests
|
|
|
|
, base
|
|
|
|
, bytestring
|
|
|
|
, directory
|
|
|
|
, fast-logger
|
|
|
|
, feature-matrix
|
|
|
|
, filepath
|
|
|
|
, hasura-prelude
|
|
|
|
, hspec
|
|
|
|
, optparse-generic
|
|
|
|
, postgres-options
|
|
|
|
, stm
|
|
|
|
, test-harness
|
|
|
|
|
|
|
|
default-language: GHC2021
|
|
|
|
default-extensions:
|
|
|
|
BlockArguments
|
|
|
|
DataKinds
|
|
|
|
LambdaCase
|
|
|
|
NoImplicitPrelude
|
|
|
|
OverloadedStrings
|
|
|
|
ExplicitNamespaces
|
|
|
|
OverloadedRecordDot
|
|
|
|
|
|
|
|
hs-source-dirs: app-produce-feature-matrix
|
2022-11-11 01:57:45 +03:00
|
|
|
|
|
|
|
-- Turning off optimizations is intentional; tests aren't
|
|
|
|
-- performance sensitive and waiting for compilation is a problem.
|
|
|
|
ghc-options:
|
2022-12-01 17:47:34 +03:00
|
|
|
-O0
|
2022-11-11 01:57:45 +03:00
|
|
|
-threaded
|
2022-12-08 11:44:14 +03:00
|
|
|
-rtsopts "-with-rtsopts=-N4"
|
2022-11-11 01:57:45 +03:00
|
|
|
|
|
|
|
main-is: Main.hs
|