Skip to content

Return nil from request_operation for a document without paths - #227

Open
takayamaki wants to merge 4 commits into
ota42y:masterfrom
takayamaki:request-operation-without-paths
Open

takayamaki wants to merge 4 commits into
ota42y:masterfrom
takayamaki:request-operation-without-paths

Conversation

@takayamaki

Copy link
Copy Markdown
Contributor

Part of #215 (item 8).

OpenAPI 3.1 allows a document with only webhooks and no paths.
Such a document loads, but request_operation raised NoMethodError, because there was no path item finder.

Changes

  • request_operation now returns nil for a document without paths.
    This matches its documented return value for an operation that is not found.
  • A document with paths: {} already returned nil, and still does.

webhooks are not changed.
They are still loaded and can be read from the document.

OpenAPI 3.1 allows a document with only webhooks and no paths.
For such a document, request_operation raised NoMethodError because the path item finder was nil.
It now returns nil, which matches its documented contract for "not found".
A document without paths still exposes its webhooks.
A document with empty paths returns nil from request_operation, as before.
@takayamaki
takayamaki marked this pull request as ready for review October 27, 2026 14:42
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.

1 participant