Fixed
Project:
JSON:API Views
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2022 at 06:29 UTC
Updated:
9 Aug 2026 at 01:10 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
varshith commentedAdding the resource type to route defaults fixes this. I am attaching a patch that works for me.
Comment #5
anybodyThanks @varshith I turned #2 into a MR to push things forward. Maybe someone using openapi could confirm the fix / workaround?
Comment #9
decipheredThanks @varshith for finding the missing resource-type route default. Thanks @anybody for opening MR !18 from it.
MR !18's fix sets a fake resource type,
ResourceType('view', 'view', ...), on every view's route. Testing it against a real openapi_jsonapi install showed every view gets the same generic "View" tag and no schema in the OpenAPI output, not real documentation. The crash in this issue also does not reproduce on current openapi/openapi_jsonapi releases: their owngetPaths()method already skips routes with noresource_typedefault, a guard that landed in 2020 for their issue #3173177, before this issue was filed.A separate MR takes a different approach: a view can have more than one bundle, so a single
resource_typedefault only has one correct answer when the view has exactly one bundle. That MR sets the real type in that case, and leaves the default unset for views spanning several bundles, since no single type is correct there. Kernel tests cover both cases, plus a bundle with no matching resource type.Comment #11
decipheredFixed and committed for a 8.x-1.2 release.