Skip to content

Commit a66676c

Browse files
authored
Added ability to export interfaces (#4)
1 parent 7d1bfdc commit a66676c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

parser/parser.go

+12
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ func parseDocument(parser *Parser) (*ast.Document, error) {
180180
allDefs := make(map[string]ast.Definition)
181181
for _, def := range doc.Definitions {
182182
switch v := def.(type) {
183+
case *ast.InterfaceDefinition:
184+
allDefs[v.Name.Value] = v
183185
case *ast.TypeDefinition:
184186
allDefs[v.Name.Value] = v
185187
case *ast.EnumDefinition:
@@ -204,6 +206,16 @@ func parseDocument(parser *Parser) (*ast.Document, error) {
204206
name = n.Name
205207
}
206208
switch v := def.(type) {
209+
case *ast.InterfaceDefinition:
210+
renamedType := ast.NewInterfaceDefinition(
211+
name.Loc,
212+
name,
213+
v.Description,
214+
v.Annotations,
215+
v.Operations,
216+
)
217+
nodes = append(nodes, renamedType)
218+
207219
case *ast.TypeDefinition:
208220
renamedType := ast.NewTypeDefinition(
209221
name.Loc,

0 commit comments

Comments
 (0)