Skip to content

Subresources tree computation & refactor OperationPathResolver #1239

Description

@soyuka

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:

  1. 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.
  2. Deprecate the current OperationPathResolver::resolveOperationPath method
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions