(parameters: Sequence[inspect.Parameter])
return parameter_schema
Create a full JSON schema for the given parameters
Create a full JSON schema for the given parameters
Create a full JSON schema for the given parameters
def make_parameter_schema(parameters: Sequence[inspect.Parameter]):
    """Create a full JSON schema for the given parameters"""
    parameter_schema = {
        "$schema": SCHEMA_URI,
        "type": "object",
        "additionalProperties": False,
        "properties": {},
        "required": [],
    }

    for parameter in parameters:
        if parameter.kind in (parameter.POSITIONAL_ONLY, parameter.VAR_POSITIONAL):
            logger.warning(
                "Positional-only arguments are not supported in event or RPC parameters: {}".format(
                    parameter
                )
            )
            continue

        if parameter.kind == parameter.VAR_KEYWORD:
            parameter_schema["additionalProperties"] = True
            continue

        parameter_schema["properties"][parameter.name] = parameter_to_schema(parameter)
        if parameter.default is empty:
            parameter_schema["required"].append(parameter.name)

    # required key should not be present if it is empty
    if not parameter_schema["required"]:
        parameter_schema.pop("required")

    return parameter_schema
def make_parameter_schema ( parameters : Sequence [ inspect . Parameter ] ) : parameter_schema = { "$schema" : SCHEMA_URI , "type" : "object" , "additionalProperties" : False , "properties" : { } , "required" : [ ] , } for parameter in parameters : if parameter . kind in ( parameter . POSITIONAL_ONLY , parameter . VAR_POSITIONAL ) : logger . warning ( "Positional-only arguments are not supported in event or RPC parameters: {}" . format ( parameter ) ) continue if parameter . kind == parameter . VAR_KEYWORD : parameter_schema [ "additionalProperties" ] = True continue parameter_schema [ "properties" ] [ parameter . name ] = parameter_to_schema ( parameter ) if parameter . default is empty : parameter_schema [ "required" ] . append ( parameter . name ) # required key should not be present if it is empty if not parameter_schema [ "required" ] : parameter_schema . pop ( "required" ) return parameter_schema