Repository navigation
Conversation
fix: resettable schemas fix: resettable schemas
…ublic InputObject support Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Oh, This looks awesome. Thank you. I've asked some friends to give in a thorough review. |
|
Hi, thank you for MR, looking good! The only thing still missing is documentation for the new resettable config and update about |
|
@vlydev Can you please add some documentation and I'll be happy to merge |
|
@Nyholm done, please check |
|
@Nyholm check please and merge |
|
Some AI agent is available to check this solution? 😭🤣🤣 |
|
Any updates? |
The PR has three independent changes. None of them breaks backward compatibility, and every new behavior is opt-in or additive.
How to verify
|
|
@Nyholm any updates? |
|
Hi @vlydev, we just opened #1254 with a proposal for performance work on the bundle. Part of it touches the same While doing that, I ran an audit of the bundle in a long-running process against this PR: one kernel, A field with The cause, as far as I can tell: a type is created once per container (generated types are shared All differences the audit finds with this PRAudit:
The direction I would suggest (not tried yet): let a reset drop the loaded types and the built schemas The audit and this comment were prepared with Claude. |
Summary
This PR adds three independent improvements to the bundle, primarily motivated by long-running process compatibility (e.g. RoadRunner, Swoole, FrankenPHP) and better ACL
control over input types.
What changed:
factories
In long-running process environments (RoadRunner, Swoole, ReactPHP), the Symfony kernel's reset() cycle is called between requests. Previously, built schemas were cached via a
static variable inside the getBuilder() closure, which meant they survived resets entirely — causing stale type registries and memory growth over time.
This change moves schema caching into SchemaBuilder::$builders (an instance property), so reset() can selectively evict schemas marked as resettable: true. Non-resettable
schemas (the default) are kept across resets for performance. The same principle applies to AbstractResolver: factories are registered once at boot and survive resets, while
resolved instances are cleared so they can be rebuilt fresh on the next request.
What changed:
The current schema name is set internally during schema build but was previously inaccessible from outside the resolver. Services and extensions that need to apply
schema-specific logic (e.g. different ACL rules per schema, custom type loaders, multi-schema middleware) had no way to read which schema is currently being resolved without
injecting additional state. This getter exposes what was already tracked internally, with zero behavioral change.
What changed:
#[IsPublic] was already supported on ObjectType fields and at the provider level, but InputObject fields had no equivalent. This gap meant that input fields carrying sensitive
data (e.g. an adminNotes field on a search input) could not be conditionally hidden via expression language — the only option was to create separate input types. This change
brings InputObject field visibility in line with ObjectType field visibility, using the same expression-language mechanism already present in the bundle.