ComposioHQ/composio · error · InvalidSchemaError

Invalid property type {p_type}: {schema!r}

Error message

Invalid property type {p_type}: {schema!r}

What it means

The OpenAPI→schema converter encountered a property 'type' value it cannot map to a Python type annotation (not string/integer/number/boolean/array/object/file/None) and raises InvalidSchemaError.

Source

Thrown at python/composio/utils/openapi.py:68

                for member in p_type
            )
        ]

    if p_type in OPENAPI_TO_PYTHON:
        return OPENAPI_TO_PYTHON[p_type]

    if p_type == "object":
        return _handle_object_type(schema=schema)

    if p_type == "array":
        return _handle_array_type(schema=schema)

    if p_type is None:
        # No type specified (e.g. a combiner option that is description-only or
        # an explicit Any), mirroring the top-level fallback below.
        return t.Any

    raise InvalidSchemaError(f"Invalid property type {p_type}: {schema!r}")


def _handle_composite_type(schemas: t.List[t.Dict]) -> t.Any:
    if not schemas:
        # An empty oneOf/anyOf has no options to union; fall back to Any.
        return t.Any
    return t.Union[tuple(map(_type_to_parameter, schemas))]


def _one_of_to_parameter(schema: t.Dict[str, t.Any]) -> t.Any:
    return _handle_composite_type(schemas=schema["oneOf"])


def _any_of_to_parameter(schema: t.Dict[str, t.Any]) -> t.Any:
    return _handle_composite_type(schemas=schema["anyOf"])


def _all_of_to_parameter(schema: t.Dict[str, t.Any]) -> t.Type:

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Normalize the spec so type is one of the standard JSON Schema primitives before conversion
  2. Move non-standard type info into 'format' (e.g. type: string, format: date-time)
  3. Omit 'type' entirely for combiner/description-only nodes — the converter falls back to Any

Example fix

# before
{"name": "when", "type": "date-time"}
# after
{"name": "when", "type": "string", "format": "date-time"}
Defensive patterns

Strategy: validation

Validate before calling

ALLOWED = {'string','integer','number','boolean','array','object','file',None}
def types_ok(node):
    if isinstance(node, dict):
        if node.get('type') is not None and node['type'] not in ALLOWED and not isinstance(node['type'], list):
            return False
        return all(types_ok(v) for v in node.values())
    if isinstance(node, list): return all(types_ok(v) for v in node)
    return True
assert types_ok(spec), 'non-standard type values in spec'

Try / catch

from composio.exceptions import InvalidSchemaError
try:
    sig = function_signature_from_jsonschema(schema)
except InvalidSchemaError as e:
    normalize_types(schema)  # rewrite vendor types to format
    sig = function_signature_from_jsonschema(schema)

Prevention

When it happens

Trigger: function_signature_from_jsonschema / _type_to_parameter receiving a schema dict whose 'type' is an unexpected value (e.g. 'float64', 'timestamp', a list of types not handled by _handle_array_type, or a custom vendor string).

Common situations: Hand-written OpenAPI specs with non-standard type names; third-party OpenAPI documents using vendor extension types; format confused with type (type: 'date-time').

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/6d4b31577d85285b. Report an issue: GitHub.