Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix property name as type #45

Merged
merged 6 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/check-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version}}

- name: Run make build
run: |
make build

- name: Run make test
run: |
make test

- name: Run make check-diff
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## v0.2.11

- Fixed mis-used rune `[` instead of tokLBracket https://github.com/mununki/gqlmerge/pull/41
- Fixed merge error when the property name as `type` https://github.com/mununki/gqlmerge/pull/45

## v0.2.10

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ all: build test check-diff
build:
go build

test: build
test:
@for dir in $(shell find test -type d -name schema); do \
basedir=`dirname $$dir`; \
output="$$basedir/generated.graphql"; \
echo "Merging $$dir into $$output..."; \
./gqlmerge $$dir $$output; \
./gqlmerge $$dir $$output || exit 1; \
done

check-diff: build test
check-diff:
@if git diff --exit-code --quiet -- '*.graphql'; then \
echo "Ok"; \
else \
Expand Down
6 changes: 3 additions & 3 deletions lib/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (s *Schema) Parse(p *Parser) {
fd.Filename = p.lex.filename
fd.Line = p.lex.line
fd.Column = p.lex.col
name, comments := p.lex.consumeIdent()
name, comments := p.lex.consumeIdent(tokInput, tokType)
fd.Name = name.String()
fd.Descriptions = comments

Expand Down Expand Up @@ -291,7 +291,7 @@ func (s *Schema) Parse(p *Parser) {
fd.Filename = p.lex.filename
fd.Line = p.lex.line
fd.Column = p.lex.col
name, comments := p.lex.consumeIdent()
name, comments := p.lex.consumeIdent(tokInput, tokType)
fd.Name = name.String()
fd.Descriptions = comments
p.lex.consumeToken(tokColon)
Expand Down Expand Up @@ -372,7 +372,7 @@ func (s *Schema) Parse(p *Parser) {
fd.Filename = p.lex.filename
fd.Line = p.lex.line
fd.Column = p.lex.col
name, comments := p.lex.consumeIdent()
name, comments := p.lex.consumeIdent(tokInput, tokType)
fd.Name = name.String()
fd.Descriptions = comments

Expand Down
22 changes: 22 additions & 0 deletions test/property_type/generated.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
schema {
query: Query
mutation: Mutation
subscription: Subscription
}

type SomePayload {
type: String!
someKey: String!
}



interface I {
type: String!
input: String!
}

input I {
type: String!
input: String!
}
4 changes: 4 additions & 0 deletions test/property_type/schema/Input.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
input I {
type: String!
input: String!
}
4 changes: 4 additions & 0 deletions test/property_type/schema/Interface.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface I {
type: String!
input: String!
}