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

added gen-graphql-schema command #63

Merged
merged 1 commit into from
Dec 7, 2023
Merged

Conversation

yaswanth-godspeed
Copy link
Contributor

@yaswanth-godspeed yaswanth-godspeed commented Dec 6, 2023

Problem Description

What we need

  • We need GraphQL integration in godspeed with Auto generation and Auto generation of resolvers with events and workflows.
  • For this Auto generation of Graphql schema i added new command in cli.
  • gen-graphql-schema helps to scan all graphql events, create graphql schema from event schema and create resolvers also.

Steps to use graphql plugin in project :

  • Use godspeed plugin add and select graphql-as-eventsource to install graphql plugin.
  • write events with corresponding workflows of graphql eventsource.
  • Use gen-graphql-schema to auto generate graphql schema.
  • once plugin added to your project, plugin auto detects graphql schema generated by gen-graphql-schema command.
  • use godspeed dev to start dev server. you can see Apollo sandbox UI in localhost:4000 by default. From there you can do queries or mutations.

How we will approach

  • go through graphql documentation and Apollo documentation.
  • setup basic graphql plugin with events and workflows.
  • add event schema and framework automatically adds validation.
  • generate swagger schema from graphql events
  • convert swagger.json to graphql schema
  • Add new command gen-graphql-schema in cli to automate above 2 steps.
  • write readme file with detailed instructions and examples.

What i tested:

  • i tested gen-grapql-schema command manually. It perfectly generating schema of all graphql event sources.

For example we have 2 graphql event sources apollo1, apollo2.

Step 1: It asks select your graphql events and provide list of event sources we have in src/eventsource folder. Assume he selected apollo1, apollo2.

step 2: This command filters all events of this event sources separately and generates 2 swagger schema files in .temp folder.

step 3: converts swagger schema to apollo1.graphql and apollo2.graphql in .src/eventsources folder.

When he start server, plugin directly searches in
src/eventsource folder for schema files and starts graphql server.

While i am testing this code perfectly implemented above steps.

graphql plugin PR https://github.com/godspeedsystems/gs-plugins/pull/76

Issue linkhttps://github.com/godspeedsystems/gs-plugins/issues/70

@yaswanth-godspeed yaswanth-godspeed requested review from kushal-godspeed, mastersilv3r and a user and removed request for kushal-godspeed and mastersilv3r December 6, 2023 02:29
@yaswanth-godspeed yaswanth-godspeed merged commit ebe5e3f into main Dec 7, 2023
0 of 3 checks passed
@yaswanth-godspeed yaswanth-godspeed deleted the gen-graphql-schema branch December 10, 2023 12:52
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.

1 participant