Added array composition resolvers.#29
Conversation
There was a problem hiding this comment.
Pull request overview
Adds two new composition resolvers, ArrayResolver and EntityArrayResolver (built on a shared generic ReferenceArrayCompositeResolver<T>), which build arrays by evaluating nested resolvers per element rather than reading from a variable. Also tightens documentation: the existing array-resolver.md (which actually described the variable resolver) is split into array-resolver.md (new composite) and array-variable-resolver.md, with cross-links and the resolvers README updated. IEntityResolver is simplified to an empty interface declaration using C# 12 syntax.
Changes:
- Introduces
ArrayResolver,ReferenceArrayCompositeResolver<T>, andEntityArrayResolver, with type-inference and explicit-type constructors plus per-element validation. - Adds focused unit tests for both composite resolvers and a helper
ResolveReferenceArrayResolverNode<T>test node. - Restructures the array-resolver docs (new file for variable resolver, rewritten composite-resolver doc), updates the resolvers README, custom-resolvers guide, and entity-array see-also links.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Forge/Statescript/Properties/ArrayResolver.cs | New value-array composite resolver with inferred or explicit element type and full validation. |
| Forge/Statescript/Properties/ReferenceArrayCompositeResolver.cs | Generic base composite resolver for reference arrays; validates non-null nested resolvers. |
| Forge/Statescript/Properties/EntityArrayResolver.cs | Convenience subclass of the composite resolver for IForgeEntity references. |
| Forge/Statescript/Properties/IEntityResolver.cs | Converts empty interface body to C# 12 declaration form. |
| Forge.Tests/Statescript/Resolvers/ArrayCompositionResolverTests.cs | Tests covering ordering, type inference, empty-typed arrays, mismatched types, and graph integration. |
| Forge.Tests/Statescript/Resolvers/EntityArrayResolverTests.cs | Tests covering nested entity resolution, missing activation context, and reference-array property type validation. |
| Forge.Tests/Helpers/StatescriptTestHelpers.cs | Adds ResolveReferenceArrayResolverNode<T> helper node for executing reference-array resolvers in test graphs. |
| docs/statescript/resolvers/array-resolver.md | Rewritten to describe the new ArrayResolver (was previously the variable resolver). |
| docs/statescript/resolvers/array-variable-resolver.md | New page documenting the variable-reading array resolver split out from the old file. |
| docs/statescript/resolvers/entity-array-resolver.md | New documentation page for EntityArrayResolver. |
| docs/statescript/resolvers/entity-array-variable-resolver.md | Updates See-Also links to reference the split docs and the new entity composite resolver. |
| docs/statescript/resolvers/variable-resolver.md | Updates See-Also to include the new composite and variable array resolver pages. |
| docs/statescript/resolvers/README.md | Adds rows for ArrayResolver and EntityArrayResolver and points ArrayVariableResolver at its new file. |
| docs/statescript/custom-resolvers.md | Adds a tip recommending the built-in composite resolvers over custom implementations for simple composition. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Added
Fixed