@@ -35,7 +35,7 @@ export class CustomResourceParser extends DefaultResourceParser {
3535 }
3636}
3737
38- test ( 'query param' , ( ) => {
38+ test ( 'query param - schema ' , ( ) => {
3939 const paths = {
4040 '/api/entities' : {
4141 get : {
@@ -145,6 +145,162 @@ test('query param', () => {
145145 ] ) ;
146146} ) ;
147147
148+ test ( 'query param - content' , ( ) => {
149+ const paths = {
150+ '/api/entities' : {
151+ get : {
152+ operationId : 'EntityController_list' ,
153+ summary : 'List all entities' ,
154+ parameters : [
155+ {
156+ name : 'filter' ,
157+ required : false ,
158+ in : 'query' ,
159+ example : false ,
160+ description : 'Filter description' ,
161+ content : {
162+ 'application/json' : {
163+ schema : {
164+ $ref : '#/components/schemas/Entity' ,
165+ } ,
166+ } ,
167+ }
168+ } ,
169+ ] ,
170+ tags : [ '🖥️ Entity' ] ,
171+ } ,
172+ } ,
173+ } ;
174+ const components = {
175+ schemas : {
176+ Entity : {
177+ type : 'object' ,
178+ properties : {
179+ name : {
180+ type : 'string' ,
181+ maxLength : 54 ,
182+ example : 'default' ,
183+ description : 'Entity name' ,
184+ } ,
185+ start : {
186+ type : 'boolean' ,
187+ description : 'Boolean flag description' ,
188+ example : true ,
189+ default : true ,
190+ } ,
191+ config : {
192+ $ref : '#/components/schemas/EntityConfig' ,
193+ } ,
194+ } ,
195+ required : [ 'name' ] ,
196+ } ,
197+ EntityConfig : {
198+ type : 'object' ,
199+ properties : {
200+ foo : {
201+ type : 'string' ,
202+ example : 'bar' ,
203+ } ,
204+ } ,
205+ } ,
206+ } ,
207+ } ;
208+
209+ const parser = new N8NPropertiesBuilder ( { paths, components} , {
210+ operation : new CustomOperationParser ( ) ,
211+ resource : new CustomResourceParser ( ) ,
212+ } ) ;
213+ const result = parser . build ( )
214+
215+ expect ( result ) . toEqual ( [
216+ {
217+ "default" : "" ,
218+ "displayName" : "Resource" ,
219+ "name" : "resource" ,
220+ "noDataExpression" : true ,
221+ "options" : [
222+ {
223+ "description" : "" ,
224+ "name" : "🖥️ Entity" ,
225+ "value" : "Entity"
226+ }
227+ ] ,
228+ "type" : "options"
229+ } ,
230+ {
231+ "default" : "" ,
232+ "displayName" : "Operation" ,
233+ "displayOptions" : {
234+ "show" : {
235+ "resource" : [
236+ "Entity"
237+ ]
238+ }
239+ } ,
240+ "name" : "operation" ,
241+ "noDataExpression" : true ,
242+ "options" : [
243+ {
244+ "action" : "List all entities" ,
245+ "description" : "List all entities" ,
246+ "name" : "List" ,
247+ "routing" : {
248+ "request" : {
249+ "method" : "GET" ,
250+ "url" : "=/api/entities"
251+ }
252+ } ,
253+ "value" : "List"
254+ }
255+ ] ,
256+ "type" : "options"
257+ } ,
258+ {
259+ "default" : "" ,
260+ "displayName" : "GET /api/entities" ,
261+ "displayOptions" : {
262+ "show" : {
263+ "operation" : [
264+ "List"
265+ ] ,
266+ "resource" : [
267+ "Entity"
268+ ]
269+ }
270+ } ,
271+ "name" : "operation" ,
272+ "type" : "notice" ,
273+ "typeOptions" : {
274+ "theme" : "info"
275+ }
276+ } ,
277+ {
278+ "default" : false ,
279+ "description" : "Filter description" ,
280+ "displayName" : "Filter" ,
281+ "displayOptions" : {
282+ "show" : {
283+ "operation" : [
284+ "List"
285+ ] ,
286+ "resource" : [
287+ "Entity"
288+ ]
289+ }
290+ } ,
291+ "name" : "filter" ,
292+ "routing" : {
293+ "request" : {
294+ "qs" : {
295+ "filter" : "={{ $value }}"
296+ }
297+ }
298+ } ,
299+ "type" : "json"
300+ }
301+ ] ) ;
302+ } ) ;
303+
148304test ( 'path param' , ( ) => {
149305 const paths = {
150306 '/api/entities/{entity}' : {
0 commit comments