-
-
Notifications
You must be signed in to change notification settings - Fork 848
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -44,18 +45,39 @@ private function __construct() | |||
* | |||
* @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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @meyerbaptiste I have to add property
and collection
information everywhere :|.
I'm not satisfied with this, WDYT?
I haven't changed the OperationPathResolver
s 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's why I said it's not so easy! I had encountered the same problem... 😞
$operation['swagger_context']['tags'] = [$resourceMetadata->getShortName(), $parentResourceMetadata->getShortName()]; | ||
|
||
$path = $this->getPath($parentResourceMetadata->getShortName(), $operationName, $operation, OperationType::SUBRESOURCE); | ||
$method = 'GET'; // we only support GET for subresources |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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