Problem/Motivation
OpenAPI assumes that every enabled REST resource and HTTP method has a corresponding Symfony route. In Drupal, this assumption is not always valid, as REST resources can be enabled without generating routes due to missing formats, permissions, or conditional route definitions.
When OpenAPI encounters such a resource, spec generation and the OpenAPI UI fail entirely, even though Drupal REST itself continues to function. A single misconfigured or legacy REST resource can therefore break API documentation for the whole site.
Steps to reproduce
- Enable REST and OpenAPI modules.
- Enable a REST resource and HTTP method.
- Configure the resource so that no route is generated (e.g. missing format or permission).
- Visit the OpenAPI UI page.
Proposed resolution
Treat missing routes as non-fatal during OpenAPI generation.
If no route is found for a REST resource and method, skip it and continue generating the specification.
Remaining tasks
- Adjust route resolution logic to return NULL when no route is found.
- Ensure callers handle missing routes safely.
- (Optional) Add logging or test coverage.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| 0001-Skip-REST-resources-without-routes-during-OpenAPI-ge.patch | 1.63 KB | mrebel |
Comments
Comment #2
mrebel commented