Skip to content

Commit

Permalink
Added ability to export interfaces (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoverson committed Oct 29, 2022
1 parent 7d1bfdc commit a66676c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ func parseDocument(parser *Parser) (*ast.Document, error) {
allDefs := make(map[string]ast.Definition)
for _, def := range doc.Definitions {
switch v := def.(type) {
case *ast.InterfaceDefinition:
allDefs[v.Name.Value] = v
case *ast.TypeDefinition:
allDefs[v.Name.Value] = v
case *ast.EnumDefinition:
Expand All @@ -204,6 +206,16 @@ func parseDocument(parser *Parser) (*ast.Document, error) {
name = n.Name
}
switch v := def.(type) {
case *ast.InterfaceDefinition:
renamedType := ast.NewInterfaceDefinition(
name.Loc,
name,
v.Description,
v.Annotations,
v.Operations,
)
nodes = append(nodes, renamedType)

case *ast.TypeDefinition:
renamedType := ast.NewTypeDefinition(
name.Loc,
Expand Down

0 comments on commit a66676c

Please sign in to comment.