-
-
Notifications
You must be signed in to change notification settings - Fork 912
Use operation output class name instead Resource short name in operati... #3741
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
Conversation
I quite like the idea of allowing customisation (that's why you could change the shortname), but only for the Output? It seems weird to me. The Output should just be a different representation of the same resource, so should not have a different naming per se. But I might be wrong. |
Hi GregoireHebert, thanks for your reply! What I'm trying to achieve is a subresource custom operation, but without some of the limitations the current suresource implementation has in API-Platform. Maybe there is a better option that I haven't found. For example, something like this In the Workflow resource yaml I set the collection operation:
And this is the route:
The problem is that the _api_resource_class parameter in the route definition is ignored, so I changed the collection operation to this one:
So now it works fine, even the SwaggerUI shows the right schema in the response sample value. But the only thing wrong is the Swagger description text for that Operation, as it says that it will return a collection of the parent resource, even if it shows the schema of the subresource in the example value. You can see it in action in this screenshot form the issue #3740 (comment) If the output class schema is shown in the Example value schema, why its name is not show in the description? |
You are absolutely right on this, and this one of the biggest problems on the current subResource implementation. It should be fixed thanks to #2706 which won't take place before v2.7 / v3. But in the meantime, maybe your solution could do in 2.6? IDK. |
I rebased to 2.5 from upstream, the failing checks look unrelated to my commit. |
Can you rebase ? This is correct indeed and I'd like to merge it :). |
Rebased to upstream :-) |
Thanks @maxtorete |
You are welcome! |
…ion summary