Skip to content

Commit

Permalink
Split cppgraphqlgen into separate client/server entries
Browse files Browse the repository at this point in the history
  • Loading branch information
wravery committed Jan 22, 2024
1 parent 5728757 commit d0b14d1
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: cppgraphqlgen-clientgen
description: A C++20 GraphQL client request generator and response parser using the schema document.
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] <schema file> <request file> <output filename prefix> <output namespace>
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 <prefix>Client.cpp source file
--header-dir arg Target path for the <prefix>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.
15 changes: 0 additions & 15 deletions src/content/code/language-support/c-c/cppgraphqlgen.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: cppgraphqlgen-schemagen
description: A C++20 GraphQL service generator using the schema document.
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/CMakeLists.txt](https://github.com/microsoft/cppgraphqlgen/blob/main/samples/CMakeLists.txt) for a few examples of how to call it:
```
Usage: schemagen [options] <schema file> <output filename prefix> <output namespace>
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 <prefix>Schema.cpp source file
--header-dir arg Target path for the <prefix>Schema.h header file
--stubs Unimplemented fields throw runtime exceptions instead
of compiler errors
--no-introspection Do not generate support for Introspection
```

0 comments on commit d0b14d1

Please sign in to comment.