Releases: microsoft/cppgraphqlgen
NotifySubscribe/NotifyUnsubscribe and Update to PEGTL 3.0.0 Release
I bumped the minor version to 3.3.0 to reflect the new NotifySubscribe
/NotifyUnsubscribe
feature. The update to PEGTL
technically breaks backwards compatibility with older compilers/toolchains, so I could also bump it up to 4.0.0, but since it's still source compatible with prior versions I left it as is.
- Support for invoking the default
Subscription
object resolvers onsubscribe
/unsubscribe
.- If there's a default
Subscription
object passed to theOperations
constructor, and you call one of the overloads which takes astd::launch
policy, it will resolve the subscription query onsubscribe
withResolverContext::NotifySubscribe
, and onunsubscribe
withResolverContext::NotifyUnsubscribe
. - Using the older
subscribe
/unsubscribe
overrides, or leaving the defaultSubscription
argument empty, should behave the same as before, except there's now an additionalFieldParams::resolverContext
member which you may inspect at runtime. - You can still override the
Subscription
object when callingdeliver
to separate subscription state management from the delivery of events. If you passdeliver
anullptr
, it will still fallback to using the defaultSubscription
object.
- If there's a default
- Update the
PEGTL
submodule to the 3.0.0 release tag which just came out.- Remove the
boot-filesystem
fallback now thatPEGTL
depends onstd::filesystem
as well, which bumps the minimum compiler toolchain version up on Linux. - Clarify compatibility requirements in the README
- Remove the
- Other
- Miscellaneous bug fixes.
- Enable
clang-format
and use that to re-format almost everything.
Make fragment type conditions handle union membership
This is a bugfix release specifically for #112. Unions still work with inline fragment spreads on the option types, but without this fix it's much harder to encapsulate your union handling in standalone fragment definitions.
Bug fixes and CMake build and versioning improvements
You can now build cppgraphqlgen
using the add_subdirectory
command in CMake as an alternative to importing it with find_package
from an external installation.
The version number of the project was getting out of sync with the release tags in git, so now it keeps track of the project version number in a separate version.txt
file. Anytime there's a new release tag with a greater version number, the CMake configuration should bump the version it uses in version.txt
up to match. This should make it so clones of the git repo automatically stay up to date with released version numbers, and worst case if I forget to bump version.txt
before tagging a release, consumers building from a non-git source archive should be at most 1 version number behind since it will have been last updated when building the prior version.
Update to latest 3.0.0-pre commit from PEGTL
Aside from a couple of bug fixes, the biggest difference in this release is that it picked up and fixed a few breaking changes in PEGTL
since the last sub-module update. The 3.0.0 version of PEGTL
is in a pre-release state and may still introduce breaking changes.
I'm going to submit a PR to update both packages simultaneously in vcpkg. If you use another package manager which doesn't use the sub-module and you want to update cppgraphqlgen
to this release, please check whether there's a matching update for PEGTL
to go with it.
Fix VS 2017 compilation plus minor build tweaks
The biggest difference between this release and v3.2.0 is a fix for #97, which was a template compilation break in GraphQLService.h
specific to VS 2017. I use VS 2019 on Windows which compiled the previous version just fine, and so do gcc and clang on Linux and Mac.
I also updated the optional PEGTL sub-module to the latest master branch commit, and I re-added a GRAPHQL_BUILD_SCHEMAGEN
CMake option to suppress building schemagen
. I use that in some of my own build pipelines to build schemagen
for the host platform and cross-compile the libraries for other target platforms.
Use explicit DLL exports on Windows
This should be backwards compatible at the source/CMake level with previous 3.x versions, but the change is big enough that I decided to rev the minor version to 3.2.
Previously, if you used BUILD_SHARED_LIBS
on Windows (including building with vcpkg
by default), it was setting CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
and letting CMake
figure out all of the symbols in all of the DLLs and mark them as exported. That bloats the import libs which are used to consume them and increases the binary size considerably.
This release replaces that mechanism with explicit __declspec(dllimport/dllimport)
attributes defined conditionally through macros on Windows for the methods which are actually referenced across modules. There should be no duplication of symbols between DLLs, and part of that meant I needed to split graphqlresponse
into an independent library target/DLL in order to take a dependency on it from both graphqljson
and graphqlservice
.
I've tested this with static and shared libraries on Windows and Linux, as well as building with vcpkg
and verifying that schemagen
and the samples/tests still work.
Doc updates and assorted bug fixes
This is a minor update on top of v3.1.0. The only noticeable change at runtime should be that default arguments of scalar String type should be returned properly from Introspection queries.
This is necessary to get GraphiQL working again, now that we include @deprecated(reason: String = "No longer supported")
in the schema. It wanted to parse the string in defaultValue
as a GraphQL input type, and not having the quotes embedded in the response broke the parser.
Feature release: Query Validation
This is a comprehensive fix for #69. Per the spec, the service ought to validate every query before execution to make sure the results are not ambiguous.
There may still be runtime field errors that this doesn't catch, and since the last time I looked at that section of the spec there also seems to be a lot more guidance about how to format the errors. I added locations
to all of the errors I could, and a path
to the runtime field errors.
In the process of building the validation feature with TDD based on the Examples and Counter Examples in the spec, I found a few bugs in SchemaGenerator
as well and fixed those. The validation relies on Introspection and helped flush those out.
Validation can be performed separately with Request::validate
, or you can use the new Request::resolve
overloads which take a peg::ast& query
parameter instead of a const peg::ast_node& root
parameter, they will make sure the query is validated once before executing it. The old Request::resolve
overloads are still there for backwards compatibility, but they have been marked as [[deprecated]]
. They will go away the next time there's a major version release.
Fix a few bugs in schemagen and add documentation
Various bug fixes including a crash in schema_exception destructor
Most notably, this release should be better at bubbling up schema_exception
and preserving error messages from deeper in the query resolution process.
At least on Windows with VS 2019, the copy constructor hiding that I tried for the fix to #63 broke the contract for std::exception
and resulted in a crash when the schema_exception
was copied but didn't invoke the default copy of the _errors
member. That bug has been in there since v3.0.1.