You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: dotnet/samples/Concepts/Plugins/OpenApiPlugin_Filtering.cs
+17-21
Original file line number
Diff line number
Diff line change
@@ -37,13 +37,15 @@ public async Task ExcludeOperationsBasedOnExclusionListAsync()
37
37
{
38
38
// The RepairService OpenAPI plugin being imported below includes the following operations: `listRepairs`, `createRepair`, `updateRepair`, and `deleteRepair`.
39
39
// However, to meet our business requirements, we need to restrict state-modifying operations such as creating, updating, and deleting repairs, allowing only non-state-modifying operations like listing repairs.
40
-
// To enforce this restriction, we will exclude the `createRepair`, `updateRepair`, and `deleteRepair` operations from the OpenAPI document prior to importing the plugin.
40
+
// To enforce this restriction, we will exclude the `createRepair`, `updateRepair`, and `deleteRepair` operations from the OpenAPI document at the plugin import time.
// The RepairService OpenAPI plugin, parsed and imported below, has the following operations: `listRepairs`, `createRepair`, `updateRepair`, and `deleteRepair`.
77
76
// However, for our business scenario, we only want to permit the AI model to invoke the `createRepair` and `updateRepair` operations, excluding all others.
78
77
// To accomplish this, we will define an inclusion list that specifies the allowed operations and filters out the rest.
#pragma warning disable CS0618// Type or member is obsolete
429
+
if(executionParameters?.OperationSelectionPredicateis not null&&executionParameters?.OperationsToExcludeis{Count:>0})
430
+
{
431
+
thrownewArgumentException($"{nameof(executionParameters.OperationSelectionPredicate)} and {nameof(executionParameters.OperationsToExclude)} cannot be used together.");
0 commit comments