public Type toType() {
        Type out = Type.fromParameterType(type);

        if (defaultValue != null && !defaultValue.getType().equals(out)) {
            throw new RuntimeException(String.format("Invalid type for field \"default\": Type must match "
                    + "parameter type. Expected `%s`, found `%s`.", out, defaultValue.getType()));
        }

        if (!required) {
            out = Type.optionalType(out);
        }
        return out;
    }
Gets a {@link Type} for the parameter's type.

@return a Type for the parameter.
smithy-rules-engine/src/main/java/software/amazon/smithy/rulesengine/language/syntax/parameters/Parameter.java