Project

General

Profile

Actions

Feature #363

open

Printer for GraphQL Schema

Added by Eugen Wissner over 1 year ago. Updated 2 months ago.

Status:
New
Priority:
Normal
Category:
Encoder
Target version:
-
% Done:

0%

Actions #1

Updated by Eugen Wissner over 1 year ago

  • Category set to Encoder
Actions #2

Updated by Adrian Sieber 2 months ago

Wouldn't it be enough to add a

deriving (Show)

to all defined types? 🤔

Actions #3

Updated by Adrian Sieber 2 months ago

Yeah, seems to work. I added a few more Show instances and now I can run show schema

Actions #4

Updated by Eugen Wissner 2 months ago

It's not the same. Given I have a schema like this:

type Person implements NamedEntity & ValuedEntity {
  name: String
}

This schema can be parsed, but if I show it, I get:

TypeSystemDefinition (TypeDefinition (ObjectTypeDefinition (Description Nothing) "Person" implementsNamedEntity & ValuedEntity [] [FieldDefinition (Description Nothing) "name" (ArgumentsDefinition []) String []])) (Location {line = 1, column = 1}) :| []

But I actually want to have the original schema. It is useful for example for formatting of GraphQL documents.

Furthermore the current encoder supports two modes: minified printing and pretty-printing. And since the schemas can be pretty big, it may be reasonable to work with other data types than String, like Text Builder.

Actions

Also available in: Atom PDF