Skip to content

Releases: microsoft/cppgraphqlgen

Fix clientgen scalar variables and make Request thread-safe

22 Jan 06:46
e597db3
Compare
Choose a tag to compare

What's Changed

  • Don't add Variables:: scope to scalar and built-in types in clientgen by @wravery in #203
  • Make Request/Operations methods thread-safe by @wravery in #205
  • Bump patch version for bugfix release by @wravery in #206

Full Changelog: v3.7.0...v3.7.1

Merge graphqlintrospection lib back into graphqlservice, enable/fix more warnings, and make tests more reliable

07 Jan 21:45
cee3dd4
Compare
Choose a tag to compare

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

05 Jan 22:18
6a06c5a
Compare
Choose a tag to compare

What's Changed

Full Changelog: v4.0.0...v4.0.1

C++20, type erasure, and breaking changes which simplified the API

17 Dec 06:52
9914c36
Compare
Choose a tag to compare

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

Final v3.x release with compatible improvements from v4.0.0

17 Dec 06:47
9313634
Compare
Choose a tag to compare

What's Changed

Full Changelog: v3.6.0...v3.7.0

Version 4.0 Release Candidate

15 Dec 18:39
9ffd6f0
Compare
Choose a tag to compare
Pre-release

This contains all of the planned code changes for 4.0 discussed in #172. I tested with local changes to the https://github.com/microsoft/vcpkg port file and https:://github.com/microsoft/gqlmapi. I still need to update the documentation before I merge into main and make an official release. Until then, comparing the next branch of gqlmapi to main can give you a preview of some of the changes.

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

Full Changelog: v3.6.0...v4.0.0-rc

Generate strongly typed consumers with clientgen

28 May 21:11
9cbad08
Compare
Choose a tag to compare

After a lot of refactoring, I added a clientgen utility and graphqlclient support library to build strongly typed clients from static request documents, similar to the way that client frameworks like Apollo or Relay generate types for the variables and responses.

Since clientgen parses and validates the request at code generation time, in addition to the text of the request document returned by GetRequestText, it will also return a pre-parsed and pre-validated request AST (Abstract Syntax Tree) from GetRequestObject. There's a new benchmark program called client_benchmark in the samples directory, which replaces the parse/validate step with the pre-built request AST from GetRequestObject, and it replaces JSON serialization with parsing directly into the strongly typed response object. Your mileage may vary, on my fast Intel desktop running Windows, it had a little over 2x the single-threaded throughput of parsing and validating plus JSON serialization, and on a low-powered ARM64 Linux laptop it had just under 2x the throughput. Either way, the bulk of the savings came from not needing to parse and validate the queries in the loop, on the faster machine serializing to the strongly typed object was slightly faster and on the other serializing to JSON was slightly faster.

Rename library targets and update to PEGTL 3.2.0

16 Jan 21:18
d1781ff
Compare
Choose a tag to compare

The naming of graphqlservice_nointrospection vs. graphqlservice was confusing, although it did mean that CMake builds which linked against graphqlservice kept working without modification. It is still source compatible, but I decided to break backwards compatibility with CMake builds by renaming graphqlservice_nointrospection back to graphqlservice, and graphqlservice (which depends on that and just adds Introspection support) to graphqlintrospection.

If you use CMake and you want to include Introspection support, add cppgraphqlgen::graphqlintrospection to your target_link_libraries. You can also just replace cppgraphqlgen::graphqlservice with that, it exports a public link dependency on graphqlservice. If you do not use CMake in your own project, but you still built/installed cppgraphqlgen using CMake (including using a package manager like vcpkg), then you need to link against both target libraries.

If you do not want Introspection support, you can regenerate your schema implementation with schemagen --no-introspection, and instead of linking against graphqlintrospection, just link against graphqlservice.

PEGTL released 3.2.0 which includes the fix for the demangle namespace, so cppgraphqlgen no longer depends on a pre-release version of PEGTL or a preprocessor workaround to redeclare demangle in the expected namespace with 3.1.0.

Add version information and check compatibility with library version in headers

09 Jan 00:02
9ef4c8d
Compare
Choose a tag to compare
  • There's a new internal/Version.h generated header, and on Windows, there are generated res/*.rc files with VERSION_INFO meta-data for schemagen.exe and all of the DLLs.
  • schemagen has a new --version flag which reports the project version.
  • schemagen --introspection no longer overrides or changes the defaults for the target header or source directories, CMake copies them to the source tree if they change.
  • schemagen generates static_asserts in the generated files which will break the build if you try to build with a different major.minor version than what's in internal/Version.h. If you don't automatically regenerate with schemagen as part of your build, this should help keep manually generated files in synch with corresponding changes in the library which may depend on re-running the generator.
  • I added all of the files generated with CMake to the repo and tidied up the dependencies and logic which updates the sources after generation. Unless you suppress it with GRAPHQL_UPDATE_* options, CMake will automatically regenerate those files and copy any changes back to the source tree. This makes it easier to integrate a source drop with another build system without taking a hard dependency on CMake, although that requires porting the build logic to your own system.

Use less memory and make parsing/validation much faster

31 Dec 06:53
54baee1
Compare
Choose a tag to compare

There are many miscellaneous improvements, but the core set of changes are refactoring the way that query validation and introspection work together, and how state is propagated from an object or list to the sub-fields/elements. The GraphQL parser grammar and AST generation are much more efficient and almost entirely avoid memory copies or string comparisons, except in cases where the query actually requires decoding UTF-16 escaped character sequences. The graphql::response::Value type (similar to a JSON value) is much more compact and we defer building them until we're ready to return the final result of a query, so we spend much less time and memory propagating results from sub-fields back to the final result. To support scenarios where services might not want to expose Introspection in production, schemagen now takes a new --no-introspection flag which will suppress the top-level __schema and __type fields. Compared to v3.3.0, the memory usage of the benchmark utility which parses and executes a query 100 times uses roughly 34% as much heap memory at peak, and it runs roughly 38x faster (measured with valgrind tool=massif with GCC on Linux). Many thanks to @barbieri who suggested and/or implemented most of these improvements!

I think this version is source compatible with v3.3.0, except for the definition of service::field_path. If you have any code which propagated or directly manipulated the SelectionSetParams::errorPath parameter, you may get a build break. You should consider that an opaque type and let graphqlservice take care of translating that in the error handling. Take a look at the changes in TodayMock.cpp to see what I mean, I needed to remove some redundant special handling I had implemented there to propagate the paths.

Otherwise, public methods which have been replaced are annotated with [[deprecated]] and include a message letting you know what to move to. They should still work until you are able to update your code. as long as you treat calling deprecated methods as a warning rather than an error. Those methods will be removed in the next major version update, whenever that becomes necessary.

There was a breaking change in PEGTL since the 3.1.0 release which this version of cppgraphqlgen depends on, so for now you need to either recursively clone the repo and update the PEGTL sub-module at the same, or you need to make sure that you're using a commit greater than or equal to taocpp/PEGTL@0cc3128. If you are using vcpkg, you can install both pegtl and cppgraphqlgen with the --head parameter, otherwise you should stick to the previous release until both the pegtl port and the cppgraphqlgen port have been updated. I will probably do that shortly after PEGTL releases 3.1.1 including that commit.