Forum Discussion

Ale10's avatar
Ale10
New Contributor
8 months ago

assign a path reference to a schema using #ref in my OpenAPI documentation


I'm facing an issue where I need to assign a path reference to a schema using #ref in my OpenAPI documentation. Here's my current situation:

I'm working in the following controller file: app/Http/Controllers/Api/Abc/AbcApiController.php, and I've defined a response like this:

/**
* @OA\Response(
* response=200,
* description="path reference",
* @OA\JsonContent(ref="#/components/schemas/Abc")
* )
However, my schema is located in a different directory, specifically in app/Http/Resource/AbcResource.php. In AbcResource.php, I have defined the "Abc" schema like this:

/**
* @OA\Schema(
* schema="Abc",
* title="Abc",
* description="User model",
* @OA\Xml(
* name="Abc"
* )
* )
Given this separation of directories, I'm unsure how to correctly assign the path reference in the #ref field.

I would greatly appreciate any ideas, solutions, or suggestions you may have.

Thank you very much. 🙏🙏

No RepliesBe the first to reply