|
| 1 | +diff --git a/language/printer.js b/language/printer.js |
| 2 | +index eed3b7cf24d74d744c860ad9cb8e546ed6f4afd7..4754051981ec40f41bce700b96dc569492cf4b41 100644 |
| 3 | +--- a/language/printer.js |
| 4 | ++++ b/language/printer.js |
| 5 | +@@ -148,7 +148,7 @@ const printDocASTReducer = { |
| 6 | + // Type System Definitions |
| 7 | + SchemaDefinition: { |
| 8 | + leave: ({ description, directives, operationTypes }) => |
| 9 | +- wrap('', description, '\n') + |
| 10 | ++ wrap('\n', description, '\n') + |
| 11 | + join(['schema', join(directives, ' '), block(operationTypes)], ' '), |
| 12 | + }, |
| 13 | + OperationTypeDefinition: { |
| 14 | +@@ -156,12 +156,12 @@ const printDocASTReducer = { |
| 15 | + }, |
| 16 | + ScalarTypeDefinition: { |
| 17 | + leave: ({ description, name, directives }) => |
| 18 | +- wrap('', description, '\n') + |
| 19 | ++ wrap('\n', description, '\n') + |
| 20 | + join(['scalar', name, join(directives, ' ')], ' '), |
| 21 | + }, |
| 22 | + ObjectTypeDefinition: { |
| 23 | + leave: ({ description, name, interfaces, directives, fields }) => |
| 24 | +- wrap('', description, '\n') + |
| 25 | ++ wrap('\n', description, '\n') + |
| 26 | + join( |
| 27 | + [ |
| 28 | + 'type', |
| 29 | +@@ -175,7 +175,7 @@ const printDocASTReducer = { |
| 30 | + }, |
| 31 | + FieldDefinition: { |
| 32 | + leave: ({ description, name, arguments: args, type, directives }) => |
| 33 | +- wrap('', description, '\n') + |
| 34 | ++ wrap('\n', description, '\n') + |
| 35 | + name + |
| 36 | + (hasMultilineItems(args) |
| 37 | + ? wrap('(\n', indent(join(args, '\n')), '\n)') |
| 38 | +@@ -186,7 +186,7 @@ const printDocASTReducer = { |
| 39 | + }, |
| 40 | + InputValueDefinition: { |
| 41 | + leave: ({ description, name, type, defaultValue, directives }) => |
| 42 | +- wrap('', description, '\n') + |
| 43 | ++ wrap('\n', description, '\n') + |
| 44 | + join( |
| 45 | + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], |
| 46 | + ' ', |
| 47 | +@@ -194,7 +194,7 @@ const printDocASTReducer = { |
| 48 | + }, |
| 49 | + InterfaceTypeDefinition: { |
| 50 | + leave: ({ description, name, interfaces, directives, fields }) => |
| 51 | +- wrap('', description, '\n') + |
| 52 | ++ wrap('\n', description, '\n') + |
| 53 | + join( |
| 54 | + [ |
| 55 | + 'interface', |
| 56 | +@@ -208,7 +208,7 @@ const printDocASTReducer = { |
| 57 | + }, |
| 58 | + UnionTypeDefinition: { |
| 59 | + leave: ({ description, name, directives, types }) => |
| 60 | +- wrap('', description, '\n') + |
| 61 | ++ wrap('\n', description, '\n') + |
| 62 | + join( |
| 63 | + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], |
| 64 | + ' ', |
| 65 | +@@ -216,21 +216,21 @@ const printDocASTReducer = { |
| 66 | + }, |
| 67 | + EnumTypeDefinition: { |
| 68 | + leave: ({ description, name, directives, values }) => |
| 69 | +- wrap('', description, '\n') + |
| 70 | ++ wrap('\n', description, '\n') + |
| 71 | + join(['enum', name, join(directives, ' '), block(values)], ' '), |
| 72 | + }, |
| 73 | + EnumValueDefinition: { |
| 74 | + leave: ({ description, name, directives }) => |
| 75 | +- wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), |
| 76 | ++ wrap('\n', description, '\n') + join([name, join(directives, ' ')], ' '), |
| 77 | + }, |
| 78 | + InputObjectTypeDefinition: { |
| 79 | + leave: ({ description, name, directives, fields }) => |
| 80 | +- wrap('', description, '\n') + |
| 81 | ++ wrap('\n', description, '\n') + |
| 82 | + join(['input', name, join(directives, ' '), block(fields)], ' '), |
| 83 | + }, |
| 84 | + DirectiveDefinition: { |
| 85 | + leave: ({ description, name, arguments: args, repeatable, locations }) => |
| 86 | +- wrap('', description, '\n') + |
| 87 | ++ wrap('\n', description, '\n') + |
| 88 | + 'directive @' + |
| 89 | + name + |
| 90 | + (hasMultilineItems(args) |
| 91 | +diff --git a/language/printer.mjs b/language/printer.mjs |
| 92 | +index cffc2bf05b7440abe0f6cb92163092666127f182..3cfbdda9f3b0fc3076c287740e4dfa32577895c9 100644 |
| 93 | +--- a/language/printer.mjs |
| 94 | ++++ b/language/printer.mjs |
| 95 | +@@ -136,7 +136,7 @@ const printDocASTReducer = { |
| 96 | + // Type System Definitions |
| 97 | + SchemaDefinition: { |
| 98 | + leave: ({ description, directives, operationTypes }) => |
| 99 | +- wrap('', description, '\n') + |
| 100 | ++ wrap('\n', description, '\n') + |
| 101 | + join(['schema', join(directives, ' '), block(operationTypes)], ' '), |
| 102 | + }, |
| 103 | + OperationTypeDefinition: { |
| 104 | +@@ -144,12 +144,12 @@ const printDocASTReducer = { |
| 105 | + }, |
| 106 | + ScalarTypeDefinition: { |
| 107 | + leave: ({ description, name, directives }) => |
| 108 | +- wrap('', description, '\n') + |
| 109 | ++ wrap('\n', description, '\n') + |
| 110 | + join(['scalar', name, join(directives, ' ')], ' '), |
| 111 | + }, |
| 112 | + ObjectTypeDefinition: { |
| 113 | + leave: ({ description, name, interfaces, directives, fields }) => |
| 114 | +- wrap('', description, '\n') + |
| 115 | ++ wrap('\n', description, '\n') + |
| 116 | + join( |
| 117 | + [ |
| 118 | + 'type', |
| 119 | +@@ -163,7 +163,7 @@ const printDocASTReducer = { |
| 120 | + }, |
| 121 | + FieldDefinition: { |
| 122 | + leave: ({ description, name, arguments: args, type, directives }) => |
| 123 | +- wrap('', description, '\n') + |
| 124 | ++ wrap('\n', description, '\n') + |
| 125 | + name + |
| 126 | + (hasMultilineItems(args) |
| 127 | + ? wrap('(\n', indent(join(args, '\n')), '\n)') |
| 128 | +@@ -174,7 +174,7 @@ const printDocASTReducer = { |
| 129 | + }, |
| 130 | + InputValueDefinition: { |
| 131 | + leave: ({ description, name, type, defaultValue, directives }) => |
| 132 | +- wrap('', description, '\n') + |
| 133 | ++ wrap('\n', description, '\n') + |
| 134 | + join( |
| 135 | + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], |
| 136 | + ' ', |
| 137 | +@@ -182,7 +182,7 @@ const printDocASTReducer = { |
| 138 | + }, |
| 139 | + InterfaceTypeDefinition: { |
| 140 | + leave: ({ description, name, interfaces, directives, fields }) => |
| 141 | +- wrap('', description, '\n') + |
| 142 | ++ wrap('\n', description, '\n') + |
| 143 | + join( |
| 144 | + [ |
| 145 | + 'interface', |
| 146 | +@@ -196,7 +196,7 @@ const printDocASTReducer = { |
| 147 | + }, |
| 148 | + UnionTypeDefinition: { |
| 149 | + leave: ({ description, name, directives, types }) => |
| 150 | +- wrap('', description, '\n') + |
| 151 | ++ wrap('\n', description, '\n') + |
| 152 | + join( |
| 153 | + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], |
| 154 | + ' ', |
| 155 | +@@ -204,21 +204,21 @@ const printDocASTReducer = { |
| 156 | + }, |
| 157 | + EnumTypeDefinition: { |
| 158 | + leave: ({ description, name, directives, values }) => |
| 159 | +- wrap('', description, '\n') + |
| 160 | ++ wrap('\n', description, '\n') + |
| 161 | + join(['enum', name, join(directives, ' '), block(values)], ' '), |
| 162 | + }, |
| 163 | + EnumValueDefinition: { |
| 164 | + leave: ({ description, name, directives }) => |
| 165 | +- wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), |
| 166 | ++ wrap('\n', description, '\n') + join([name, join(directives, ' ')], ' '), |
| 167 | + }, |
| 168 | + InputObjectTypeDefinition: { |
| 169 | + leave: ({ description, name, directives, fields }) => |
| 170 | +- wrap('', description, '\n') + |
| 171 | ++ wrap('\n', description, '\n') + |
| 172 | + join(['input', name, join(directives, ' '), block(fields)], ' '), |
| 173 | + }, |
| 174 | + DirectiveDefinition: { |
| 175 | + leave: ({ description, name, arguments: args, repeatable, locations }) => |
| 176 | +- wrap('', description, '\n') + |
| 177 | ++ wrap('\n', description, '\n') + |
| 178 | + 'directive @' + |
| 179 | + name + |
| 180 | + (hasMultilineItems(args) |
0 commit comments