def process_output( self, path_dict, type_dict, output_dir, output_filename, gen_unique_op_id, prefix=''): description_map = utils.load_description() file_prefix = '' if prefix != '': file_prefix = prefix + "_" swagger_template = { 'swagger': '2.0', 'info': { 'description': description_map.get( output_filename, ''), 'title': utils.remove_curly_braces(output_filename), 'version': '2.0.0'}, 'host': '<vcenter>', 'securityDefinitions': { 'basic_auth': { 'type': 'basic'}}, 'basePath': '', 'produces': [ 'application/json' ], "consumes": [ "application/json" ], 'tags': [], 'schemes': [ 'https', 'http'], 'paths': collections.OrderedDict( sorted( path_dict.items())), 'definitions': collections.OrderedDict( sorted( type_dict.items()))} if not os.path.exists(output_dir): os.mkdir(output_dir) utils.write_json_data_to_file( output_dir + os.path.sep + file_prefix + utils.remove_curly_braces(output_filename) + '.json', swagger_template)
def process_output( self, path_dict, type_dict, output_dir, output_filename, gen_unique_op_id): description_map = utils.load_description() self.remove_com_vmware_from_dict(path_dict) if gen_unique_op_id: self.create_unique_op_ids(path_dict) self.remove_query_params(path_dict) self.remove_com_vmware_from_dict(type_dict) swagger_template = { 'swagger': '2.0', 'info': { 'description': description_map.get( output_filename, ''), 'title': utils.remove_curly_braces(output_filename), 'version': '2.0.0'}, 'host': '<vcenter>', 'securityDefinitions': { 'basic_auth': { 'type': 'basic'}}, 'basePath': '/rest', 'tags': [], 'schemes': [ 'https', 'http'], 'paths': collections.OrderedDict( sorted( path_dict.items())), 'definitions': collections.OrderedDict( sorted( type_dict.items()))} if not os.path.exists(output_dir): os.mkdir(output_dir) utils.write_json_data_to_file( output_dir + os.path.sep + '/rest' + "_" + utils.remove_curly_braces(output_filename) + '.json', swagger_template)
def process_output( self, path_dict, type_dict, output_dir, output_filename, gen_unique_op_id, prefix=''): reqBody = {} description_map = utils.load_description() if 'requestBodies' in type_dict: self.remove_com_vmware_from_dict(type_dict['requestBodies']) reqBody = collections.OrderedDict( sorted(type_dict['requestBodies'].items())) file_prefix = '' if prefix != '': file_prefix = prefix + "_" swagger_template = { 'openapi': '3.0.0', 'info': { 'description': description_map.get(output_filename, ''), 'title': utils.remove_curly_braces(output_filename), 'version': '2.0.0'}, 'paths': collections.OrderedDict(sorted(path_dict.items())), 'components': { 'requestBodies': reqBody}} if 'requestBodies' in type_dict: del type_dict['requestBodies'] swagger_template['components']['schemas'] = collections.OrderedDict( sorted(type_dict.items())) if not os.path.exists(output_dir): os.mkdir(output_dir) utils.write_json_data_to_file( output_dir + os.path.sep + file_prefix + utils.remove_curly_braces(output_filename) + '.json', swagger_template)