api-doc-parser icon indicating copy to clipboard operation
api-doc-parser copied to clipboard

Error parsing read-only resource

Open zpi12lmm opened this issue 10 months ago • 1 comments

API Platform version(s) affected: 4.1.7

Description
When I want to use operations on my read-only resource, I get an error like this:

Cannot find the class related to https://localhost/docs.jsonld#Entrypoint/greeting.

How to reproduce
This error can be reproduced as I described in this related issue: https://github.com/api-platform/api-platform/issues/2870

Possible Solution
I don't know all the intricacies, but it would be nice to be able to handle read-only resources. It might be worth considering an option where, for a minimal check of the availability of a resource for parsing, there is a new GetCollection() operation, not a new Post().

Additional Context
I researched this issue myself and found that this parser for Hydra only works in two cases: when the "operations" attribute is not defined (i.e. all default operations are available), or when among the defined operations there is an operation to create a resource (i.e. new Post()).

As I understand it, the creation method is currently a fallback: https://github.com/api-platform/api-doc-parser/blob/d09886dc2f2a92181f9df22a760c1995dadf8bcb/src/hydra/parseHydraDocumentation.ts#L181

zpi12lmm avatar Apr 13 '25 02:04 zpi12lmm