When working on adding subresources to swagger, we hit a wall with the OperationPathResolver. Indeed, because subresources are computed recursively, it's not possible to generate it's path through the OperationPathResolver.
We talked about it and came to this solution:
- Implement a "SubresourceTree" that will compute the whole tree (+ cache). This gives us the ability to retrieve a path/route name from a class and the properties tree.
- Deprecate the current
OperationPathResolver::resolveOperationPath method
- Create a new method with a more useful signature:
public function getOperationPath(ResourceMetadata $resourceMetadata, string $operationType, string $operation, string $operationName, ? $treeLikeBelow, maybe PropertyMetadata here): string;
The goal is to be able to retrieve an operation path. For this to work with subresources we need the following information:
Root => property => property => property
so that we know the beginning and the end of the subresource.
The following classes would need refactoring:
- OperationPathResolver
- ApiLoader
- RouteNameGenerator
- Swagger\DocumentationNormalizer
When working on adding subresources to swagger, we hit a wall with the
OperationPathResolver. Indeed, because subresources are computed recursively, it's not possible to generate it's path through theOperationPathResolver.We talked about it and came to this solution:
OperationPathResolver::resolveOperationPathmethodThe goal is to be able to retrieve an operation path. For this to work with subresources we need the following information:
so that we know the beginning and the end of the subresource.
The following classes would need refactoring: