l5-swagger/swagger-php - adding component to block makes it dissapear from the output - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, February 26, 2022

l5-swagger/swagger-php - adding component to block makes it dissapear from the output

If I add this response to my definition:

@OA\Response(
    response="default",
    description="unexpected error",
    @OA\JsonContent(ref="#/components/schemas/ErrorModel"),
    @OA\XmlContent(ref="#/components/schemas/ErrorModel"),
    @OA\MediaType(
        mediaType="text/xml",
        @OA\Schema(ref="#/components/schemas/ErrorModel")
        ),
        @OA\MediaType(
          mediaType="text/html",
          @OA\Schema(ref="#/components/schemas/ErrorModel")
        )
 )

And then I place the Schema underneath like so:

/**
 * @OA\Schema(
 *     schema="ErrorModel",
 *     required={"code", "message"},
 *     @OA\Property(
 *         property="code",
 *         type="integer",
 *         format="int32"
 *     ),
 *     @OA\Property(
 *         property="message",
 *         type="string"
 *     )
 * )
 */

The command: php artisan l5-swagger:generate does not error but the block that contains the Response Definition with the component no longer gets included in the json but the schema for the component does?

Did I do something really obvious that is wrong as my experience with the library so far is if you do something wrong it generally tells you.



source https://stackoverflow.com/questions/71269831/l5-swagger-swagger-php-adding-component-to-block-makes-it-dissapear-from-the-o

No comments:

Post a Comment