Welcome! StepZen is a unique and declarative way to build & run any-sized Graph in minutes.
Table of Contents
This repo contains .graphql (and in some case, config.yaml files) for various "self-contained" example code for doing operations in StepZen.
Install the StepZen command line interface.
To run these examples,
git clonethis repo- Change to the right working directory.
- run
stepzen start
For more on what transforms is and how it operates within the custom @rest directive, see our documentation.
These are available in /transforms:
/filtershows how the response of a REST API can be filtered/combineintostringshows how a new field in the return type can be created by concatenating some other fields (like address parts into one address)/jsonobjectToJsonarrayshows how an array of data (say coords) can be converted into an object,{"lat":, "lon",..}so that it can be fed into some other system that requires data to be expressed that way/jsonobjectToJsonarrayshows how an object (typically where each key is an id of a record) can be converted into an array (e.g.,{"1":{"name": "john"}, "2": "jane"}can be converted to[{"id":"1", "name": "john"}, {"id":"2", name: "jane"}]), so that it can then behave well for GraphQL processing.
View the StepZen documentation on the custom directive @sequence.
These are available in /sequence:
/argumentsshows how query arguments get passed down a sequence/forLoopsshows how sequence acts as a nested for loop/transformsInMaterializershows how connecting two subgraphs can invoke transformations in between. For example, thecityof a customer can be fed into aweatherthat takeslat,lonby calling some geocoding in the sequence/useOfJSONshows how, in long sequences, a new type does not have to created for every step--treat everything as JSON up to the last step, and your type system stays clean.
For more information on protecting your API, see our documentation.
In /protection, you will find several subdirectories. Each contains a .graphql file, and index.graphql file and a config.yaml settings (which enables you to get extremely granular (or coarse) with protecting who can call what query/mutation).
/makeAllPublicshows how you can easily make all queries public./makeSomePublicshows how you can make some public, and some private (which can still be accessed using youradminorservicekeys)
View the StepZen documentation on the custom directive @dbquery.
Where possible, we use httpbin.org as our REST endpoint, since it allows us to mimic lots of REST capabilities.
/restWithParametersshows how GraphQL query arguments are automatically added to the REST call--there is nothing for you to do!/restWithConfigYamlshows how REST query parameters can also be fetched fromconfig.yaml--this allows you to keep your SDL code separate from your secrets./postbodyshows how a POST body can be automatically filled with query arguments when theContent-Type:application/x-www-form-urlencoded. This is the easiest way to send postbodies down the REST API/morecomplexpostshows how a POST body can be filled with query arguments using{{.Get \"name-of-query-argument\"}}when theContent-Type:application/x-www-form-urlencoded.