diff --git a/src/content/code/language-support/c-c/client/cppgraphqlgen-clientgen.md b/src/content/code/language-support/c-c/client/cppgraphqlgen-clientgen.md new file mode 100644 index 0000000000..1fa222f0ac --- /dev/null +++ b/src/content/code/language-support/c-c/client/cppgraphqlgen-clientgen.md @@ -0,0 +1,34 @@ +--- +name: cppgraphqlgen-clientgen +description: A C++20 GraphQL request client generator and response parser using the schema document. If you want to consume a GraphQL service from a C++ client, you can pre-compile queries and deserialization functions for the expected results. +url: https://github.com/microsoft/cppgraphqlgen +github: microsoft/cppgraphqlgen +--- + +The `clientgen` utility is based on `schemagen` and shares the same external dependencies. The command line arguments +are almost the same, except it takes an extra file for the request document and there is no equivalent to `--stubs`: +``` +Usage: clientgen [options] +Command line options: + --version Print the version number + -? [ --help ] Print the command line options + -v [ --verbose ] Verbose output including generated header names as + well as sources + -s [ --schema ] arg Schema definition file path + -r [ --request ] arg Request document file path + -o [ --operation ] arg Operation name if the request document contains more + than one + -p [ --prefix ] arg Prefix to use for the generated C++ filenames + -n [ --namespace ] arg C++ sub-namespace for the generated types + --source-dir arg Target path for the Client.cpp source file + --header-dir arg Target path for the Client.h header file + --no-introspection Do not expect support for Introspection +``` + +This utility should output one header and one source file for each request document. A request document may contain more +than one operation, in which case it will output definitions for all of them together. You may limit the output to a +single operation from the request document by specifying the `--operation` (or `-o`) argument with the operation name. + +The generated code depends on the `graphqlclient` library for serialization of built-in types. If you link the generated +code, you'll also need to link `graphqlclient`, `graphqlpeg` for the pre-parsed, pre-validated request AST, and +`graphqlresponse` for the `graphql::response::Value` implementation. \ No newline at end of file diff --git a/src/content/code/language-support/c-c/server/cppgraphqlgen-schemagen.md b/src/content/code/language-support/c-c/server/cppgraphqlgen-schemagen.md new file mode 100644 index 0000000000..338e60caf6 --- /dev/null +++ b/src/content/code/language-support/c-c/server/cppgraphqlgen-schemagen.md @@ -0,0 +1,25 @@ +--- +name: cppgraphqlgen-schemagen +description: A C++20 GraphQL service generator using the schema document. You can use this to implement a GraphQL service with resolvers backed by whatever C++ libraries you need. +url: https://github.com/microsoft/cppgraphqlgen +github: microsoft/cppgraphqlgen +--- + +Run `schemagen -?` to get a list of options. Many of the files in the [samples](https://github.com/microsoft/cppgraphqlgen/tree/main/samples) directory were generated +with `schemagen`, you can look at [samples/learn/schema/CMakeLists.txt](https://github.com/microsoft/cppgraphqlgen/blob/main/samples/learn/schema/CMakeLists.txt) for an example of how to call it with the canonical Star Wars sample [schema](https://github.com/microsoft/cppgraphqlgen/blob/main/samples/learn/schema/schema.learn.graphql): +``` +Usage: schemagen [options] +Command line options: + --version Print the version number + -? [ --help ] Print the command line options + -v [ --verbose ] Verbose output including generated header names as + well as sources + -s [ --schema ] arg Schema definition file path + -p [ --prefix ] arg Prefix to use for the generated C++ filenames + -n [ --namespace ] arg C++ sub-namespace for the generated types + --source-dir arg Target path for the Schema.cpp source file + --header-dir arg Target path for the Schema.h header file + --stubs Unimplemented fields throw runtime exceptions instead + of compiler errors + --no-introspection Do not generate support for Introspection +```