Skip to content

Integer process arguments are passed as floats #110

@jonas-hurst

Description

@jonas-hurst

When an openEO process has an argument of type integer and a value for this argument is provided as an integer, this value is passed as a float.

Version: 2025.10.1

Below is an example. The assertion in the impl method fails, as parameter x is passed as a float, not as an integer.

from openeo_pg_parser_networkx import ProcessRegistry, Process, OpenEOProcessGraph

# Step 1)
# Define a process with an integer input

spec = {
    "id": "test_process",
    "summary": "foo",
    "description": "bar",
    "categories": [],
    "experimental": True,
    "parameters": [
        {
            "name": "x",
            "description": "test",
            "schema": {
                "type": "integer",
            }
        }
    ],
    "returns": {
        "description": "The same int",
        "schema": {
            "type": "integer"
        }
    }
}


def impl(x, *args, **kwargs):
    assert isinstance(x, int)  # THIS ASSERTION FAILS
    return x


# Step 2:
# Add process to registry

registry = ProcessRegistry()
registry["test_process"] = Process(spec, impl)


# Step 3:
# Make a process graph that uses this process and call it

process_graph = {
        "process_graph": {
            "test": {
                "process_id": "test_process",
                "arguments": {
                    "x": 1
                },
                "result": True,
            },
        },
        "parameters": [],
    }

parsed_graph = OpenEOProcessGraph(process_graph)
pg_callable = parsed_graph.to_callable(process_registry=registry)

out = pg_callable()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions