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

Less restrictive Query/Mutation/Subscription regex #61

Merged
merged 3 commits into from
Aug 22, 2022

Conversation

damau
Copy link
Contributor

@damau damau commented Aug 19, 2022

Thanks so much for this library!!!👏 It's ace.

Bug Fix

Schema

My server side schema plugin generates a schema as follows:

schema {
  query: RootQueryType
  mutation: RootMutationType
}

Expected

yarn gqlg --schemaFilePath ./codegen/schema.graphql --destDirPath ./src/generated/schema --depthLimit 4
# produces
src/generated/schema/mutations
src/generated/schema/query

Actual - fixed in this PR

yarn gqlg --schemaFilePath ./codegen/schema.graphql --destDirPath ./src/generated/schema --depthLimit 4
# produces
src/generated/schema/undefined

General Info

I imagine the above problem is fairly common given that my schema above is auto-generated (Absinthe - Elixir)

Additionally the regex is parsing only what comes from this schema object i.e:

gqlSchema.getQueryType().name = RootQueryType
gqlSchema.getMutationType().name = RootMutationType

So it should be fairly stable. Unless the below is common:

schema {
  query: RootQueryMutationType
  mutation: RootMutationQueryType
}

Though I hope not. I can add a stricter Regex if required. Or something not using a Regex if you like.

@timqian timqian merged commit b5c891e into timqian:master Aug 22, 2022
@timqian
Copy link
Owner

timqian commented Aug 22, 2022

Thank you🎉 @damau

@damau
Copy link
Contributor Author

damau commented Aug 22, 2022

Thanks @timqian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants