-
Notifications
You must be signed in to change notification settings - Fork 48
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
The migration from 3.x to 4.x is challenging. I've been meaning to start a migration guide based on a couple of samples I've migrated. Here's a list of topics I think should be covered, essentially an outline for the doc (will update with more as they come up):
- C++17 to C++20:
- Describe the toolchain requirements with links to the code and samples.
- Describe how to use custom Awaitables with links to the unit tests.
- Describe how to implement field accessors as a coroutine.
- Removing inheritance and replacing with type-erased wrappers:
- Change the class declaration, potentially add
std::enable_shared_from_this<>
. - Make
override
orfinal
field accessors non-virtual. - Wrapping type-erased
type
objects withinterface
andunion
objects. - Decoupling an inheritance hierarchy from
service::Object
(Chance of 3.X.X style generator being added as option to 4.X.X? #210)
- Change the class declaration, potentially add
- Simplify the field accessor signatures:
- Return wrapped types directly (unless implementing a coroutine).
- Make methods
const
or non-const
as appropriate (can also get rid of a lot ofmutable
member variables this way). - Pass parameters by
const&
reference,&&
r-value reference, or value. - Drop unused
service::FieldParams
arguments.
- Using the new CMake functions:
-
⚠️ Potentially destructive, build the schema in a sub-directory and use source control (i.e. Git) before and after (CMake: update_graphql_..._files functions can delete files without warning if misused #212). - Migrating from the unified output to what would have been generated with
--separate-files
- Removing the
graphqlintrospection
target (graphqlservice target no longer works without graphqlintrospection #196)
-
- Links to migration commits in sample and external projects:
- gqlmapi
- electron-cppgraphql
- samples in this repo (e.g. replacing all of the "unified" schemas with
--separate-files
versions, convertingTodayMock.*
implementations, etc.)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request