Skip to content

feat: add fragment variables support#254

Open
Jeroen-VdB wants to merge 5 commits into
Azure:mainfrom
Jeroen-VdB:feat/fragment-variables
Open

feat: add fragment variables support#254
Jeroen-VdB wants to merge 5 commits into
Azure:mainfrom
Jeroen-VdB:feat/fragment-variables

Conversation

@Jeroen-VdB
Copy link
Copy Markdown
Contributor

Implements #253 using typed fragment variables, allowing fragments to declare inputs via [FragmentVariable]-decorated properties and callers to pass values through object initializer syntax.

Changes:

  • FragmentVariableAttribute (new) — marks a fragment class property as a variable, with optional custom name and default value
  • IInboundContext / IOutboundContext / IBackendContext / IOnErrorContext / IFragmentContext — added IncludeFragment(TFragment fragment) where TFragment : IFragment overload
  • CompilerUtils — ProcessParameter now resolves [FragmentVariable]-decorated property references inside fragment methods to @(context.Variables.GetValueOrDefault(...)) expressions
  • IncludeFragmentCompiler — handles object creation arguments by emitting for each initialized property (respecting [FragmentVariable] variable name) before
  • IncludeFragmentHandler (Emulator Testing) — routes IFragment instances directly to ExecuteFragment, bypassing the registry/discovery lookup
  • Added tests in IncludeFragmentTests and DocumentTypeTests
  • Updated the example to use the new attribute and show how to write it and proves unit testing works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant