Releases: microsoft/cppgraphqlgen
Custom PEGTL parse tree without unwind support
Till the try/catch/rethrow handling is fixed in the PEGTL
version of parse_tree
, throwing an exception during parsing easily overflows the stack on Windows with MSVC. This change brings a simplified version of the PEGTL
parse_tree
into cppgraphqlgen
without support for the unwind
feature (which cppgraphqlgen
doesn't use), so it no longer needs to handle the exceptions at each level of the tree. It just lets them be caught directly in the caller after destroying all of the objects on the stack.
The short version is that this should fix #222 using the default depth limit of 25 (or even up to ~100) rather than needing to set it to something less than 10. If/when PEGTL
is updated to remove the try/catch/rethrow implementation, cppgraphqlgen
can revert to using the original version of parse_tree
in PEGTL
.
This version also updates the PEGTL
sub-module and find_package
call in CMake
to use 3.2.6, which has some fixes for recent versions of both MSVC and GCC. If you have a CI build which uses cppgraphqlgen
and PEGTL
(e.g. from vcpkg
), you may have noticed that it broke recently when Visual Studio was updated. This should fix that, too.
What's Changed
Full Changelog: v4.4.0...v4.4.1
Simplify generated code for input types in schemagen and clientgen
This is a minor version update because the code does need to be regenerated with schemagen
/clientgen
to maintain compatibility with the GraphQLService.h
/GraphQLClient.h
shared headers.
There's also a fix for a command line parsing bug in clientgen
(#248) and several small documentation fixes to match changes in behavior or improve clarity.
What's Changed
- Fix #248 by @wravery in #250
- Use concepts and type traits instead of specializing service::isInputType() for each input type by @wravery in #249
- Clarify clientgen usage in latest version by @wravery in #251
Full Changelog: v4.3.1...v4.4.0
Mitigate breaking changes since v4.2.0
What's Changed
- Add
response::IdType
accessors for backwards compatibility by @wravery in #245 - Generate input type copy constructors by @wravery in #247
Full Changelog: v4.3.0...v4.3.1
Implement several feature requests and cleanup code
Possible Breaking Changes
Most users should not notice the difference, but there are a few things that might require changes to your code or build settings:
- Almost every struct and method/function that returns anything is now decorated with
[[nodiscard]]
, so you may get compiler warnings where you did not before. If you treat warnings as errors, this could also break your build. - The
[[nodiscard]]
annotations led me to notice that I was not checking the result of theResolverContext::NotifySubscribe
/ResolverContext::NotifyUnsubscribe
resolvers insubscribe
/unsubscribe
. I decided in 63ef2ce thatsubscribe
/unsubscribe
ought to propagate the errors by throwing an exception. If you have a default subscription object and it does not handle every field gracefully in theResolverContext::NotifySubscribe
/ResolverContext::NotifyUnsubscribe
case (for instance you are using the NYI generated stubs which throw exceptions), you may need to work around that. The changes in #240 allow a couple of ways to do that:- If you do not handle the
ResolverContext::NotifySubscribe
/ResolverContext::NotifyUnsubscribe
resolver calls, you can leave the default subscription object onOperations
empty and it will skip that call. You need to override the default (empty) subscription object in each call todeliver
if you were not already doing that, since the default subscription object is also used bydeliver
in the absence of an override. - You can override the subscription object used for
ResolverContext::NotifySubscribe
/ResolverContext::NotifyUnsubscribe
now insubscribe
/unsubscribe
, as an additional member inRequestSubscribeParams
/RequestUnsubscribeParams
.
- If you do not handle the
- PR #241 added support for generating multiple operation objects in a single request document from
clientgen
. Part of that involved moving theenum
andinput
type declarations to a shared namespace (already specified with the--namespace
parameter). They are re-exposed withusing
statements in the per-operation namespace, but since theinput
types used to be declared inline as part of theVariables
struct, you may need to remove theVariables::
scope from code which references them. You can now reference them from either the--namespace
shared namespace or the per-operation namespace which still contains theVariables
struct.
What's Changed
- Add a migration guide from v3.x to v4.x by @wravery in #236
- Add constexpr support to internal::sorted_map and internal::sorted_set by @wravery in #237
- Make the default subscription object optional and allow an override for subscribe/unsubscribe by @wravery in #240
- Output all operations from
clientgen
if the--operation
flag is not specified by @wravery in #241 - Code cleanup by @wravery in #242
- Update docs for next release by @wravery in #243
Full Changelog: v4.2.0...v4.3.0
Fixing various issues reported in v4.1.1
I had to make a few changes that may be incompatible with existing consumers, but they are small enough that I think this can be considered a minor version update rather than a full major version. The changes which are most likely to affect existing code are the updates to response::IdType
(see changes to how the fake ID's are initialized in TodayMock.cpp
), and how nullable nested input types are represented as std::unique_ptr
instead of std::optional
to support cycles of nullable/list input types (see changes in ClientTests.cpp
where it initializes the Variables::CompleteTaskInput
variable).
What's Changed
- Fixes for #208 and #209 by @wravery in #214
- Make CMake old-file cleanup safer/more specific by @wravery in #215
- Update PEGTL submodule to 3.2.5 by @wravery in #219
- Add a unit test for invalid string escape sequences by @wravery in #223
- Adds a virtual default destructor for RequestState by @ALTinners in #228
- Add a configurable depth limit to the parser by @wravery in #231
- Accept either a Base64 encoded binary or an opaque string in response::IdType by @wravery in #232
- Options to remove base64 ID encoding at compile time by @ALTinners in #229
- More constexpr schema by @wravery in #234
- More constexpr schema by @ALTinners in #227
- Input type references by @wravery in #235
New Contributors
- @ALTinners made their first contribution in #228
Full Changelog: v4.1.1...v4.2.0
Bug fixes and custom awaitable improvements
Fix clientgen scalar variables and make Request thread-safe
Merge graphqlintrospection lib back into graphqlservice, enable/fix more warnings, and make tests more reliable
What's Changed
- Enable strict compiler warnings and fix resulting warnings/errors by @wravery in #194
- Reset the mock service state for each test by @wravery in #195
- Merge graphintrospection lib back into graphqlservice by @wravery in #197
- Consolidate TodayMock services and protect async loaders with mutex by @wravery in #198
Full Changelog: v4.0.1...v4.1.0
schemagen bug fixes and cleanup
C++20, type erasure, and breaking changes which simplified the API
What's Changed
- Add default fallthrough cases by @wravery in #166
- Add a learn_star_wars sample based on https://graphql.org/learn/ by @wravery in #168
- Merge work in progress from personal fork to start working on 4.0 by @wravery in #173
- More progress on 4.0 tasks by @wravery in #174
- More progress on 4.0 tasks by @wravery in #175
- Include fewer/smaller headers to speed up build by @wravery in #176
- Remove the schemagen --merge-files option and make everything use separate files by @wravery in #177
- Update to October 2021 release of the GraphQL spec by @wravery in #179
- Implement delivery by SubscriptionKey and a type-erased JSON writer interface by @wravery in #180
- Allow field getters to return a std::shared_ptr by @wravery in #181
- Distinguish AwaitableScalar from AwaitableObject by @wravery in #183
- Only install new CMake files for install configs by @wravery in #184
- Minor fixes from testing with the vcpkg port and gqlmapi by @wravery in #185
- Documentation pass and a little bit of code cleanup by @wravery in #186
- Fix some code analysis issues detected by VS 2022 by @wravery in #187
- Bring v4.0.0 to the main branch by @wravery in #188
- Re-use the same Library.rc.in and Generator.rc.in files across targets by @wravery in #189
Full Changelog: v3.6.0...v4.0.0