Skip to content

Commit

Permalink
Merge pull request #35 from mununki/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mununki authored Aug 9, 2023
2 parents 10a8438 + c1ae596 commit edaea58
Show file tree
Hide file tree
Showing 20 changed files with 1,834 additions and 1,304 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# CHANGELOG

## v0.2.9

- New parser implementation https://github.com/mununki/gqlmerge/pull/35
- Fixed issue stripping descriptions and comments https://github.com/mununki/gqlmerge/pull/35
2 changes: 1 addition & 1 deletion command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (c *Command) Check() error {
NotEnoughArgs: "❌ Not enough arguments",
OutputFileNeeded: "❌ Output file argument is needed",
WrongOption: "❌ Wrong options",
Version: "v0.2.8",
Version: "v0.2.9",
}

help := flag.Bool("h", false, "show the help")
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/mununki/gqlmerge

go 1.12
go 1.20
133 changes: 133 additions & 0 deletions lib/graphql.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package lib

import (
"os"
)

type BaseFileInfo struct {
Filename string
Line int
Column int
}

type Schema struct {
Files []*os.File
SchemaDefinitions []*SchemaDefinition
Types []*Type
Scalars []*Scalar
Enums []*Enum
Interfaces []*Interface
Unions []*Union
Inputs []*Input
DirectiveDefinitions []*DirectiveDefinition
}

type SchemaDefinition struct {
BaseFileInfo
Query *string
Mutation *string
Subscription *string
Descriptions *[]string
}

type DirectiveDefinition struct {
BaseFileInfo
Name string
Args []*Arg
Repeatable bool
Locations []string
Descriptions *[]string
}

type DirectiveArg struct {
Name string
Value []string
IsList bool
Descriptions *[]string
}

type Directive struct {
Name string
DirectiveArgs []*DirectiveArg
Descriptions *[]string
}

type Type struct {
BaseFileInfo
Name string
Impl bool
ImplTypes []string
Fields []*Field
Directives []*Directive
Descriptions *[]string
}

type Arg struct {
Name string
Type string
TypeExt *string // in case of enum e.g. admin(role: Role = ADMIN): Admin!
Null bool
IsList bool
IsListNull bool
Directives []*Directive
Descriptions *[]string
}

type Field struct {
BaseFileInfo
Name string
Args []*Arg
Type string
Null bool
IsList bool
IsListNull bool
Directives []*Directive
Descriptions *[]string
Comments *[]string
}

type Scalar struct {
BaseFileInfo
Name string
Directives []*Directive
Descriptions *[]string
Comments *[]string
}

type EnumValue struct {
Name string
Directives []*Directive
Descriptions *[]string
Comments *[]string
}

type Enum struct {
BaseFileInfo
Name string
EnumValues []EnumValue
Directives []*Directive
Descriptions *[]string
}

type Interface struct {
BaseFileInfo
Name string
Fields []*Field
Directives []*Directive
Descriptions *[]string
}

type Union struct {
BaseFileInfo
Name string
Types []string
Directives []*Directive
Descriptions *[]string
}

type Input struct {
BaseFileInfo
Name string
Fields []*Field
Descriptions *[]string
}
Loading

0 comments on commit edaea58

Please sign in to comment.