Skip to content

Warn about unsupported output format options#915

Open
Silvren wants to merge 2 commits into
Open-EO:masterfrom
Silvren:agent/warn-unsupported-format-options
Open

Warn about unsupported output format options#915
Silvren wants to merge 2 commits into
Open-EO:masterfrom
Silvren:agent/warn-unsupported-format-options

Conversation

@Silvren

@Silvren Silvren commented Jul 13, 2026

Copy link
Copy Markdown

Summary

  • compare save_result options with the format parameters advertised by /file_formats
  • warn about unsupported option names while preserving them in the process graph for backend compatibility
  • share the validation logic between raster and vector cubes
  • keep format matching case-insensitive and skip option validation when a backend does not publish parameter metadata
  • extend DummyBackend.setup_file_format to define format parameters in tests

Testing

  • python -m pytest tests/rest/datacube/test_datacube100.py tests/rest/datacube/test_vectorcube.py -q (478 passed, 2 skipped)
  • python -m pytest tests/rest/datacube/test_datacube100.py::test_save_result_format tests/rest/datacube/test_datacube100.py::test_save_result_format_options_warning tests/rest/datacube/test_vectorcube.py::test_save_result_format_options_warning -q
  • pre-commit run --files CHANGELOG.md openeo/rest/_testing.py openeo/rest/connection.py openeo/rest/datacube.py openeo/rest/vectorcube.py tests/rest/datacube/test_datacube100.py tests/rest/datacube/test_vectorcube.py

Fixes #649

Comment thread openeo/rest/datacube.py Outdated
Comment thread CHANGELOG.md
@Silvren
Silvren force-pushed the agent/warn-unsupported-format-options branch from 0eb1453 to b68d1a6 Compare July 17, 2026 08:19
@Silvren

Silvren commented Jul 17, 2026

Copy link
Copy Markdown
Author

Thanks — both points are addressed now. Format and option checks share _check_output_format, the changelog entry is at the bottom of Unreleased/Added, and the branch is rebased. Jenkins is green.

Comment thread openeo/rest/connection.py
self,
*,
format: str,
options: Optional[Mapping],

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you mark this as optional, also give it default None

Comment thread openeo/rest/connection.py
if format_name is None:
raise ValueError(f"Invalid format {format!r}. Should be one of {set(output_formats)}")

format_metadata = output_formats[format_name]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify to something like

matching = [(k, v) for (k, v) in output_formats.items() if k.lower() == format.lower()]
if len(matching) != 1:
    ....
[(_, format_metadata)] = matching

Comment thread openeo/rest/vectorcube.py
of another :py:class:`~openeo.rest.vectorcube.VectorCube` instance.
"""
format = format or "GeoJSON"
if self._connection and options:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The and options is wrong: the check should happen regardless

Comment thread CHANGELOG.md

### Added

- Warn when `save_result` uses output format options that are not advertised by the backend. ([#649](https://github.com/Open-EO/openeo-python-client/issues/649))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog has changed in the meantime,
it's probably best to do a rebase here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trigger warnings on usage of unlisted (output) format options

2 participants