| | 1 | |
|
| | 2 | | <# |
| | 3 | | .SYNOPSIS |
| | 4 | | Creates a new MapRouteOptions object with the specified base and overrides. |
| | 5 | | .DESCRIPTION |
| | 6 | | This function takes an existing MapRouteOptions object and a hashtable of overrides, |
| | 7 | | and returns a new MapRouteOptions object with the merged properties. |
| | 8 | | The merged properties will prioritize the values from the Override hashtable. |
| | 9 | | .PARAMETER Base |
| | 10 | | The base MapRouteOptions object to use as a template. |
| | 11 | | This object will be cloned, and the properties will be merged with the Override hashtable. |
| | 12 | | .PARAMETER Override |
| | 13 | | A hashtable of properties to override in the base MapRouteOptions object. |
| | 14 | | Any properties not specified in the Override hashtable will retain their original values from the Base object. |
| | 15 | | .OUTPUTS |
| | 16 | | Kestrun.Hosting.Options.MapRouteOptions |
| | 17 | | #> |
| | 18 | | function _KrWith-MRO { |
| | 19 | | [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseApprovedVerbs', '')] |
| | 20 | | param( |
| | 21 | | [Parameter(Mandatory)][Kestrun.Hosting.Options.MapRouteOptions]$Base, |
| | 22 | | [Parameter()][hashtable]$Override = @{} |
| | 23 | | ) |
| 0 | 24 | | $h = @{ |
| 0 | 25 | | Pattern = $Base.Pattern |
| 0 | 26 | | HttpVerbs = $Base.HttpVerbs |
| 0 | 27 | | Code = $Base.Code |
| 0 | 28 | | Language = $Base.Language |
| 0 | 29 | | ExtraImports = $Base.ExtraImports |
| 0 | 30 | | ExtraRefs = $Base.ExtraRefs |
| 0 | 31 | | RequireSchemes = $Base.RequireSchemes |
| 0 | 32 | | RequirePolicies = $Base.RequirePolicies |
| 0 | 33 | | CorsPolicyName = $Base.CorsPolicyName |
| 0 | 34 | | Arguments = $Base.Arguments |
| 0 | 35 | | OpenAPI = $Base.OpenAPI |
| 0 | 36 | | ThrowOnDuplicate = $Base.ThrowOnDuplicate |
| | 37 | | } |
| 0 | 38 | | foreach ($k in $Override.Keys) { $h[$k] = $Override[$k] } |
| 0 | 39 | | return New-KrMapRouteOption -Property $h |
| | 40 | | } |