yin icon indicating copy to clipboard operation
yin copied to clipboard

Feature request: InfoDocument support

Open Doqnach opened this issue 5 years ago • 1 comments

I am looking for a way to define a pure "info" document. Easiest would be to create a base class that implements DocumentInterface, but all the WoohooLabs\Yin\JsonApi\Response\Responder::ok<...>() methods require a ResourceDocumentInterface.

So this left me with two options: create an InfoDocument that implemented ResourceDocumentInterface and somehow work around the methods that you have to implement, or have a method in WoohooLabs\Yin\JsonApi\Response\Responder that accept an InfoDocument extends DocumentInterface, but that also gives of course problems... Because several methods in ResourceDocumentInterface are marked as @internal, this also gives warnings (at least in Symfony).

So for now I just went for option 1 (create an InfoDocument implements ResourceDocumentInterface in the WoohooLabs\Yin\JsonApi\Schema\Document namespace) but maybe someone else has a better idea?

I feel this is something that Yin should support to be honest since it's a very legit JSON:API document type.

https://gist.github.com/Doqnach/b0a000e4f238e91a9085fc7ba57a2719

Doqnach avatar Jul 16 '19 11:07 Doqnach

Hi @Doqnach,

Sorry, I am totally out of bandwidth this summer. :( I'll try to read through this feature request and the other question you had as soon as I'll have some spare time.

kocsismate avatar Aug 13 '19 17:08 kocsismate