File tree Expand file tree Collapse file tree 2 files changed +47
-2
lines changed
Microsoft.OpenApi.Hidi.Tests Expand file tree Collapse file tree 2 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 1- // Copyright (c) Microsoft Corporation. All rights reserved.
1+ // Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT license.
33
44using System ;
@@ -135,5 +135,22 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments
135135 var message2 = Assert . Throws < InvalidOperationException > ( ( ) => OpenApiFilterService . CreatePredicate ( "users.user.ListUser" , "users.user" ) ) . Message ;
136136 Assert . Equal ( "Cannot specify both operationIds and tags at the same time." , message2 ) ;
137137 }
138+
139+ [ Theory ]
140+ [ InlineData ( "reports.getTeamsUserActivityUserDetail-a3f1" , null ) ]
141+ [ InlineData ( null , "reports.Functions" ) ]
142+ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags ( string operationIds , string tags )
143+ {
144+ // Act
145+ var predicate = OpenApiFilterService . CreatePredicate ( operationIds , tags ) ;
146+ var subsetOpenApiDocument = OpenApiFilterService . CreateFilteredDocument ( _openApiDocumentMock , predicate ) ;
147+
148+ // Assert
149+ foreach ( var pathItem in subsetOpenApiDocument . Paths )
150+ {
151+ Assert . True ( pathItem . Value . Parameters . Any ( ) ) ;
152+ Assert . Equal ( 1 , pathItem . Value . Parameters . Count ) ;
153+ }
154+ }
138155 }
139156}
Original file line number Diff line number Diff line change @@ -116,6 +116,21 @@ public static OpenApiDocument CreateOpenApiDocument()
116116 }
117117 }
118118 }
119+ } ,
120+ Parameters = new List < OpenApiParameter >
121+ {
122+ {
123+ new OpenApiParameter ( )
124+ {
125+ Name = "period" ,
126+ In = ParameterLocation . Path ,
127+ Required = true ,
128+ Schema = new OpenApiSchema ( )
129+ {
130+ Type = "string"
131+ }
132+ }
133+ }
119134 }
120135 } ,
121136 [ "/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})" ] = new OpenApiPathItem ( )
@@ -175,7 +190,20 @@ public static OpenApiDocument CreateOpenApiDocument()
175190 }
176191 }
177192 }
178- }
193+ } ,
194+ Parameters = new List < OpenApiParameter >
195+ {
196+ new OpenApiParameter
197+ {
198+ Name = "period" ,
199+ In = ParameterLocation . Path ,
200+ Required = true ,
201+ Schema = new OpenApiSchema ( )
202+ {
203+ Type = "string"
204+ }
205+ }
206+ }
179207 } ,
180208 [ "/users" ] = new OpenApiPathItem ( )
181209 {
You can’t perform that action at this time.
0 commit comments