Skip to content

uroslates/wundergraph-operations-autogeneration

Repository files navigation

WunderGraph Custom Operations Auto-Generation

This repository is created to showcase how we could extend/enhance Wundergraph to introduce a new feature of autogenerating introspected datasources operations (as graphql operations).

For more detailed information about this feature you could have a look at the respective issue (feature request issue) on Wundegraph's Gihtub Repo.

Getting started

npm i && npm start

Custom Operation Autogeneration

To generate custom operations (from specific wundergraph apiNamespace) you can run npm run autogenerate:wg:gql:operations.

This will result in generating custom wundegraph operations within .wundergraph/operations/{apiNamespace} folder that you can start using within your graphql or js/ts wundergraph operations for futher composition.

Auto-Generate graphql operations from OCC Spec

For autogenerating occ apiNamespace graphqul operations, run the following:

npm run autogenerate:wg:gql:operations -- occ

Test the operation by calling the generated operations REST endpoints:

You could now also consume custom auto-generated occ operations within the ts based operations (look at the .wundergraph/operations/users/get.ts).

Auto-Generate graphql operations from countries apiNamespace

For autogenerating countries apiNamespace graphqul operations, run the following:

npm run autogenerate:wg:gql:operations -- countries

Get all Continents

curl http://localhost:9991/operations/Continents

Get all Countries

curl http://localhost:9991/operations/Countries

Get user

curl http://localhost:9991/operations/users/get?id=1

Learn More

Read the Docs.

Deploy to WunderGraph Cloud

Deploy to WunderGraph

Need Help?

Got any questions or need any development related work feel free to contact me.

About

Draft implementation for Wundergraph's requested **Autogenerate Introspected Apis Operations [#855](https://github.com/wundergraph/wundergraph/issues/855)** Feature.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published