Skip to content

[Question]: is some solution to move all descriptive OA attributes from the route's method to another place (a separate class or method) ? #2441

@upsetcode

Description

@upsetcode

Version

5

Question

Is it possible to specify one attribute near the route method so that it points to an object that will contain all the attributes necessary to describe the route?

Goal: not to clutter the main code with attributes, so that the route method has only 2 attributes

For example:

#[Route(path: '/example', name: 'get-example', methods: [Request::METHOD_GET])]
#[OARouteSchema(ref: new NA\Model(type: ClassContainsExampleRouteSchema::class)))]
public function example():Response{...}

the class ClassContainsExampleRouteSchema contains all needed attributes for describes route (requests, response, tags, ...) OR it can use #[OA\Get(...)].

I know that I can describe everything in one attribute #[OA\Get(...)] on route, but it will contain too much code.

Perhaps there is some other solution to move all descriptive OA attributes from the route's method to another place (a separate class or method) ?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions