def format_param()

in schema/make_schema.py [0:0]


def format_param(param: click.core.Option) -> SamCliParameterSchema:
    """Format a click Option parameter to a SamCliParameter object.

    A parameter object should contain the following information that will be
    necessary for including in the JSON schema:
    * name - The name of the parameter
    * help - The parameter's description (may vary between commands)
    * type - The data type accepted by the parameter
      * type.choices - If there are only a certain number of options allowed,
                       a list of those allowed options
    * default - The default option for that parameter
    """
    if not param:
        raise SchemaGenerationException("Expected to format a parameter that doesn't exist")
    if not param.type.name:
        raise SchemaGenerationException(f"Parameter {param} passed without a type:\n{param.type}")

    param_type = []
    if "," in param.type.name:  # custom type with support for various input values
        param_type = [x.lower() for x in param.type.name.split(",")]
    else:
        param_type.append(param.type.name.lower())

    formatted_param_types = []
    # NOTE: Params do not have explicit "string" type; either "text" or "path".
    #       All choice options are from a set of strings.
    for param_name in param_type:
        if param_name in ["text", "path", "choice", "filename", "directory"]:
            formatted_param_types.append("string")
        elif param_name == "list":
            formatted_param_types.append("array")
        else:
            formatted_param_types.append(param_name or "string")
    formatted_param_types = sorted(list(set(formatted_param_types)))  # deduplicate

    formatted_param: SamCliParameterSchema = SamCliParameterSchema(
        param.name or "",
        formatted_param_types if len(formatted_param_types) > 1 else formatted_param_types[0],
        clean_text(param.help or ""),
        items="string" if "array" in formatted_param_types else None,
    )

    if param.default and param.name not in PARAMS_TO_OMIT_DEFAULT_FIELD:
        formatted_param.default = list(param.default) if isinstance(param.default, tuple) else param.default

    if param.type.name == "choice" and isinstance(param.type, click.Choice):
        formatted_param.choices = list(param.type.choices)

    return formatted_param