-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store parsed Schema on ExecutableSchema rather than use global variable #2811
Store parsed Schema on ExecutableSchema rather than use global variable #2811
Conversation
} | ||
|
||
func (ec *executionContext) introspectType(name string) (*introspection.Type, error) { | ||
if ec.DisableIntrospection { | ||
return nil, errors.New("introspection disabled") | ||
} | ||
return introspection.WrapTypeFromDef(parsedSchema, parsedSchema.Types[name]), nil | ||
return introspection.WrapTypeFromDef(ec.Schema(), ec.Schema().Types[name]), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reckon line 277 and 284 have better coding style no matter we decide to make executableSchema configurable or not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoiding global variables is good, but ec.Schema().Types[name]
violates the Law of Demeter.
If any of ec
, ec.Schema()
, or ec.Schema().Types
are nil, this will have a fatal error (panic due to nil pointer dereference) at this line, and from alone it would be difficult to figure out which of these was nil.
A temporary local variable might be more verbose, but in the event of a nil pointer dereference, the line number would then tell you immediately which of those three cases was problematic.
feel free to have a look of my different implementations with vs without this PR |
Hey it looks like you need to regenerate:
|
Thank you! It is my first time working on codegen feature. I didn't know I need to regenerate. |
I can see that Link/lint(1.19) is failed. I am not sure how I could fix it though. |
Signed-off-by: Steve Coffman <steve@khanacademy.org>
Thanks for this PR! I reworded the PR title and description so that it was a little easier for others to see what changed and why. I also regenerated the I'm looking forward to your next PR! |
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [github.com/99designs/gqlgen](https://github.com/99designs/gqlgen) | require | patch | `v0.17.38` -> `v0.17.39` | --- ### Release Notes <details> <summary>99designs/gqlgen (github.com/99designs/gqlgen)</summary> ### [`v0.17.39`](https://github.com/99designs/gqlgen/releases/tag/v0.17.39) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.38...v0.17.39) #### What's Changed - Breaking API: Allow WebsocketInitFunc to add payload to Ack ([#​4](https://github.com/99designs/gqlgen/issues/4)) by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2791](https://github.com/99designs/gqlgen/pull/2791) - add close flag into wsConnection to avoid duplicate calls of CloseFunc by [@​vlad-tokarev](https://github.com/vlad-tokarev) in [https://github.com/99designs/gqlgen/pull/2803](https://github.com/99designs/gqlgen/pull/2803) - fix: CodeGen for omit_slice_element_pointers and GetMany Entity Resolvers by [@​parkerroan](https://github.com/parkerroan) in [https://github.com/99designs/gqlgen/pull/2802](https://github.com/99designs/gqlgen/pull/2802) - feat: update getting-started CreateTodo mutationResolver by [@​gitxiongpan](https://github.com/gitxiongpan) in [https://github.com/99designs/gqlgen/pull/2810](https://github.com/99designs/gqlgen/pull/2810) - Feature: Support Apollo Federation Auth Directives by [@​parkerroan](https://github.com/parkerroan) in [https://github.com/99designs/gqlgen/pull/2809](https://github.com/99designs/gqlgen/pull/2809) - Consider go type name when autobinding by [@​dany74q](https://github.com/dany74q) in [https://github.com/99designs/gqlgen/pull/2812](https://github.com/99designs/gqlgen/pull/2812) - Update generated files that change when building by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2813](https://github.com/99designs/gqlgen/pull/2813) - Add a pong only keep alive for the new protocol by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2814](https://github.com/99designs/gqlgen/pull/2814) - Store parsed Schema on ExecutableSchema rather than use global variable by [@​gitxiongpan](https://github.com/gitxiongpan) in [https://github.com/99designs/gqlgen/pull/2811](https://github.com/99designs/gqlgen/pull/2811) - Add ability to not fail when pong is not received. by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2815](https://github.com/99designs/gqlgen/pull/2815) - Adding duration scalar conforming to ISO8601 standard by [@​rwrz](https://github.com/rwrz) in [https://github.com/99designs/gqlgen/pull/2800](https://github.com/99designs/gqlgen/pull/2800) - Bump postcss from 8.4.24 to 8.4.31 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2819](https://github.com/99designs/gqlgen/pull/2819) - Add [@​interfaceObject](https://github.com/interfaceObject) and [@​composeDirective](https://github.com/composeDirective) at Federation 2 directive lists. by [@​wangmir](https://github.com/wangmir) in [https://github.com/99designs/gqlgen/pull/2821](https://github.com/99designs/gqlgen/pull/2821) #### New Contributors - [@​vlad-tokarev](https://github.com/vlad-tokarev) made their first contribution in [https://github.com/99designs/gqlgen/pull/2803](https://github.com/99designs/gqlgen/pull/2803) - [@​parkerroan](https://github.com/parkerroan) made their first contribution in [https://github.com/99designs/gqlgen/pull/2802](https://github.com/99designs/gqlgen/pull/2802) - [@​dany74q](https://github.com/dany74q) made their first contribution in [https://github.com/99designs/gqlgen/pull/2812](https://github.com/99designs/gqlgen/pull/2812) - [@​rwrz](https://github.com/rwrz) made their first contribution in [https://github.com/99designs/gqlgen/pull/2800](https://github.com/99designs/gqlgen/pull/2800) - [@​wangmir](https://github.com/wangmir) made their first contribution in [https://github.com/99designs/gqlgen/pull/2821](https://github.com/99designs/gqlgen/pull/2821) **Full Changelog**: 99designs/gqlgen@v0.17.38...v0.17.39 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/infratographer/metadata-api). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzcuMTkuMiIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [github.com/99designs/gqlgen](https://github.com/99designs/gqlgen) | `v0.17.38` -> `v0.17.45` | [![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2f99designs%2fgqlgen/v0.17.45?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/go/github.com%2f99designs%2fgqlgen/v0.17.45?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/go/github.com%2f99designs%2fgqlgen/v0.17.38/v0.17.45?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2f99designs%2fgqlgen/v0.17.38/v0.17.45?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>99designs/gqlgen (github.com/99designs/gqlgen)</summary> ### [`v0.17.45`](https://github.com/99designs/gqlgen/releases/tag/v0.17.45) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.44...v0.17.45) #### What's Changed - Bump github.com/matryer/moq from 0.3.3 to 0.3.4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2939](https://github.com/99designs/gqlgen/pull/2939) - Bump [@​apollo/client](https://github.com/apollo/client) from 3.9.4 to 3.9.5 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2938](https://github.com/99designs/gqlgen/pull/2938) - Bump vitest from 1.2.2 to 1.3.0 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2937](https://github.com/99designs/gqlgen/pull/2937) - Bump graphql-ws from 5.14.3 to 5.15.0 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2935](https://github.com/99designs/gqlgen/pull/2935) - Bump vite from 5.1.1 to 5.1.3 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2936](https://github.com/99designs/gqlgen/pull/2936) - Bump golang.org/x/tools from 0.17.0 to 0.18.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2940](https://github.com/99designs/gqlgen/pull/2940) - Optionally render entity requires populator function for advanced [@​requires](https://github.com/requires) use cases by [@​jesse-apollo](https://github.com/jesse-apollo) in [https://github.com/99designs/gqlgen/pull/2884](https://github.com/99designs/gqlgen/pull/2884) - Bump vite from 5.1.3 to 5.1.4 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2947](https://github.com/99designs/gqlgen/pull/2947) - Bump [@​graphql-codegen/introspection](https://github.com/graphql-codegen/introspection) from 4.0.2 to 4.0.3 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2944](https://github.com/99designs/gqlgen/pull/2944) - Bump [@​graphql-codegen/client-preset](https://github.com/graphql-codegen/client-preset) from 4.2.2 to 4.2.4 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2945](https://github.com/99designs/gqlgen/pull/2945) - Bump github.com/PuerkitoBio/goquery from 1.8.1 to 1.9.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2943](https://github.com/99designs/gqlgen/pull/2943) - Bump vitest from 1.3.0 to 1.3.1 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2946](https://github.com/99designs/gqlgen/pull/2946) - Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 in /\_examples by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2955](https://github.com/99designs/gqlgen/pull/2955) - Bump github.com/PuerkitoBio/goquery from 1.9.0 to 1.9.1 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2954](https://github.com/99designs/gqlgen/pull/2954) - Bump github.com/stretchr/testify from 1.8.4 to 1.9.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2953](https://github.com/99designs/gqlgen/pull/2953) - Add option to omit resolver fields from models by [@​Desuuuu](https://github.com/Desuuuu) in [https://github.com/99designs/gqlgen/pull/2957](https://github.com/99designs/gqlgen/pull/2957) - fix(docs): convert an unnecessarily capitalized word to lowercase by [@​hxrxchang](https://github.com/hxrxchang) in [https://github.com/99designs/gqlgen/pull/2959](https://github.com/99designs/gqlgen/pull/2959) - Update explicit_requires to support models generated into same package by [@​ericbock](https://github.com/ericbock) in [https://github.com/99designs/gqlgen/pull/2965](https://github.com/99designs/gqlgen/pull/2965) - Add case for resolvers_always_return_pointers:false in explicit requires generation. by [@​jesse-apollo](https://github.com/jesse-apollo) in [https://github.com/99designs/gqlgen/pull/2966](https://github.com/99designs/gqlgen/pull/2966) - Bump google.golang.org/protobuf from 1.32.0 to 1.33.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2964](https://github.com/99designs/gqlgen/pull/2964) - Bump [@​apollo/client](https://github.com/apollo/client) from 3.9.5 to 3.9.6 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2962](https://github.com/99designs/gqlgen/pull/2962) - Bump vite from 5.1.4 to 5.1.5 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2961](https://github.com/99designs/gqlgen/pull/2961) - Bump typescript from 5.3.3 to 5.4.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2960](https://github.com/99designs/gqlgen/pull/2960) - Bump golang.org/x/tools from 0.18.0 to 0.19.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2963](https://github.com/99designs/gqlgen/pull/2963) #### New Contributors - [@​jesse-apollo](https://github.com/jesse-apollo) made their first contribution in [https://github.com/99designs/gqlgen/pull/2884](https://github.com/99designs/gqlgen/pull/2884) - [@​hxrxchang](https://github.com/hxrxchang) made their first contribution in [https://github.com/99designs/gqlgen/pull/2959](https://github.com/99designs/gqlgen/pull/2959) - [@​ericbock](https://github.com/ericbock) made their first contribution in [https://github.com/99designs/gqlgen/pull/2965](https://github.com/99designs/gqlgen/pull/2965) **Full Changelog**: 99designs/gqlgen@v0.17.44...v0.17.45 ### [`v0.17.44`](https://github.com/99designs/gqlgen/releases/tag/v0.17.44) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.43...v0.17.44) #### What's Changed - Bump vite from 4.3.9 to 4.5.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2885](https://github.com/99designs/gqlgen/pull/2885) - Update federation plugin by [@​trevor-scheer](https://github.com/trevor-scheer) in [https://github.com/99designs/gqlgen/pull/2876](https://github.com/99designs/gqlgen/pull/2876) - Work with https://specs.apollo.dev/federation/v2.x by [@​StevenACoffman](https://github.com/StevenACoffman) in [https://github.com/99designs/gqlgen/pull/2891](https://github.com/99designs/gqlgen/pull/2891) - Update x/tools and add go v1.21,v1.22 in CI workflows by [@​ryicoh](https://github.com/ryicoh) in [https://github.com/99designs/gqlgen/pull/2894](https://github.com/99designs/gqlgen/pull/2894) - Bump actions/setup-go from 3 to 5 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2900](https://github.com/99designs/gqlgen/pull/2900) - Bump actions/checkout from 3 to 4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2903](https://github.com/99designs/gqlgen/pull/2903) - Bump actions/setup-node from 3 to 4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2910](https://github.com/99designs/gqlgen/pull/2910) - Bump nick-fields/retry from 2 to 3 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2907](https://github.com/99designs/gqlgen/pull/2907) - Bump golangci/golangci-lint-action from 3.5.0 to 3.7.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2896](https://github.com/99designs/gqlgen/pull/2896) - Bump github.com/stretchr/testify from 1.8.2 to 1.8.4 in /\_examples by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2897](https://github.com/99designs/gqlgen/pull/2897) - Bump github.com/gorilla/websocket from 1.5.0 to 1.5.1 in /\_examples by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2901](https://github.com/99designs/gqlgen/pull/2901) - Bump github.com/matryer/moq from 0.2.7 to 0.3.3 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2902](https://github.com/99designs/gqlgen/pull/2902) - Bump vitest from 0.32.0 to 1.2.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2919](https://github.com/99designs/gqlgen/pull/2919) - Bump styled-components from 5.3.11 to 6.1.8 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2905](https://github.com/99designs/gqlgen/pull/2905) - Bump graphql-sse from 2.1.4 to 2.5.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2913](https://github.com/99designs/gqlgen/pull/2913) - Bump typescript from 4.9.5 to 5.3.3 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2917](https://github.com/99designs/gqlgen/pull/2917) - Bump react-scripts from 2.1.8 to 5.0.1 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2914](https://github.com/99designs/gqlgen/pull/2914) - Bump github.com/urfave/cli/v2 from 2.25.5 to 2.27.1 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2912](https://github.com/99designs/gqlgen/pull/2912) - Bump subscriptions-transport-ws from 0.9.19 to 0.11.0 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2911](https://github.com/99designs/gqlgen/pull/2911) - Bump github.com/google/uuid from 1.3.0 to 1.6.0 in /\_examples by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2909](https://github.com/99designs/gqlgen/pull/2909) - Bump github.com/rs/cors from 1.9.0 to 1.10.1 in /\_examples by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2904](https://github.com/99designs/gqlgen/pull/2904) - Bump graphql from 14.7.0 to 16.8.1 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2899](https://github.com/99designs/gqlgen/pull/2899) - Bump jest from 25.5.4 to 29.7.0 in /\_examples/federation by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2920](https://github.com/99designs/gqlgen/pull/2920) - Bump typescript from 5.1.3 to 5.3.3 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2921](https://github.com/99designs/gqlgen/pull/2921) - Bump [@​graphql-codegen/schema-ast](https://github.com/graphql-codegen/schema-ast) from 4.0.0 to 4.0.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2918](https://github.com/99designs/gqlgen/pull/2918) - Bump github.com/mattn/go-isatty from 0.0.19 to 0.0.20 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2908](https://github.com/99designs/gqlgen/pull/2908) - Bump urql from 4.0.4 to 4.0.6 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2906](https://github.com/99designs/gqlgen/pull/2906) - Bump github.com/hashicorp/golang-lru/v2 from 2.0.3 to 2.0.7 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2915](https://github.com/99designs/gqlgen/pull/2915) - Bump node-fetch from 2.7.0 to 3.3.2 in /\_examples/federation by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2916](https://github.com/99designs/gqlgen/pull/2916) - graphql/uint: Fix unmarshalling of negative numbers by [@​mnPanic](https://github.com/mnPanic) in [https://github.com/99designs/gqlgen/pull/2922](https://github.com/99designs/gqlgen/pull/2922) - Bump golangci/golangci-lint-action from 3.7.0 to 4.0.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2928](https://github.com/99designs/gqlgen/pull/2928) - Bump github.com/google/uuid from 1.3.0 to 1.6.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2924](https://github.com/99designs/gqlgen/pull/2924) - Bump github.com/stretchr/testify from 1.8.2 to 1.8.4 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2925](https://github.com/99designs/gqlgen/pull/2925) - Bump google.golang.org/protobuf from 1.30.0 to 1.32.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2926](https://github.com/99designs/gqlgen/pull/2926) - Bump react from 16.14.0 to 18.2.0 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2929](https://github.com/99designs/gqlgen/pull/2929) - Bump vite from 4.5.2 to 5.1.1 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2931](https://github.com/99designs/gqlgen/pull/2931) - Bump [@​graphql-codegen/cli](https://github.com/graphql-codegen/cli) from 4.0.1 to 5.0.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2932](https://github.com/99designs/gqlgen/pull/2932) - Bump github.com/sosodev/duration from 1.1.0 to 1.2.0 by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2927](https://github.com/99designs/gqlgen/pull/2927) - Bump react-dom from 16.14.0 to 18.2.0 in /\_examples/chat by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2930](https://github.com/99designs/gqlgen/pull/2930) #### New Contributors - [@​trevor-scheer](https://github.com/trevor-scheer) made their first contribution in [https://github.com/99designs/gqlgen/pull/2876](https://github.com/99designs/gqlgen/pull/2876) - [@​ryicoh](https://github.com/ryicoh) made their first contribution in [https://github.com/99designs/gqlgen/pull/2894](https://github.com/99designs/gqlgen/pull/2894) - [@​mnPanic](https://github.com/mnPanic) made their first contribution in [https://github.com/99designs/gqlgen/pull/2922](https://github.com/99designs/gqlgen/pull/2922) **Full Changelog**: 99designs/gqlgen@v0.17.43...v0.17.44 ### [`v0.17.43`](https://github.com/99designs/gqlgen/releases/tag/v0.17.43) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.42...v0.17.43) #### What's Changed - Fix code generation for federated multi-key, multi-entity types by [@​bpeters-cmu](https://github.com/bpeters-cmu) in [https://github.com/99designs/gqlgen/pull/2877](https://github.com/99designs/gqlgen/pull/2877) - Add config option to omit root objects from models by [@​ghjm](https://github.com/ghjm) in [https://github.com/99designs/gqlgen/pull/2878](https://github.com/99designs/gqlgen/pull/2878) - add omitempty config to example gqlgen.yml by [@​PaulVasilenko](https://github.com/PaulVasilenko) in [https://github.com/99designs/gqlgen/pull/2880](https://github.com/99designs/gqlgen/pull/2880) - Update gqlparser to v2.5.11 by [@​StevenACoffman](https://github.com/StevenACoffman) in [https://github.com/99designs/gqlgen/pull/2882](https://github.com/99designs/gqlgen/pull/2882) #### New Contributors - [@​bpeters-cmu](https://github.com/bpeters-cmu) made their first contribution in [https://github.com/99designs/gqlgen/pull/2877](https://github.com/99designs/gqlgen/pull/2877) - [@​ghjm](https://github.com/ghjm) made their first contribution in [https://github.com/99designs/gqlgen/pull/2878](https://github.com/99designs/gqlgen/pull/2878) - [@​PaulVasilenko](https://github.com/PaulVasilenko) made their first contribution in [https://github.com/99designs/gqlgen/pull/2880](https://github.com/99designs/gqlgen/pull/2880) **Full Changelog**: 99designs/gqlgen@v0.17.42...v0.17.43 ### [`v0.17.42`](https://github.com/99designs/gqlgen/blob/HEAD/CHANGELOG.md#v01742---2023-12-29) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.41...v0.17.42) - <a href="https://github.com/99designs/gqlgen/commit/7bf0c223aec642d086793698bc2a0d1a6fdb09b4"><tt>[`7bf0c22`](https://github.com/99designs/gqlgen/commit/7bf0c223)</tt></a> release v0.17.42 <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/c811d47ec498bdd50591f163e7d23a7524e98280"><tt>c811d47e</tt></a> fix: avoid panic from tracing on bad request (<a href="https://github.com/99designs/gqlgen/pull/2871">#​2871</a>)</summary> This fixes a panic which arises from the tracing components when a request has some defect which results in an error when creating the operation context. The transports consistently handle this by calling `DispatchError(graphql.WithOperationContext(ctx, rc), err)` where `rc` is the OperationContext which was not correctly constructed. This seems dangerous, because middleware may assume that if there in an `OperationContext` in the `context.Context` than they are being invoked on a normal codepath and can assume their other interceptors have been invoked in the normal order. Also, using a value returned by a function which also returned a non-nil error is very unusual. However, I have no idea what the impact of changing that dangerous behavior in the transports would be, so I opted to make the tracing component more resilient instead. </details></dd></dl> - <a href="https://github.com/99designs/gqlgen/commit/13bb415268dda837690835e65e331746c8df892b"><tt>[`13bb415`](https://github.com/99designs/gqlgen/commit/13bb4152)</tt></a> fix for entity interfce code gen with related test (<a href="https://github.com/99designs/gqlgen/pull/2868">[#​2868](https://github.com/99designs/gqlgen/issues/2868)</a>) - <a href="https://github.com/99designs/gqlgen/commit/0354649c0309af6acfe089d12d103060d55a5805"><tt>[`0354649`](https://github.com/99designs/gqlgen/commit/0354649c)</tt></a> Remove archived dependency appdash (<a href="https://github.com/99designs/gqlgen/pull/2866">[#​2866](https://github.com/99designs/gqlgen/issues/2866)</a>) - <a href="https://github.com/99designs/gqlgen/commit/0d43599cdab22912d4ddd061c3b3ffd5d8da3845"><tt>[`0d43599`](https://github.com/99designs/gqlgen/commit/0d43599c)</tt></a> Update examples go.mod with appdash replacements (<a href="https://github.com/99designs/gqlgen/pull/2863">[#​2863](https://github.com/99designs/gqlgen/issues/2863)</a>) - <a href="https://github.com/99designs/gqlgen/commit/7dd971c871c0b0159ad26c9bf3095a8ba3780402"><tt>[`7dd971c`](https://github.com/99designs/gqlgen/commit/7dd971c8)</tt></a> Use defer wg.Done() in FieldSet Dispatch (<a href="https://github.com/99designs/gqlgen/pull/2861">[#​2861](https://github.com/99designs/gqlgen/issues/2861)</a>) <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/24ea195cebea095035caf4d23af7f3d75fd0a041"><tt>24ea195c</tt></a> vikstrous/dataloadgen replaces recommended dataloader package in example docs (<a href="https://github.com/99designs/gqlgen/pull/2770">#​2770</a>)</summary> - update example for dataloadgen - improved example with link to example repo - undo unnecessary changes - fix wrong signature - fix creation of loader - Update docs/content/reference/dataloaders.md </details></dd></dl> <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/42f6e39d48e3a301bf39cd4e8fd180250bc25f2c"><tt>42f6e39d</tt></a> Allow fields that return root level definitions (<a href="https://github.com/99designs/gqlgen/pull/2858">#​2858</a>)</summary> - generate structs for root level definitions to support fields that return Query, Mutation or Subscription - removed unnecessary comment - re-ran go generate *** </details></dd></dl> - <a href="https://github.com/99designs/gqlgen/commit/682a58dd6af5fda53509fbf4cfa45d23b5bb1c86"><tt>[`682a58d`](https://github.com/99designs/gqlgen/commit/682a58dd)</tt></a> Add go generate for examples so contributors never forget (<a href="https://github.com/99designs/gqlgen/pull/2859">[#​2859](https://github.com/99designs/gqlgen/issues/2859)</a>) <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/e080a96de178520fcfaf5a8d68836981ec4df9a9"><tt>e080a96d</tt></a> Modify to prevent unreachable code from occurring (<a href="https://github.com/99designs/gqlgen/pull/2846">#​2846</a>)</summary> - fix: 型の数でソートする処理を追加 - 戻し - fix: case文の最初にスーパークラスが来ないようにする - testdata追加 - fix: Added sorting by number of types. - fix: Prevent superclass from appearing at the beginning of case statement </details></dd></dl> - <a href="https://github.com/99designs/gqlgen/commit/68744ad2a1e9d5869ab6a00b49814c6ae9583186"><tt>[`68744ad`](https://github.com/99designs/gqlgen/commit/68744ad2)</tt></a> Bump changelog - <a href="https://github.com/99designs/gqlgen/commit/e4cf21d24518deb99af6d4c0ea86de11d6889349"><tt>[`e4cf21d`](https://github.com/99designs/gqlgen/commit/e4cf21d2)</tt></a> v0.17.41 postrelease bump <!-- end of Commits --> <!-- end of Else --> <!-- end of If NoteGroups --> ### [`v0.17.41`](https://github.com/99designs/gqlgen/blob/HEAD/CHANGELOG.md#v01741---2023-12-03) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.40...v0.17.41) - <a href="https://github.com/99designs/gqlgen/commit/fe60938c55308b1cd5562556cdb976771cfcc6cc"><tt>[`fe60938`](https://github.com/99designs/gqlgen/commit/fe60938c)</tt></a> release v0.17.41 <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/5e98a16a3a5a5678f1b6481275d81f52f9462f90"><tt>5e98a16a</tt></a> fix fieldset.New bug when prefix slice has len < cap (<a href="https://github.com/99designs/gqlgen/pull/2851">#​2851</a>)</summary> - fix fieldset.New bug when prefix slice has len < cap - ignore gocritic warning </details></dd></dl> <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/bd9657f3e50b7b9642c05039a5364ce2262faaf4"><tt>bd9657f3</tt></a> Improve ResolverImplementer.Implment (<a href="https://github.com/99designs/gqlgen/pull/2850">#​2850</a>)</summary> - improve resolver implement render - add error when multiple implementors - add initial test </details></dd></dl> <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/cb3c1c890e5a255776df9577c80b0c15218cf254"><tt>cb3c1c89</tt></a> Updated apollo sandbox (<a href="https://github.com/99designs/gqlgen/pull/2849">#​2849</a>)</summary> Added all supported options to new window.EmbeddedSandbox object </details></dd></dl> <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/eb5cea7206767bda3582040fd9e4c98174aaa6b1"><tt>eb5cea72</tt></a> Small template fix to save space in the generated file (<a href="https://github.com/99designs/gqlgen/pull/2841">#​2841</a>)</summary> - Small template fix to save space in the generated file - Re-generate *** </details></dd></dl> - <a href="https://github.com/99designs/gqlgen/commit/c0ca5091a10417c34192da4d3c064a0fed2a7fdb"><tt>[`c0ca509`](https://github.com/99designs/gqlgen/commit/c0ca5091)</tt></a> Omittable can now be serialized as json (<a href="https://github.com/99designs/gqlgen/pull/2839">[#​2839](https://github.com/99designs/gqlgen/issues/2839)</a>) - <a href="https://github.com/99designs/gqlgen/commit/dcb7619111642cc82a21b8e80ce1300213af1368"><tt>[`dcb7619`](https://github.com/99designs/gqlgen/commit/dcb76191)</tt></a> fix: sample program indentation (<a href="https://github.com/99designs/gqlgen/pull/2840">[#​2840](https://github.com/99designs/gqlgen/issues/2840)</a>) <dl><dd><details><summary><a href="https://github.com/99designs/gqlgen/commit/132ec1ce579e9ce3dc772afebf9703c1403d588e"><tt>132ec1ce</tt></a> Updated GraphiQL 3.0.1 => 3.0.6 (<a href="https://github.com/99designs/gqlgen/pull/2837">#​2837</a>)</summary> - Updated GraphiQL 3.0.1 => 3.0.6 - Added unit tests to cover integrity of playgrounds - Updated vulnerable dependency - Close response body </details></dd></dl> - <a href="https://github.com/99designs/gqlgen/commit/917407005eb4198aa43875984fb77caeaa7fca36"><tt>[`9174070`](https://github.com/99designs/gqlgen/commit/91740700)</tt></a> v0.17.40 postrelease bump <!-- end of Commits --> <!-- end of Else --> <!-- end of If NoteGroups --> ### [`v0.17.40`](https://github.com/99designs/gqlgen/releases/tag/v0.17.40) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.39...v0.17.40) ##### What's Changed - resolver: fix case-insensitive file name collision by [@​erankor](https://github.com/erankor) in [https://github.com/99designs/gqlgen/pull/2829](https://github.com/99designs/gqlgen/pull/2829) - Bump [@​babel/traverse](https://github.com/babel/traverse) from 7.22.5 to 7.23.2 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2831](https://github.com/99designs/gqlgen/pull/2831) - Map based input types fields are now coerced to the right type by [@​endSly](https://github.com/endSly) in [https://github.com/99designs/gqlgen/pull/2830](https://github.com/99designs/gqlgen/pull/2830) **Full Changelog**: 99designs/gqlgen@v0.17.39...v0.17.40 ### [`v0.17.39`](https://github.com/99designs/gqlgen/releases/tag/v0.17.39) [Compare Source](https://github.com/99designs/gqlgen/compare/v0.17.38...v0.17.39) #### What's Changed - Breaking API: Allow WebsocketInitFunc to add payload to Ack ([#​4](https://github.com/99designs/gqlgen/issues/4)) by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2791](https://github.com/99designs/gqlgen/pull/2791) - add close flag into wsConnection to avoid duplicate calls of CloseFunc by [@​vlad-tokarev](https://github.com/vlad-tokarev) in [https://github.com/99designs/gqlgen/pull/2803](https://github.com/99designs/gqlgen/pull/2803) - fix: CodeGen for omit_slice_element_pointers and GetMany Entity Resolvers by [@​parkerroan](https://github.com/parkerroan) in [https://github.com/99designs/gqlgen/pull/2802](https://github.com/99designs/gqlgen/pull/2802) - feat: update getting-started CreateTodo mutationResolver by [@​gitxiongpan](https://github.com/gitxiongpan) in [https://github.com/99designs/gqlgen/pull/2810](https://github.com/99designs/gqlgen/pull/2810) - Feature: Support Apollo Federation Auth Directives by [@​parkerroan](https://github.com/parkerroan) in [https://github.com/99designs/gqlgen/pull/2809](https://github.com/99designs/gqlgen/pull/2809) - Consider go type name when autobinding by [@​dany74q](https://github.com/dany74q) in [https://github.com/99designs/gqlgen/pull/2812](https://github.com/99designs/gqlgen/pull/2812) - Update generated files that change when building by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2813](https://github.com/99designs/gqlgen/pull/2813) - Add a pong only keep alive for the new protocol by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2814](https://github.com/99designs/gqlgen/pull/2814) - Store parsed Schema on ExecutableSchema rather than use global variable by [@​gitxiongpan](https://github.com/gitxiongpan) in [https://github.com/99designs/gqlgen/pull/2811](https://github.com/99designs/gqlgen/pull/2811) - Add ability to not fail when pong is not received. by [@​telemenar](https://github.com/telemenar) in [https://github.com/99designs/gqlgen/pull/2815](https://github.com/99designs/gqlgen/pull/2815) - Adding duration scalar conforming to ISO8601 standard by [@​rwrz](https://github.com/rwrz) in [https://github.com/99designs/gqlgen/pull/2800](https://github.com/99designs/gqlgen/pull/2800) - Bump postcss from 8.4.24 to 8.4.31 in /integration by [@​dependabot](https://github.com/dependabot) in [https://github.com/99designs/gqlgen/pull/2819](https://github.com/99designs/gqlgen/pull/2819) - Add [@​interfaceObject](https://github.com/interfaceObject) and [@​composeDirective](https://github.com/composeDirective) at Federation 2 directive lists. by [@​wangmir](https://github.com/wangmir) in [https://github.com/99designs/gqlgen/pull/2821](https://github.com/99designs/gqlgen/pull/2821) #### New Contributors - [@​vlad-tokarev](https://github.com/vlad-tokarev) made their first contribution in [https://github.com/99designs/gqlgen/pull/2803](https://github.com/99designs/gqlgen/pull/2803) - [@​parkerroan](https://github.com/parkerroan) made their first contribution in [https://github.com/99designs/gqlgen/pull/2802](https://github.com/99designs/gqlgen/pull/2802) - [@​dany74q](https://github.com/dany74q) made their first contribution in [https://github.com/99designs/gqlgen/pull/2812](https://github.com/99designs/gqlgen/pull/2812) - [@​rwrz](https://github.com/rwrz) made their first contribution in [https://github.com/99designs/gqlgen/pull/2800](https://github.com/99designs/gqlgen/pull/2800) - [@​wangmir](https://github.com/wangmir) made their first contribution in [https://github.com/99designs/gqlgen/pull/2821](https://github.com/99designs/gqlgen/pull/2821) **Full Changelog**: 99designs/gqlgen@v0.17.38...v0.17.39 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/infratographer/x). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjMiLCJ1cGRhdGVkSW5WZXIiOiIzNy4yMzAuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This PR moves from using the global variable
parsedSchema
to storing it on theExecutableSchema
.In my use case, I have two GraphQL servers. One server's schema is trimmed down and it is publicly accessible. Another one has a comprehensive schema and it is protected by a gateway
I would like an easy way to implement these two GraphQL servers. At the moment
executableSchema.Schema()
returns a global variableparsedSchema
. This behavior makes my use case quite challenging to solve.see code below
I updated the
codegen/generated!.gotpl
so that executableSchema is configurableThis update is backward compatible which means the change is almost transparent to those with no interests in hosting multiple GraphQL servers with different exposed schemas.
I have: