@@ -356,10 +356,35 @@ def allow_parameter(parameter: Dict[str, Any]) -> bool:
356356 # can add rules about param processing
357357 # param can be in path too , that is already handled when we declared
358358 # the class as collection from the endpoint
359- params_location = ["body" ]
360- if parameter ["in" ] not in params_location :
361- return False
362- return True
359+ params_location = ["body" , "integer" , "string" , "long" , "float" ,\
360+ "boolean" , "dateTime" , "Date" , "array" ]
361+ try :
362+ if parameter ["type" ] in params_location :
363+ return True
364+ except KeyError :
365+ if parameter ["in" ] in params_location :
366+ return True
367+
368+ return False
369+
370+
371+ def type_ref_mapping (type : str )-> str :
372+ """
373+ Returns semantic ref for OAS data types
374+ :param type: data type
375+ :return: ref
376+ """
377+ dataType_ref_map = dict ()
378+ # todo add support for byte , binary , password ,double data types
379+ dataType_ref_map ["integer" ] = "https://schema.org/Integer"
380+ dataType_ref_map ["string" ] = "https://schema.org/Text"
381+ dataType_ref_map ["long" ] = "http://books.xmlschemata.org/relaxng/ch19-77199.html"
382+ dataType_ref_map ["float" ] = "https://schema.org/Float"
383+ dataType_ref_map ["boolean" ] = "https://schema.org/Boolean"
384+ dataType_ref_map ["dateTime" ] = "https://schema.org/DateTime"
385+ dataType_ref_map ["date" ] = "https://schema.org/Date"
386+
387+ return dataType_ref_map [type ]
363388
364389
365390def get_parameters (global_ : Dict [str , Any ],
@@ -396,7 +421,25 @@ def get_parameters(global_: Dict[str, Any],
396421 param = "vocab:{}" .format (
397422 parameter ["schema" ]["$ref" ].split ('/' )[2 ])
398423 except KeyError :
399- param = ""
424+ type = parameter ["type" ]
425+ if type == "array" :
426+ # TODO adaptation to array representation after discussion
427+ items = parameter ["items" ]
428+ try :
429+ if items ["$ref" ].split (
430+ '/' )[2 ] in global_ ["class_names" ]:
431+ param = "vocab" + items ["$ref" ].split ('/' )[2 ]
432+ else :
433+ get_class_details (
434+ global_ , get_data_at_location (
435+ items ["$ref" ]), items ["$ref" ].split ('/' )[2 ], path = path )
436+ param = "vocab" + items ["$ref" ].split ('/' )[2 ]
437+ except KeyError :
438+ param = type_ref_mapping (items ["type" ])
439+ elif type == "object" :
440+ param = "string"
441+ else :
442+ param = type_ref_mapping (type )
400443
401444 return param
402445
0 commit comments