Repository navigation
Add subresources to hydra - #1225
Conversation
7df9c3e to
9ff3f67
Compare
9ff3f67 to
3238843
Compare
| public function getParentResourceClass(): string | ||
| { | ||
| return $this->parentResourceClass; | ||
| } |
There was a problem hiding this comment.
I'm not sure we need those informations here. Usually when using a SubresourceMetadata we already have those informations. I want to update the PR to try and remove those adds.
3becd17 to
224afe4
Compare
| ], | ||
| '/questions/{id}/answer' => [ | ||
| 'get' => new \ArrayObject([ | ||
| 'tags' => ['Answer'], |
There was a problem hiding this comment.
Shouldn't there be Answer and Question here?
|
We have to fix paths of sub-resources too: https://github.com/api-platform/core/pull/1192/files#diff-000bd9bbe078960ebd85ec9cbd642bcdR54 |
|
@meyerbaptiste could you remind me what needs to be done there? |
|
We have to use the router to resolve paths (because of route prefix), so the way to find the route of a sub-resource (not so easy). |
51d8f86 to
58961a3
Compare
| * @return string | ||
| */ | ||
| public static function generate(string $operationName, string $resourceShortName, $operationType): string | ||
| public static function generate(string $operationName, string $resourceShortName, $operationType, string $property = null, bool $subresourceCollection = false): string |
There was a problem hiding this comment.
ping @meyerbaptiste I have to add property and collection information everywhere :|.
I'm not satisfied with this, WDYT?
I haven't changed the OperationPathResolvers yet because I'd need to add so many hacks to add those 2 new arguments... Let me know if you've a better idea in mind, I'm kinda stuck in the no-breaking-change-loop here 😄.
There was a problem hiding this comment.
Yes that's why I said it's not so easy! I had encountered the same problem... 😞
| $operation['collection'] = $subresourceMetadata->isCollection(); | ||
| $operation['swagger_context']['tags'] = [$resourceMetadata->getShortName(), $parentResourceMetadata->getShortName()]; | ||
|
|
||
| $path = $this->getPath($parentResourceMetadata->getShortName(), $operationName, $operation, OperationType::SUBRESOURCE); |
There was a problem hiding this comment.
TODO: No need to declare variable.
e29b6cc to
7dfc162
Compare
7dfc162 to
af53ade
Compare
|
I've removed subresources on swagger for now. There is more work to be done before we can actually do this. See #1239 |
af53ade to
53ac8d5
Compare
53ac8d5 to
150b5a3
Compare
|
Thanks @pierredup @soyuka! |
Add subresources to hydra
ping @pierredup
Update of #1188