(annotation, default=empty)
return schemas
Convert an `inspect.Parameter` to JSON schemas

    This wraps `python_type_to_json_schemas()` with a little extra logic. Specifically,
    it determines the python type from:

        1. The parameter's annotation, falling back to...
        2. The type of the parameters default value

    This will return a list of JSON schemas. See note one `python_type_to_json_schemas()`
Convert an `inspect.Parameter` to JSON schemas
Convert an inspect . Parameter to JSON schemas
def annotation_to_json_schemas(annotation, default=empty):
    """Convert an `inspect.Parameter` to JSON schemas

    This wraps `python_type_to_json_schemas()` with a little extra logic. Specifically,
    it determines the python type from:

        1. The parameter's annotation, falling back to...
        2. The type of the parameters default value

    This will return a list of JSON schemas. See note one `python_type_to_json_schemas()`
    """
    if annotation is not empty:
        schemas = python_type_to_json_schemas(annotation)

        # Allow nulls if the parameter has a default value of None
        if default is not empty and default is None:
            null_schema = {"type": "null"}
            if null_schema not in schemas:
                schemas.append(null_schema)

    elif default is not empty and default is not None:
        schemas = python_type_to_json_schemas(type(default))
    else:
        schemas = [{}]

    return schemas
def annotation_to_json_schemas ( annotation , default = empty ) : if annotation is not empty : schemas = python_type_to_json_schemas ( annotation ) # Allow nulls if the parameter has a default value of None if default is not empty and default is None : null_schema = { "type" : "null" } if null_schema not in schemas : schemas . append ( null_schema ) elif default is not empty and default is not None : schemas = python_type_to_json_schemas ( type ( default ) ) else : schemas = [ { } ] return schemas