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

fix-openapi-subresource #3690

Closed

Conversation

GregoireHebert
Copy link
Contributor

@GregoireHebert GregoireHebert commented Aug 27, 2020

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tickets fixes #3666 and #1616
License MIT
Doc PR ~

Copy link
Contributor

@vincentchalamon vincentchalamon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GregoireHebert GregoireHebert force-pushed the fix-openapi-subresources branch from cd7d2f6 to ffd05b5 Compare August 28, 2020 12:04
@GregoireHebert
Copy link
Contributor Author

I have no idea why the coverage is not satisfied...

@@ -75,7 +75,7 @@ public function testCreate()
],
'route_name' => 'api_dummy_entities_subresource_get_subresource',
'path' => '/dummy_entities/{id}/subresource.{_format}',
'operation_name' => 'subresource_get_subresource',
'operation_name' => 'api_dummy_entities_subresource_get_subresource',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this a BC break?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, IMO yes and no. Yes because, even if generated, it could have been used. But no because I think it's a bug and that it should always have been like that. And no because subresources are experimental and that part is internal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should at least be documented in the changelog as a BC break.

@jamesisaac
Copy link
Contributor

Works perfectly in my testing (checked against project which caused me to open #3666 ). Thanks a lot! Looking forward to seeing this released.

@jamesisaac
Copy link
Contributor

jamesisaac commented Jan 20, 2021

@GregoireHebert @soyuka Is there any chance this fix / something to this effect can be included in 2.6?

The bug outlined in #3666 is still present from what I can see. However the situation gets a bit worse still, as now in 2.6 even if the subresource is using the default normalization context, that schema doesn't get output either if that normalization context isn't used in any item or collection operations, i.e. when using the pattern of:

 *     collectionOperations={},
 *     itemOperations={"get"={"controller"=NotFoundAction::class, "read"=false, "output"=false}},

(although that can be worked around by having the item GET endpoint available but blocked off by security instead).

Anyway, the state as it is now means when using subresources in non-trivial ways, the types are incorrectly exposed via OpenAPI. So it creates lots of room for error in API consumers, and places where type schemas need to be determined manually, losing a big part of the benefit of OpenAPI.

@soyuka
Copy link
Member

soyuka commented Jan 22, 2021

This is a good patch but is definitely breaking things. I'll see if we can add this to the next release.

Also related to: #3458.

@stale
Copy link

stale bot commented Nov 5, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 5, 2022
@stale
Copy link

stale bot commented Jan 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 4, 2023
@stale stale bot closed this Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants