-
-
Notifications
You must be signed in to change notification settings - Fork 562
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
Introduce StandardTypeRegistry #1426
Open
ruudk
wants to merge
9
commits into
webonyx:master
Choose a base branch
from
ruudk:keep-types-on-schema
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Commits on Aug 14, 2023
-
Introduce StandardTypeRegistry
Currently, types are referenced and cached statically. This is problematic when using multiple schema's that have different standard types that share the same memory. For example, when running them in un-isolated unit tests or when there is a long running PHP process that serves GraphQL requests. To solve this problem, we introduce a `StandardTypeRegistry` interface with a `DefaultTypeRegistry` implementation. People are allowed to create their own registries by implementing the interface. Every Schema should be constructed with a `typeRegistry` that is an instance of `StandardTypeRegistry`. From there on, all types are queried from the registry. The registry will be responsible for caching the types to make sure subsequent calls to the same type will return the same instance. Internally, all static calls to the standard types (Type::string(), Type::int(), Type::float(), Type::boolean(), Type::id()) have been replaced with dynamic calls on the type registry. Also calls to the introspection objects and internal directives are using the type registry now. As most people probably have only one schema, we keep the static methods on the Type call. These now forward to `DefaultTypeRegistry::getInstance()`. This way, we don't break existing installations. The reason for creating a `StandardTypeRegistry` interface as opposed to just a non-final implementation is that it allows people to use composition instead of inheritance to extend the functionality of the registry. For example, in my project I'd like to have a registry that holds all types and that allows me to query any type by their name (instead of FQCN). I can then delegate the interface methods to the decorated `StandardTypeRegistry`. Resolves webonyx#1424
Configuration menu - View commit details
-
Copy full SHA for 47530c7 - Browse repository at this point
Copy the full SHA 47530c7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 287e1e9 - Browse repository at this point
Copy the full SHA 287e1e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0d3ff24 - Browse repository at this point
Copy the full SHA 0d3ff24View commit details -
Configuration menu - View commit details
-
Copy full SHA for fb12480 - Browse repository at this point
Copy the full SHA fb12480View commit details -
Configuration menu - View commit details
-
Copy full SHA for 1494762 - Browse repository at this point
Copy the full SHA 1494762View commit details
Commits on Aug 15, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 193a8ef - Browse repository at this point
Copy the full SHA 193a8efView commit details -
Configuration menu - View commit details
-
Copy full SHA for 12252ac - Browse repository at this point
Copy the full SHA 12252acView commit details -
Remove Introspection from StandardTypeRegistry
We now store this separately.
Configuration menu - View commit details
-
Copy full SHA for 432cc04 - Browse repository at this point
Copy the full SHA 432cc04View commit details -
Configuration menu - View commit details
-
Copy full SHA for 9d7d6e0 - Browse repository at this point
Copy the full SHA 9d7d6e0View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.