src/swagger2x.py
def swagger_property_names(json_data, input_path):
    """
    get the properties  from the schema that is referenced by the path in get (or put)
    :param json_data: the swagger file as json struct
    :param input_path: the path to which the if should be queried
    :return: list of if values
    """
    prop_values = []
    schema = None
    for path, path_item in json_data["paths"].items():
        if input_path == path:
            try:
                schema = path_item["get"]["responses"]["200"]["schema"]
            except:
                try:
                    schema = path_item["post"]["responses"]["200"]["schema"]
                except:
                    pass
            if schema is not None:
                def_data = json_data["definitions"]
                for def_name, def_item in def_data.items():
                    full_def_name = "#/definitions/" + def_name
                    if full_def_name == schema["$ref"]:
                        prop_block = find_key_link(def_item, "properties")
                        if prop_block is not None:
                            for prop_name, prop in prop_block.items():
                                prop_values.append(prop_name)
            else:
                print("swagger_property_names: schema not found:", input_path)
    return prop_values

    get the properties  from the schema that is referenced by the path in get (or put)
    :param json_data: the swagger file as json struct
    :param input_path: the path to which the if should be queried
    :return: list of if values
    
get the properties  from the schema that is referenced by the path in get (or put)
get the properties from the schema that is referenced by the path in get ( or put )
def swagger_property_names(json_data, input_path):
    prop_values = []
    schema = None
    for path, path_item in json_data["paths"].items():
        if input_path == path:
            try:
                schema = path_item["get"]["responses"]["200"]["schema"]
            except:
                try:
                    schema = path_item["post"]["responses"]["200"]["schema"]
                except:
                    pass
            if schema is not None:
                def_data = json_data["definitions"]
                for def_name, def_item in def_data.items():
                    full_def_name = "#/definitions/" + def_name
                    if full_def_name == schema["$ref"]:
                        prop_block = find_key_link(def_item, "properties")
                        if prop_block is not None:
                            for prop_name, prop in prop_block.items():
                                prop_values.append(prop_name)
            else:
                print("swagger_property_names: schema not found:", input_path)
    return prop_values
def swagger_property_names ( json_data , input_path ) : prop_values = [ ] schema = None for path , path_item in json_data [ "paths" ] . items ( ) : if input_path == path : try : schema = path_item [ "get" ] [ "responses" ] [ "200" ] [ "schema" ] except : try : schema = path_item [ "post" ] [ "responses" ] [ "200" ] [ "schema" ] except : pass if schema is not None : def_data = json_data [ "definitions" ] for def_name , def_item in def_data . items ( ) : full_def_name = "#/definitions/" + def_name if full_def_name == schema [ "$ref" ] : prop_block = find_key_link ( def_item , "properties" ) if prop_block is not None : for prop_name , prop in prop_block . items ( ) : prop_values . append ( prop_name ) else : print ( "swagger_property_names: schema not found:" , input_path ) return prop_values
get the properties  from the schema that is referenced by the path in get (or put)
get the properties from the schema that is referenced by the path in get ( or put )
"""
    get the properties  from the schema that is referenced by the path in get (or put)
    :param json_data: the swagger file as json struct
    :param input_path: the path to which the if should be queried
    :return: list of if values
    """
list of if values
list of if values
json_data
the swagger file as json struct
the swagger file as json struct
input_path
the path to which the if should be queried
the path to which the if should be queried