Repository navigation
Fixes #25712: handle OpenAPI Path Item fields in REST ingestion - #32958
Conversation
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Code Review ✅ ApprovedFixes REST ingestion to correctly handle OpenAPI Path Item metadata fields like path-level OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
There was a problem hiding this comment.
🟢 Approval recommended
The fix is a targeted, spec-aligned traversal change with clear regression tests that would fail under the prior behavior and pass with the new iterator-based logic.
Pull request overview
This PR fixes REST/OpenAPI ingestion when a Path Item contains non-operation metadata fields (e.g., path-level parameters). It introduces a shared iterator over valid OpenAPI operation keys so only HTTP operations are treated as endpoints, preventing list/.get failures and ensuring each operation on the same path is assigned to the correct collection by its own tags.
Changes:
- Add a shared
_iter_path_operations()iterator (backed byOPENAPI_OPERATION_METHODS) to yield only valid OpenAPI Operation Objects frompaths. - Use the iterator for both collection discovery (
_path_collection_names) and endpoint filtering (_filter_collection_endpoints) so Path Item metadata is ignored and per-operation tagging is respected. - Add unit tests covering path-level
parametersordering and multi-operation-per-path collection assignment.
File summaries
| File | Description |
|---|---|
| ingestion/src/metadata/ingestion/source/api/rest/metadata.py | Filters paths traversal to OpenAPI HTTP operations only; fixes per-operation collection filtering and avoids treating Path Item metadata as endpoints. |
| ingestion/tests/unit/topology/api/test_rest.py | Adds regression tests for path-level parameters and for assigning multiple operations on the same path to their correct collections (including default). |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
✅ Playwright Results — workflow succeededValidated commit ✅ 109 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 49m 46s ⏱️ Max setup 4m 30s · max shard execution 11m 53s · max shard-job elapsed before upload 18m 44s · reporting 3s 🌐 236.12 requests/attempt · 1.77 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |



Describe your changes:
Fixes #25712
Valid OpenAPI Path Item objects can contain metadata fields such as path-level
parameters. The REST source was iterating every Path Item field as though it were an HTTP operation, so aparametersarray could trigger a list/.getfailure and discard every endpoint collected for that collection. Endpoint filtering also stopped after the first field and retained the entire Path Item, which assigned different operations on the same path to the wrong collection.This change adds a shared iterator for the OpenAPI HTTP operation keys (
get,put,post,delete,options,head,patch, andtrace) and uses it for both collection discovery and endpoint filtering. Path Item metadata is ignored, each operation is filtered by its own tags, and untagged operations continue to use the existingdefaultcollection.The behavior was reproduced against the pinned Open Food Facts OpenAPI document. Path-level
parametersis valid according to the OpenAPI 3.1.1 Path Item Object specification.Type of change:
High-level design:
N/A — small, two-file bug fix with no public API, schema, generated model, database, UI, or documentation changes.
Tests:
Use cases covered
parametersarray before an operation does not abort endpoint ingestion.parametersarray after an operation is not emitted as an endpoint.defaultcollection.pathscontinue to be handled without raising.Unit tests
ingestion/tests/unit/topology/api/test_rest.pymetadata.ingestion.source.api.rest.metadata(375 statements, 12 missed; branch coverage enabled by repository configuration).python -m pytest tests/unit/topology/api/test_rest.py::TestRest::test_path_parameters_are_not_ingested_as_operations tests/unit/topology/api/test_rest.py::TestRest::test_operations_on_one_path_use_their_own_collections -v— 2 passed.python -m pytest tests/unit/topology/api/test_rest.py -v— 98 passed.python -m pytest tests/unit/topology/api/ -v— 120 passed.python -m pytest tests/unit/topology/api/test_rest.py --cov=metadata.ingestion.source.api.rest.metadata --cov-report=term-missing— 98 passed, 95% module coverage.make unit_ingestion_dev_env— 9,552 passed, 12 skipped, 1 expected xfail.make py_format,make py_format_check, andmake static-checks— passed (0 type-check errors; 9 existing warnings outside the changed files).git diff --check— passed.Backend integration tests
Ingestion integration tests
Playwright (UI) tests
Manual testing performed
RestSourcecollection and endpoint producers.parameterswere accepted, noparametersendpoint was emitted, and the source recorded zero endpoint errors and zero source failures.UI screen recording / screenshots:
Not applicable — no UI changes.
Checklist:
Fixes <issue-number>: <short explanation>.Fixes #<issue-number>above.🤖 Generated with Claude Code