Skip to content

feat: adds action templates and reusable actions#296

Draft
baywet wants to merge 14 commits intoOAI:mainfrom
baywet:feat/action-templates
Draft

feat: adds action templates and reusable actions#296
baywet wants to merge 14 commits intoOAI:mainfrom
baywet:feat/action-templates

Conversation

@baywet
Copy link
Member

@baywet baywet commented Feb 18, 2026

This pull request adds action templates.

fixes #33
fixes #136
fixes #270

closes #238

This is another attempt to solve a scale limitation in the current specification. Action templates are better than the previous parameters proposal because:

  • They do not introduce a matrix projection, people may use the template multiple times.
  • They do not require "declaring" which environment variables to read in advance.
  • They limit the string literal replacement to the templates, which does not impact how actions currently work.
  • The template reference mechanism works like OpenAPI references.
  • The template resolution mechanism can be isolated as a pre-processing step, and the resolved actions can then be fed to the existing code processing actions.
  • It introduces a string literal replacement syntax which can be expanded upon for other sources or used at other places in the future.

The pull request is incomplete as it is, it's a draft, I want to collect feedback on the approach before making any further investments.

@baywet baywet added this to the Release 1.2 milestone Feb 18, 2026
@baywet baywet requested review from handrews, karenetheridge, lornajane, mikekistler, mkistler and ralfhandl and removed request for mkistler February 18, 2026 18:37
@ralfhandl
Copy link
Contributor

I like the general direction.

@baywet
Copy link
Member Author

baywet commented Feb 24, 2026

Feedback from the meeting from both @lornajane and @ralfhandl :

  • add a peer block to parameters for the environment variables, this allows to set defaults and "declare" which variables are used. But this declaration is optional.
  • add a peer "actions" in the components, that's defined as everything except for the target. So people can specify the target on reference. Reusable actions may use action templates in turns.

@baywet baywet force-pushed the feat/action-templates branch from e709bde to 06a21c9 Compare February 25, 2026 15:19
@baywet baywet changed the title feat: adds action templates feat: adds action templates and reusable actions Feb 25, 2026
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly wording and capitalization

baywet and others added 3 commits February 25, 2026 11:37

| Field Name | Type | Description |
| ---- | :----: | ---- |
| <a name="action-reference-ref"></a>$ref | `string` | **REQUIRED** A valid reference to an action in the components section, represented as `#/components/actions/actionTemplateKey`. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct way to define this is to say that the value is a same-document (or fragment-only) relative URI reference, per RFC3986 §4.4, and that the fragment syntax is JSON Pointer, with the pointer prefix restricted to /components/actions/.

It looks to me like the reference resolution mechanism here is delegation, as in JSON Schema draft 2020-12, and not replacment, as there is another field in this Object. That should be called out explicitly.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have updated the wording with your suggestion in the Action Templates Reference Object section. Let me know what you think!

@baywet baywet requested a review from ralfhandl February 25, 2026 18:56
@baywet
Copy link
Member Author

baywet commented Mar 3, 2026

@ralfhandl @lornajane I pushed another update a couple of minutes ago. I wasn't happy about the whole reusable actions vs action templates kind of thing. After chatting with @mikekistler internally I realized we could simply define a an action template reference object as "you can override anything from the resolved template in the reference" like JSON schema does to some extent. And keep things extra simple.

Let me know what you think!

Copy link
Contributor

@mikekistler mikekistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will be a very useful enhancement to overlays, but it needs some work to make it understandable to users.

I left some suggestions for wording changes and simplification. These are mainly as seed for discussion in our next Overlays SIG meeting.


| Field Name | Type | Description |
| ---- | :----: | ---- |
| <a name="component-action-templates"></a>actionTemplates | Map(`string`, [Action Template Object](#action-template-object)) | A key-value set of action templates to reference in the actions. Optional. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| <a name="component-action-templates"></a>actionTemplates | Map(`string`, [Action Template Object](#action-template-object)) | A key-value set of action templates to reference in the actions. Optional. |
| <a name="component-action-templates"></a>actionTemplates | Map(`string`, [Action Template Object](#action-template-object)) | A key-value set of action templates to reference in action template instantiations. Optional. |


#### Action Template Object

This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references.
This object is a template that, when instantiated by an Action Template Instantiation, represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references.

#### Action Template Object

This object represents one or more changes to be applied to the target document at the locations defined by the target JSONPath expression and reused in one of more action references.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
An action template is similar to an action, but differs in two important ways:
1. It may omit any action field, in particular the `target` field, as these may be supplied by the Action Template Instantiation.
2. Any action field may employ string interpolation using variables specified in the `parameters` or `environmentVariables` fields.

This object MAY be extended with [Specification Extensions](#specification-extensions).


#### Action Template Reference Object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think calling this a "Reference Object" is confusing and inconsistent with other uses of this terminology. I suggest calling this an "Action Template Instantiation Object", as it's primary function is to "instantiate" a template.

| ---- | :----: | ---- |
| <a name="action-template-reference-ref"></a>$ref | `string` | **REQUIRED** A [same-document](https://www.rfc-editor.org/rfc/rfc3986.html#section-4.4) (or fragment-only) relative URI reference, per RFC3986 §4.4, and that the fragment syntax is JSON Pointer, with the pointer prefix restricted to `/components/actionTemplates/`. |
| <a name="action-template-reference-parameter-values></a>parameterValues | `Map(string, Any)` | A set of values to use for the template parameters, the key MUST match the parameter name. Optional. |
| <a name="action-template-reference-action-fields"></a>Any field defined in the [action object](#action-object) | mixed | Any field defined in the [Action Object](#action-object) to be used as an override to the value resolved in the template. The [string literal replacement syntax](#string-literal-replacement-syntax) MAY NOT be used for any of the fields. Optional. |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could eliminate the action fields here. They are already allowed in the template, so the action field in the template could be defined with a parameterize value, and the field value can then be passed in a parameter value. So eliminating the action fields here loses no functionality.

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.

unsupported use case for dynamic node creation String Interpolation for Update Values Environment Variables in definition

4 participants