hasura / hasura/graphql-engine

"From JSON" type generator fails to parse arrays.

Open
#9,987 0 comments 0 reactions 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: 2.35.0

### Environment
OSS

### What is the current behaviour?
UI displays "`Invalid JSON`" for any example request or response containing an array.

Also, an empty object "`{}`" reports similar, but an empty string does not.

### What is the expected behaviour?
Either reporting that arrays are not supported, or parsing correctly as `type[]`.

### How to reproduce the issue?

1. Actions > Create > Add a new action
2. Type Generators > From JSON
3. Type in "`[]`" as either `Sample Request (JSON)` or `Samples Response (JSON)`.

### Screenshots or Screencast
type-generator

Contributor guide

Open the contributing guide

Research direction

Start in the UI flow Actions > Create > Add a new action, then Type Generators > From JSON, and reproduce the issue with [] and {} in both sample fields. Trace the type generator entry point used by that form. Done means arrays are parsed as type[] or explicitly rejected with a clear message, while empty objects and strings retain defined behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.