Skip to content

JSON codegen output: Please output types as nested JSON instead of a stringified type #1814

@designatednerd

Description

@designatednerd

In JSON for schemas, we presently output whether something is an optional or not in the following format:

"type": {
  "kind": "LIST",
  "name": null,
  "ofType": {
    "kind": "NON_NULL",
    "name": null,
    "ofType": {
      "kind": "LIST",
      "name": null,
      "ofType": {
        "kind": "NON_NULL",
        "name": null,
        "ofType": {
          "kind": "SCALAR",
          "name": "Float",
          "ofType": null
        }
      }
    }
  }
}

This is verbose as hell, so in the output of JSON from codegen:generate, we instead get the stringified TypeScript type:

"type": "[[Float!]!]",

The problem is that this is not super-helpful for working with Swift, where ! indicates a force-unwrap instead of non-null, no annotation represents non-null instead of nullable, and ? indicates nullable.

Can we please update the output of the AST in JSON to use the hideous nested JSON instead of the stringified type so that I can more easily parse this into something that will work with Swift? Thank you!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions