hasura / hasura/graphql-engine

Inconsistency in event_triggers metadata and API format

Open
#9,155 1 comment 0 reactions 0 assignees View on GitHub
a/eventing/data-triggers k/bug t/gql-services
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: v2.13.0

### What is the current behaviour?

When I export my metadata from the Hasura console, the `event_triggers` metadata looks like this:

```json
{
...
"event_triggers": [
{
"name": "handleRegistration",
"definition": {
"enable_manual": true,
"insert": {
"columns": "*"
}
},
"retry_conf": {
"interval_sec": 10,
"num_retries": 0,
"timeout_sec": 60
},
"webhook_from_env": "HANDLE_REGISTRATION_ENDPOINT"
}
]
}
```

But when I am about to create an event trigger via the metadata API (https://hasura.io/docs/latest/api-reference/metadata-api/event-triggers/#metadata-pg-create-event-trigger) it needs a different shape. Here, according to the documentation, there's no `definition` field but all fields in definition are moved one level up at the same level as eg. retry_conf. Something like this:

```json
{
"name": "handleRegistration",
"enable_manual": true,
"insert": {
"columns": "*"
}
"retry_conf": {
"interval_sec": 10,
"num_retries": 0,
"timeout_sec": 60
},
"webhook_from_env": "HANDLE_REGISTRATION_ENDPOINT"
}
```

Is this a problem with the documentation, or really the metadata format and API call format is different? This makes creating libraries, which operate on the Hasura metadata cumbersome.

### What is the expected behaviour?

A well defined definition of Hasura metadata and metadata API types (JSON Schema or OpenAPI) with compatible data formats and a documentation generated from these well defined type definitions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.