Skip to content
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

[RFC] Subresource metadata #2706

Closed
4 tasks
soyuka opened this issue Apr 7, 2019 · 15 comments
Closed
4 tasks

[RFC] Subresource metadata #2706

soyuka opened this issue Apr 7, 2019 · 15 comments

Comments

@soyuka
Copy link
Member

soyuka commented Apr 7, 2019

This issue merges multiple subresources issues because the root problem is the same.

While talking with core members at EU-FOSSA Hackathon we came to a solution. Best would be to refactor the ApiSubresource annotation so that it supports the same attributes as does the ApiResource. For example:

  • routing options
  • access_control
  • normalization context

Thanks to this it'll be easier to declare these and we solve the issue (mentioned in #1617 (comment)). The subresource metadata will not be in ApiResource anymore but directly inside the ApiSubresource annotation.

Todo list :

consider: #3466 and work on #3689
Maybe that this is a prerequisite for write support on subresources (see #2598 #2428)

ping @torreytsui @vincentchalamon please lmk if I forgot things
@lyrixx I'm closing related PRs we will definitely take back the work you did if we can, thanks for pushing this issues

@lyrixx
Copy link
Contributor

lyrixx commented Apr 7, 2019

Very good move! Can't wait to have it land in APIP 👍

@Devristo
Copy link

Would this RFC also help creating custom subresources as described in #1654?

@teohhanhui
Copy link
Contributor

teohhanhui commented Apr 10, 2019

Fix swagger and don't show the collection on the side that doesn't own the Subresource

I disagree. We could show subresource operations in a separate subsection, maybe? (Not sure if possible with Swagger UI.)

@dunglas
Copy link
Member

dunglas commented Apr 10, 2019

Not sure if possible with Swagger UI.

AFAIR we tried and it’s not.

@teohhanhui
Copy link
Contributor

To answer my own question:

OAI/OpenAPI-Specification#1367
swagger-api/swagger-ui#2129

So, nope.

@teohhanhui
Copy link
Contributor

teohhanhui commented Apr 10, 2019

An alternative is to tag them as e.g. Question (subresource)?

EDIT: Never mind, I think the suggestion in the original issue is better indeed. Just tag it from the root resource it could be accessed from. But perhaps the operation's description could be improved?

@torreytsui
Copy link

I think tagging on the root resource seems the best option we have so far. My thought is that subresource no matter how deep is it (/foos/1/bars/1/bazs/1/quxs/...), it starts with the root and the user will have to be aware of it and also consider it.

Fix the serialization context declaration

Should all levels configure in root (i.e., foo below) or spread into each level (i.e., foo configure bar, and bar configure baz)?

  • /foos/1/bars/1/bazs
  • /foos/1/bars/1/bazs/1
  • /foos/1/bars/1

Each of above are different operations and it makes sense to have their own independent configurations. How do we explicitly declare them?

How to enable / disable certain operations? At the moment, there are only item GET and collection GET, but when we implement write operations, it will get complicated and escalate as the depth grows.

@GregoireHebert
Copy link
Contributor

Subresource operations may override collection operations which should not happen (see api-platform/api-platform#1022)
This does not seems to be the case anymore.

@GregoireHebert
Copy link
Contributor

Fix swagger and don't show the collection on the side that doesn't own the Subresource (#1612)
Seems to be fixed too.

@GregoireHebert
Copy link
Contributor

#1616 is fixed in #3690

@GregoireHebert
Copy link
Contributor

I think this could be closed in favour of #3689

@brunonic
Copy link

brunonic commented Sep 1, 2020

swagger_context is still not supported under subresource operation ? #1873

@vincentchalamon
Copy link
Contributor

vincentchalamon commented Jul 25, 2022

Subresources have been deprecated in 2.7 and removed in 3.0

@gigo6000
Copy link

Subresources have been deprecated in 2.7 and removed in 3.0

@vincentchalamon Is this still valid? I see a Subresources section in the latest documentation (v3.1): https://api-platform.com/docs/core/subresources/

@vincentchalamon
Copy link
Contributor

@gigo6000 the ApiSubresource has been deprecated in 2.7 and removed in 3.0. The notion of Subresource is still active as everything is an ApiResource now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants