feat(wrapComponents): new chain configuration option (#7236)
This commit provides a backward compatible mechanism to chain wrap an individual component multiple times `Chain` mode: allow chaining of plugins on a given component `Legacy` mode: last plugin to wrap a given component will supercede others * chore: Add unit test for wrapComponent wrapping * doc: Add documentation about the new pluginsOptions configuration * doc: Add a sidenote on plugin-api page Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
@@ -388,6 +388,10 @@ const MyWrapComponentPlugin = function(system) {
|
||||
}
|
||||
```
|
||||
|
||||
**Note:**
|
||||
|
||||
If you have multiple plugins wrapping the same component, you may want to change the [`pluginsOptions.pluginLoadType`](/docs/usage/configuration.md#Plugins-options) parameter to `chain`.
|
||||
|
||||
#### `rootInjects`
|
||||
|
||||
The `rootInjects` interface allows you to inject values at the top level of the system.
|
||||
|
||||
@@ -39,9 +39,16 @@ Read more about the plugin system in the [Customization documentation](/docs/cus
|
||||
Parameter name | Docker variable | Description
|
||||
--- | --- | -----
|
||||
<a name="layout"></a>`layout` | _Unavailable_ | `String="BaseLayout"`. The name of a component available via the plugin system to use as the top-level layout for Swagger UI.
|
||||
<a name="pluginsOptions"></a>`pluginsOptions` | _Unavailable_ | `Object`. A Javascript object to configure plugin integration and behaviors (see below).
|
||||
<a name="plugins"></a>`plugins` | _Unavailable_ | `Array=[]`. An array of plugin functions to use in Swagger UI.
|
||||
<a name="presets"></a>`presets` | _Unavailable_ | `Array=[SwaggerUI.presets.ApisPreset]`. An array of presets to use in Swagger UI. Usually, you'll want to include `ApisPreset` if you use this option.
|
||||
|
||||
##### Plugins options
|
||||
|
||||
Parameter name | Docker variable | Description
|
||||
--- | --- | -----
|
||||
<a name="pluginLoadType"></a>`pluginLoadType` | _Unavailable_ | `String=["legacy", "chain"]`. Control behavior of plugins when targeting the same component with wrapComponent.<br/>- `legacy` (default) : last plugin takes precedence over the others<br/>- `chain` : chain wrapComponents when targeting the same core component, allowing multiple plugins to wrap the same component
|
||||
|
||||
##### Display
|
||||
|
||||
Parameter name | Docker variable | Description
|
||||
|
||||
Reference in New Issue
Block a user