Disabled Content Rest API throws exception on REST Specification page

Created on 29 April 2022, over 2 years ago
Updated 15 May 2024, 6 months ago

Problem/Motivation

There is a issue on the REST listings which is pulling the disabled resources though they are are enabled once. This results in website error.

Initially we enabled the node api for testing purposes. Though we disabled it, it is taken into account with partial values and so we are getting this error "Exception: No route found for REST resource, entity.node" related to node API.

Steps to reproduce

Enable the restui module and navigate to admin/config/services/rest
Enable the "Content" resource and define the necessary settings.

Enable the openapi_ui module.
Navigate to admin/config/services/openapi
Click the "View/Download" button of REST Specification
You should be seeing the json format of Content resource.

Now navigate back to REST Listing page (admin/config/services/rest) and disable the "Content" resource.
Navigate to admin/config/services/openapi and click the "View/Download" button of REST Specification.
You will be seeing the error

The website encountered an unexpected error. Please try again later.

Exception: No route found for REST resource, entity.comment, for method GET in Drupal\openapi_rest\Plugin\openapi\OpenApiGenerator\RestGenerator->getRouteForResourceMethod() (line 287 of modules/contrib/openapi_rest/src/Plugin/openapi/OpenApiGenerator/RestGenerator.php).

Proposed resolution

Need conditional logic to filter only the enabled REST resources.

🐛 Bug report
Status

Closed: duplicate

Component

Code

Created by

🇮🇳India bala_28 Chennai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024